Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(173)

Unified Diff: net/cookies/cookie_store.h

Issue 676073003: Add AddCallbackForCookie method to CookieStore. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix PrerenderCookieStore build Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/cookies/cookie_monster_unittest.cc ('k') | net/cookies/cookie_store_test_helpers.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cookies/cookie_store.h
diff --git a/net/cookies/cookie_store.h b/net/cookies/cookie_store.h
index b2552a6cf0e8e08a348e0959437395ed8cdefcc5..e6e48203fe1ebed8ba15c938daf2d5a807877ad4 100644
--- a/net/cookies/cookie_store.h
+++ b/net/cookies/cookie_store.h
@@ -12,6 +12,7 @@
#include "base/basictypes.h"
#include "base/callback.h"
+#include "base/callback_list.h"
#include "base/memory/ref_counted.h"
#include "base/time/time.h"
#include "net/base/net_export.h"
@@ -33,6 +34,9 @@ class NET_EXPORT CookieStore : public base::RefCountedThreadSafe<CookieStore> {
typedef base::Callback<void(const std::string& cookie)> GetCookiesCallback;
typedef base::Callback<void(bool success)> SetCookiesCallback;
typedef base::Callback<void(int num_deleted)> DeleteCallback;
+ typedef base::Closure CookieChangedCallback;
+ typedef base::CallbackList<void(void)> CookieChangedCallbackList;
+ typedef CookieChangedCallbackList::Subscription CookieChangedSubscription;
// Sets a single cookie. Expects a cookie line, like "a=1; domain=b.com".
//
@@ -91,6 +95,20 @@ class NET_EXPORT CookieStore : public base::RefCountedThreadSafe<CookieStore> {
// Returns the underlying CookieMonster.
virtual CookieMonster* GetCookieMonster() = 0;
+ // Add a callback to be notified when the set of cookies named |name| that
+ // would be sent for a request to |url| changes. The returned handle is
+ // guaranteed not to hold a hard reference to the CookieStore object.
+ //
+ // Note that this method consumes memory and CPU per (url, name) pair ever
+ // registered that are still consumed even after all subscriptions for that
+ // (url, name) pair are removed. If this method ever needs to support an
+ // unbounded amount of such pairs, this contract needs to change and
+ // implementors need to be improved to not behave this way.
+ virtual scoped_ptr<CookieChangedSubscription> AddCallbackForCookie(
+ const GURL& url,
+ const std::string& name,
+ const CookieChangedCallback& callback) = 0;
+
protected:
friend class base::RefCountedThreadSafe<CookieStore>;
CookieStore();
« no previous file with comments | « net/cookies/cookie_monster_unittest.cc ('k') | net/cookies/cookie_store_test_helpers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698