/// <summary>
 /// Sets a cookie given a valid URL and explicit user-provided cookie
 /// attributes. This function expects each attribute to be well-formed. It will
 /// check for disallowed characters (e.g. the ';' character is disallowed
 /// within the cookie value attribute) and fail without setting the cookie if
 /// such characters are found. If |callback| is non-NULL it will be executed
 /// asnychronously on the IO thread after the cookie has been set. Returns
 /// false if an invalid URL is specified or if cookies cannot be accessed.
 /// </summary>
 public bool SetCookie(string url, CefCookie cookie, CefSetCookieCallback callback)
 {
     if (string.IsNullOrEmpty(url))
     {
         throw new ArgumentNullException("url");
     }
     if (cookie == null)
         throw new ArgumentNullException("cookie"); }
Beispiel #2
0
        private int can_get_cookie(cef_resource_handler_t *self, cef_cookie_t *cookie)
        {
            CheckSelf(self);

            var m_cookie = CefCookie.FromNative(cookie);

            return(CanGetCookie(m_cookie) ? 1 : 0);
        }
Beispiel #3
0
        private int visit(cef_cookie_visitor_t *self, cef_cookie_t *cookie, int count, int total, int *deleteCookie)
        {
            CheckSelf(self);

            var  mCookie = CefCookie.FromNative(cookie);
            bool mDelete;

            var result = Visit(mCookie, count, total, out mDelete);

            *deleteCookie = mDelete ? 1 : 0;
            return(result ? 1 : 0);
        }
        private int can_send_cookie(cef_cookie_access_filter_t *self, cef_browser_t *browser, cef_frame_t *frame, cef_request_t *request, cef_cookie_t *cookie)
        {
            CheckSelf(self);

            var m_browser = CefBrowser.FromNativeOrNull(browser);
            var m_frame   = CefFrame.FromNativeOrNull(frame);
            var m_request = CefRequest.FromNative(request);
            var m_cookie  = CefCookie.FromNative(cookie);

            var m_result = CanSendCookie(m_browser, m_frame, m_request, m_cookie);

            return(m_result ? 1 : 0);
        }
Beispiel #5
0
        private int can_set_cookie(cef_request_handler_t *self, cef_browser_t *browser, cef_frame_t *frame, cef_request_t *request, cef_cookie_t *cookie)
        {
            CheckSelf(self);

            var mBrowser = CefBrowser.FromNative(browser);
            var mFrame   = CefFrame.FromNative(frame);
            var mRequest = CefRequest.FromNative(request);
            var mCookie  = CefCookie.FromNative(cookie);

            var mResult = CanSetCookie(mBrowser, mFrame, mRequest, mCookie);

            return(mResult ? 1 : 0);
        }
Beispiel #6
0
 protected override bool Visit(CefCookie cookie, int count, int total, out bool delete)
 {
     delete = true;
     return true;
 }
Beispiel #7
0
 /// <summary>
 /// Return true if the specified cookie returned with the response can be set
 /// or false otherwise.
 /// </summary>
 protected abstract bool CanSetCookie(CefCookie cookie);
Beispiel #8
0
 /// <summary>
 /// Return true if the specified cookie returned with the response can be set
 /// or false otherwise.
 /// </summary>
 protected abstract bool CanSetCookie(CefCookie cookie);
 /// <summary>
 /// Called on the IO thread after a resource response is received. The
 /// |browser| and |frame| values represent the source of the request, and may
 /// be NULL for requests originating from service workers or CefURLRequest.
 /// |request| cannot be modified in this callback. Return true if the specified
 /// cookie returned with the response can be saved or false otherwise.
 /// </summary>
 protected abstract bool CanSaveCookie(CefBrowser browser, CefFrame frame, CefRequest request, CefResponse response, CefCookie cookie);
 /// <summary>
 /// Called on the IO thread before a resource request is sent. The |browser|
 /// and |frame| values represent the source of the request, and may be NULL for
 /// requests originating from service workers or CefURLRequest. |request|
 /// cannot be modified in this callback. Return true if the specified cookie
 /// can be sent with the request or false otherwise.
 /// </summary>
 protected abstract bool CanSendCookie(CefBrowser browser, CefFrame frame, CefRequest request, CefCookie cookie);
Beispiel #11
0
 /// <summary>
 /// Method that will be called once for each cookie. |count| is the 0-based
 /// index for the current cookie. |total| is the total number of cookies.
 /// Set |deleteCookie| to true to delete the cookie currently being visited.
 /// Return false to stop visiting cookies. This method may never be called if
 /// no cookies are found.
 /// </summary>
 protected abstract bool Visit(CefCookie cookie, int count, int total, out bool delete);
Beispiel #12
0
 /// <summary>
 /// Called on the IO thread when receiving a network request with a
 /// "Set-Cookie" response header value represented by |cookie|. Return true to
 /// allow the cookie to be stored or false to block the cookie. The |request|
 /// object should not be modified in this callback.
 /// </summary>
 protected virtual bool CanSetCookie(CefBrowser browser, CefFrame frame, CefRequest request, CefCookie cookie)
 {
     return(true);
 }
 protected override bool CanSetCookie(CefCookie cookie)
 {
     return true;
 }
Beispiel #14
0
 /// <summary>
 /// Method that will be called once for each cookie. |count| is the 0-based
 /// index for the current cookie. |total| is the total number of cookies.
 /// Set |deleteCookie| to true to delete the cookie currently being visited.
 /// Return false to stop visiting cookies. This method may never be called if
 /// no cookies are found.
 /// </summary>
 protected abstract bool Visit(CefCookie cookie, int count, int total, out bool delete);
        /// <summary>
        /// Sets a cookie given a valid URL and explicit user-provided cookie
        /// attributes. This function expects each attribute to be well-formed. It will
        /// check for disallowed characters (e.g. the ';' character is disallowed
        /// within the cookie value attribute) and will return false without setting
        /// the cookie if such characters are found. This method must be called on the
        /// IO thread.
        /// </summary>
        public bool SetCookie(string url, CefCookie cookie)
        {
            if (string.IsNullOrEmpty(url)) throw new ArgumentNullException("url");
            if (cookie == null) throw new ArgumentNullException("cookie");

            int n_result;
            var n_cookie = cookie.ToNative();
            fixed (char* url_str = url)
            {
                var n_url = new cef_string_t(url_str, url.Length);
                n_result = cef_cookie_manager_t.set_cookie(_self, &n_url, n_cookie);
            }
            CefCookie.Free(n_cookie);
            return n_result != 0;
        }
Beispiel #16
0
 protected override bool CanSetCookie(CefCookie cookie)
 {
     throw new NotImplementedException();
 }