diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-03 22:14:15 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-03 22:14:15 +0000 |
commit | 3460228438564690022243511825894c9c600608 (patch) | |
tree | bada6636f1a8656ffb8ac481cad1c1d29bddf9f5 /webkit/glue/webcookie.h | |
parent | e56e96f80ce491b23454a039ae5eba1a1c6ee3f9 (diff) | |
download | chromium_src-3460228438564690022243511825894c9c600608.zip chromium_src-3460228438564690022243511825894c9c600608.tar.gz chromium_src-3460228438564690022243511825894c9c600608.tar.bz2 |
Revert 38001 and 38002.
Modify CookiePolicy to work asynchronously
This change will enable us to prompt the user before setting a cookie. While
we only need to prompt before setting, we actually need to make both
CanSetCookie and CanGetCookies asynchronous. This is necessary in order to
preserve FIFO ordering since the value returned by GetCookies depends on the
changes made to the cookie DB by SetCookie.
This change also includes some simplification of CookieStore. Instead of N
virtual functions, I distilled it down to only 4. The remaining functions are
instead expressed in terms of those.
While studying all the places where we currently use CookiePolicy, I found that
some of them were not appropriate. After discussing with Amit, I decided to
remove the policy checks in URLRequestAutomationJob. See the comments in the
code regarding this.
I changed the signature of CookieMonster::GetRawCookies to GetAllCookiesForURL
to better match GetAllCookies. Related to this change webkit/glue/webcookie.h
grows a constructor that takes a CanonicalCookie to help clean up some code.
On the Chrome side, ChromeURLRequestContext now has a ChromeCookiePolicy
object. That object is threadsafe ref counted because it is passed between the
UI and IO threads. It is responsible for implementing the queuing logic
described above. It will also in the future trigger the Chrome UI code to
actually show the setcookie prompt.
Please review the state machinery changes in URLRequestHttpJob carefully.
R=eroman
BUG=34331
TEST=no tests yet for prompting.
Review URL: http://codereview.chromium.org/564045
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38028 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/webcookie.h')
-rw-r--r-- | webkit/glue/webcookie.h | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/webkit/glue/webcookie.h b/webkit/glue/webcookie.h index 4966c442..2feb800 100644 --- a/webkit/glue/webcookie.h +++ b/webkit/glue/webcookie.h @@ -9,7 +9,7 @@ #ifndef WEBKIT_GLUE_WEBCOOKIE_H_ #define WEBKIT_GLUE_WEBCOOKIE_H_ -#include <string> +#include "net/base/cookie_monster.h" namespace webkit_glue { @@ -18,22 +18,34 @@ struct WebCookie { WebCookie(const std::string& name, const std::string& value, const std::string& domain, const std::string& path, double expires, bool http_only, bool secure, bool session) - : name(name), - value(value), - domain(domain), - path(path), - expires(expires), - http_only(http_only), - secure(secure), - session(session) { + : name(name), + value(value), + domain(domain), + path(path), + expires(expires), + http_only(http_only), + secure(secure), + session(session) { + } + + WebCookie(const std::string& domain, + const net::CookieMonster::CanonicalCookie& c) + : name(c.Name()), + value(c.Value()), + domain(domain), + path(c.Path()), + expires(c.ExpiryDate().ToDoubleT() * 1000), + http_only(c.IsHttpOnly()), + secure(c.IsSecure()), + session(!c.IsPersistent()) { } // For default constructions. - WebCookie() : - expires(0), - http_only(false), - secure(false), - session(false) { + WebCookie() + : expires(0), + http_only(false), + secure(false), + session(false) { } // Cookie name. |