/// <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)
                       ));
        }
Ejemplo n.º 2
0
        /// <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 CefRequestContextHandler::GetCookieManager(). 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 GetDefaultCookieManager(CefCompletionCallback callback)
        {
            var n_callback = callback != null?callback.ToNative() : null;

            return(CefCookieManager.FromNativeOrNull(
                       cef_request_context_t.get_default_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. 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)
                           ));
            }
        }