1 module awebview.wrapper.websession; 2 3 import awebview.wrapper.cpp; 4 import awebview.wrapper.webpreferences : WebPreferences; 5 import awebview.wrapper.webstring : WebString; 6 import awebview.wrapper.weburl : WebURL; 7 8 final class WebSession 9 { 10 this(awebview.wrapper.cpp.WebSession cppObj) pure nothrow @safe @nogc 11 { 12 _cppObj = cppObj; 13 } 14 15 16 @property 17 inout(awebview.wrapper.cpp.WebSession) cppObj() inout pure nothrow @safe @nogc 18 { return _cppObj; } 19 20 21 void release() const nothrow @nogc 22 { WebSessionMember.Release(_cppObj); } 23 24 @property 25 bool isOnDisk() const nothrow @nogc 26 { return WebSessionMember.IsOnDisk(_cppObj); } 27 28 @property 29 WebString dataPath() const nothrow @nogc 30 { 31 WebString dst; 32 WebSessionMember.data_path(_cppObj, dst.cppObj); 33 return dst; 34 } 35 36 @property 37 ref const(WebPreferences) preferences() const nothrow @nogc 38 { 39 auto p = WebSessionMember.preferences(_cppObj); 40 return *cast(const(WebPreferences)*)p; 41 } 42 43 //void addDataSource()(auto ref const WebString assetHost, IDataSource source); 44 45 //void setCookie()(auto ref const WebURL url, 46 // auto ref const WebString cookieString, 47 // bool isHTTPOnly, 48 // bool forceSessionCookie); 49 50 void clearCookie() nothrow @nogc 51 { WebSessionMember.ClearCookies(_cppObj); } 52 53 void clearCache() nothrow @nogc 54 { WebSessionMember.ClearCache(_cppObj); } 55 56 int getZoomForURL()(auto ref WebURL url) nothrow @nogc 57 { return WebSessionMember.GetZoomForURL(url); } 58 59 private: 60 awebview.wrapper.cpp.WebSession _cppObj; 61 }