summaryrefslogtreecommitdiffstats
path: root/net/base/cookie_store.h
diff options
context:
space:
mode:
authorerikwright@chromium.org <erikwright@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-08 18:03:31 +0000
committererikwright@chromium.org <erikwright@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-08 18:03:31 +0000
commit5e9791ee25e21ea59ffbde31d9330b4d3ccb4b85 (patch)
tree08280972fffb91b4729a4f2d3d61db84d9f0630b /net/base/cookie_store.h
parent73455b1bf7535666dd7d0655b398934f5ea9e953 (diff)
downloadchromium_src-5e9791ee25e21ea59ffbde31d9330b4d3ccb4b85.zip
chromium_src-5e9791ee25e21ea59ffbde31d9330b4d3ccb4b85.tar.gz
chromium_src-5e9791ee25e21ea59ffbde31d9330b4d3ccb4b85.tar.bz2
Finalize a CL originally by departed intern ycxiao@ that detaches the loading of cookies from the IO thread.
They are now loaded on the DB thread. Cookie operations received in the meantime are queued and executed, on the IO thread, in the order they were received, when loading completes. A few straggler clients are updated to use the asynchronous CookieStore/CookieMonster API as part of this CL, as the synchronous API is removed. BUG=68657 TEST=net_unittests / DeferredCookieTaskTest.* and CookieMonsterTest.* Review URL: http://codereview.chromium.org/7833042 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@100188 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/cookie_store.h')
-rw-r--r--net/base/cookie_store.h52
1 files changed, 9 insertions, 43 deletions
diff --git a/net/base/cookie_store.h b/net/base/cookie_store.h
index d0ede14..e6b0738 100644
--- a/net/base/cookie_store.h
+++ b/net/base/cookie_store.h
@@ -47,17 +47,20 @@ class NET_EXPORT CookieStore : public base::RefCountedThreadSafe<CookieStore> {
std::string mac_algorithm;
};
+ // Callback definitions.
+ typedef base::Callback <void(
+ const std::string& cookie_line,
+ const std::vector<CookieInfo>& cookie_infos)> GetCookieInfoCallback;
+ typedef base::Callback<void(const std::string& cookie)>
+ GetCookiesCallback;
+ typedef base::Callback<void(bool)> SetCookiesCallback;
+
+
// Sets a single cookie. Expects a cookie line, like "a=1; domain=b.com".
//
// Fails either if the cookie is invalid or if this is a non-HTTPONLY cookie
// and it would overwrite an existing HTTPONLY cookie.
// Returns true if the cookie is successfully set.
- virtual bool SetCookieWithOptions(const GURL& url,
- const std::string& cookie_line,
- const CookieOptions& options) = 0;
-
- typedef base::Callback<void(bool)> SetCookiesCallback;
-
virtual void SetCookieWithOptionsAsync(
const GURL& url,
const std::string& cookie_line,
@@ -70,12 +73,6 @@ class NET_EXPORT CookieStore : public base::RefCountedThreadSafe<CookieStore> {
//
// Simple interface, gets a cookie string "a=b; c=d" for the given URL.
// Use options to access httponly cookies.
- virtual std::string GetCookiesWithOptions(const GURL& url,
- const CookieOptions& options) = 0;
-
- typedef base::Callback<void(const std::string& cookie)>
- GetCookiesCallback;
-
virtual void GetCookiesWithOptionsAsync(
const GURL& url, const CookieOptions& options,
const GetCookiesCallback& callback) = 0;
@@ -84,24 +81,12 @@ class NET_EXPORT CookieStore : public base::RefCountedThreadSafe<CookieStore> {
// GetCookiesWithOptions except that it additionaly provides detailed
// information about the cookie contained in the cookie line. See |struct
// CookieInfo| above for details.
- virtual void GetCookiesWithInfo(const GURL& url,
- const CookieOptions& options,
- std::string* cookie_line,
- std::vector<CookieInfo>* cookie_info) = 0;
-
- // Using for complete the asyn interface
- typedef base::Callback <void(
- std::string* cookie_line,
- std::vector<CookieInfo>* cookie_infos)> GetCookieInfoCallback;
-
virtual void GetCookiesWithInfoAsync(
const GURL& url,
const CookieOptions& options,
const GetCookieInfoCallback& callback) = 0;
// Deletes the passed in cookie for the specified URL.
- virtual void DeleteCookie(const GURL& url,
- const std::string& cookie_name) = 0;
virtual void DeleteCookieAsync(const GURL& url,
const std::string& cookie_name,
const base::Closure& callback) = 0;
@@ -109,25 +94,6 @@ class NET_EXPORT CookieStore : public base::RefCountedThreadSafe<CookieStore> {
// Returns the underlying CookieMonster.
virtual CookieMonster* GetCookieMonster() = 0;
-
- // --------------------------------------------------------------------------
- // Helpers to make the above interface simpler for some cases.
-
- // Sets a cookie for the given URL using default options.
- bool SetCookie(const GURL& url, const std::string& cookie_line);
-
- // Gets cookies for the given URL using default options.
- std::string GetCookies(const GURL& url);
- void GetCookiesAsync(const GURL& url,
- const GetCookiesCallback& callback);
-
- // Sets a vector of response cookie values for the same URL.
- void SetCookiesWithOptions(const GURL& url,
- const std::vector<std::string>& cookie_lines,
- const CookieOptions& options);
- void SetCookies(const GURL& url,
- const std::vector<std::string>& cookie_lines);
-
protected:
friend class base::RefCountedThreadSafe<CookieStore>;
CookieStore();