/// <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)
 {
     fixed (char* url_str = url)
     {
         var m_url = new cef_string_t(url_str, url != null ? url.Length : 0);
         return cef_cookie_manager_t.invoke_set_cookie(this.ptr, &m_url, cookie.GetNativeHandle()) != 0;
     }
 }
Example #2
0
        /// <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)
        {
            fixed(char *url_str = url)
            {
                var m_url = new cef_string_t(url_str, url != null ? url.Length : 0);

                return(cef_cookie_manager_t.invoke_set_cookie(this.ptr, &m_url, cookie.GetNativeHandle()) != 0);
            }
        }
Example #3
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>
        private int visit(cef_cookie_visitor_t *self, /*const*/ cef_cookie_t *cookie, int count, int total, int *deleteCookie)
        {
            ThrowIfObjectDisposed();

            var  m_cookie = CefCookie.From(cookie);
            bool m_deleteCookie;

            var handled = this.Visit(m_cookie, count, total, out m_deleteCookie);

            m_cookie.Dispose();

            *deleteCookie = m_deleteCookie ? 1 : 0;

            return(handled ? 1 : 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 virtual bool Visit(CefCookie cookie, int count, int total, out bool deleteCookie)
 {
     deleteCookie = false;
     return false;
 }
Example #5
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 virtual bool Visit(CefCookie cookie, int count, int total, out bool deleteCookie)
 {
     deleteCookie = false;
     return(false);
 }