/// <summary> /// Creates a new cookie manager. If |path| is NULL data will be stored in memory /// only. Otherwise, data will be stored at the specified |path|. To persist /// session cookies (cookies without an expiry date or validity interval) set /// |persistSessionCookies| to true (1). Session cookies are generally intended /// to be transient and most Web browsers do not persist them. If |callback| is /// non-NULL it will be executed asnychronously on the IO thread after the /// manager's storage has been initialized. /// </summary> /// <remarks> /// See also the original CEF documentation in /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_cookie_capi.h">cef/include/capi/cef_cookie_capi.h</see>. /// </remarks> public static CfxCookieManager CreateManager(string path, bool persistSessionCookies, CfxCompletionCallback callback) { var path_pinned = new PinnedString(path); var __retval = CfxApi.CookieManager.cfx_cookie_manager_create_manager(path_pinned.Obj.PinnedPtr, path_pinned.Length, persistSessionCookies ? 1 : 0, CfxCompletionCallback.Unwrap(callback)); path_pinned.Obj.Free(); return(CfxCookieManager.Wrap(__retval)); }
internal static void get_cookie_manager(IntPtr gcHandlePtr, out IntPtr __retval) { var self = (CfxRequestContextHandler)System.Runtime.InteropServices.GCHandle.FromIntPtr(gcHandlePtr).Target; if (self == null || self.CallbacksDisabled) { __retval = default(IntPtr); return; } var e = new CfxGetCookieManagerEventArgs(); self.m_GetCookieManager?.Invoke(self, e); e.m_isInvalid = true; __retval = CfxCookieManager.Unwrap(e.m_returnValue); }
internal static CfxCookieManager Wrap(IntPtr nativePtr) { if (nativePtr == IntPtr.Zero) { return(null); } lock (weakCache) { var wrapper = (CfxCookieManager)weakCache.Get(nativePtr); if (wrapper == null) { wrapper = new CfxCookieManager(nativePtr); weakCache.Add(wrapper); } else { CfxApi.cfx_release(nativePtr); } return(wrapper); } }
/// <summary> /// Returns the default cookie manager for this object. This will be the global /// cookie manager if this object is the global request context. Otherwise, /// this will be the default cookie manager used when this request context does /// not receive a value via CfxRequestContextHandler.GetCookieManager(). /// If |callback| is non-NULL it will be executed asnychronously on the IO /// thread after the manager's storage has been initialized. /// </summary> /// <remarks> /// See also the original CEF documentation in /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_request_context_capi.h">cef/include/capi/cef_request_context_capi.h</see>. /// </remarks> public CfxCookieManager GetDefaultCookieManager(CfxCompletionCallback callback) { return(CfxCookieManager.Wrap(CfxApi.cfx_request_context_get_default_cookie_manager(NativePtr, CfxCompletionCallback.Unwrap(callback)))); }
internal static CfxCookieManager Wrap(IntPtr nativePtr) { if(nativePtr == IntPtr.Zero) return null; lock(weakCache) { var wrapper = (CfxCookieManager)weakCache.Get(nativePtr); if(wrapper == null) { wrapper = new CfxCookieManager(nativePtr); weakCache.Add(wrapper); } else { CfxApi.cfx_release(nativePtr); } return wrapper; } }
/// <summary> /// Returns the global cookie manager. By default data will be stored at /// CfxSettings.CachePath if specified or in memory otherwise. If |callback| is /// non-NULL it will be executed asnychronously on the IO thread after the /// manager's storage has been initialized. Using this function is equivalent to /// calling CfxRequestContext.CfxRequestContextGetGlobalContext()->get_d /// efault_cookie_manager(). /// </summary> /// <remarks> /// See also the original CEF documentation in /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_cookie_capi.h">cef/include/capi/cef_cookie_capi.h</see>. /// </remarks> public static CfxCookieManager GetGlobalManager(CfxCompletionCallback callback) { return(CfxCookieManager.Wrap(CfxApi.CookieManager.cfx_cookie_manager_get_global_manager(CfxCompletionCallback.Unwrap(callback)))); }
/// <summary> /// Returns a cookie manager that neither stores nor retrieves cookies. All usage /// of cookies will be blocked including cookies accessed via the network /// (request/response headers), via JavaScript (document.cookie), and via /// CfxCookieManager functions. No cookies will be displayed in DevTools. If /// you wish to only block cookies sent via the network use the /// CfxRequestHandler CanGetCookies and CanSetCookie functions instead. /// </summary> /// <remarks> /// See also the original CEF documentation in /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_cookie_capi.h">cef/include/capi/cef_cookie_capi.h</see>. /// </remarks> public static CfxCookieManager GetBlockingManager() { return(CfxCookieManager.Wrap(CfxApi.CookieManager.cfx_cookie_manager_get_blocking_manager())); }