/// <summary>
        /// Returns the global cookie manager. By default data will be stored at
        /// CefSettings.cache_path 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 method is equivalent to
        /// calling CefRequestContext::GetGlobalContext()->GetDefaultCookieManager().
        /// </summary>
        public static CefCookieManager GetGlobal(CefCompletionCallback callback)
        {
            var n_callback = callback != null?callback.ToNative() : null;

            return(CefCookieManager.FromNativeOrNull(
                       cef_cookie_manager_t.get_global_manager(n_callback)
                       ));
        }
        /// <summary>
        /// Returns the cookie manager for this object. If |callback| is non-NULL it
        /// will be executed asnychronously on the IO thread after the manager's
        /// storage has been initialized.
        /// </summary>
        public CefCookieManager GetCookieManager(CefCompletionCallback callback)
        {
            var n_callback = callback != null?callback.ToNative() : null;

            return(CefCookieManager.FromNativeOrNull(
                       cef_request_context_t.get_cookie_manager(_self, n_callback)
                       ));
        }
        /// <summary>
        /// Creates a new cookie manager. If |path| is empty 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 |persist_session_cookies| to true. Session cookies are
        /// generally intended to be transient and most Web browsers do not persist
        /// them. Returns NULL if creation fails.
        /// </summary>
        public static CefCookieManager Create(string path, bool persistSessionCookies)
        {
            fixed(char *path_str = path)
            {
                var n_path = new cef_string_t(path_str, path != null ? path.Length : 0);

                return(CefCookieManager.FromNativeOrNull(
                           cef_cookie_manager_t.create_manager(&n_path, persistSessionCookies ? 1 : 0)
                           ));
            }
        }
        /// <summary>
        /// Creates a new cookie manager. If |path| is empty 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 |persist_session_cookies| to true. 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>
        public static CefCookieManager Create(string path, bool persistSessionCookies, CefCompletionCallback callback)
        {
            fixed(char *path_str = path)
            {
                var n_path     = new cef_string_t(path_str, path != null ? path.Length : 0);
                var n_callback = callback != null?callback.ToNative() : null;

                return(CefCookieManager.FromNativeOrNull(
                           cef_cookie_manager_t.create_manager(&n_path, persistSessionCookies ? 1 : 0, n_callback)
                           ));
            }
        }
Exemple #5
0
 /// <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
 /// CefCookieManager methods. No cookies will be displayed in DevTools. If you
 /// wish to only block cookies sent via the network use the CefRequestHandler
 /// CanGetCookies and CanSetCookie methods instead.
 /// </summary>
 public static CefCookieManager GetBlockingManager()
 {
     return(CefCookieManager.FromNative(
                cef_cookie_manager_t.get_blocking_manager()
                ));
 }