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

Side by Side Diff: net/cookies/cookie_monster.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, 1 month 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 unified diff | Download patch
« no previous file with comments | « net/cookies/canonical_cookie.cc ('k') | net/cookies/cookie_monster.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Brought to you by the letter D and the number 2. 5 // Brought to you by the letter D and the number 2.
6 6
7 #ifndef NET_COOKIES_COOKIE_MONSTER_H_ 7 #ifndef NET_COOKIES_COOKIE_MONSTER_H_
8 #define NET_COOKIES_COOKIE_MONSTER_H_ 8 #define NET_COOKIES_COOKIE_MONSTER_H_
9 9
10 #include <deque> 10 #include <deque>
11 #include <map> 11 #include <map>
12 #include <queue> 12 #include <queue>
13 #include <set> 13 #include <set>
14 #include <string> 14 #include <string>
15 #include <utility> 15 #include <utility>
16 #include <vector> 16 #include <vector>
17 17
18 #include "base/basictypes.h" 18 #include "base/basictypes.h"
19 #include "base/callback_forward.h" 19 #include "base/callback_forward.h"
20 #include "base/gtest_prod_util.h" 20 #include "base/gtest_prod_util.h"
21 #include "base/memory/linked_ptr.h"
21 #include "base/memory/ref_counted.h" 22 #include "base/memory/ref_counted.h"
22 #include "base/memory/scoped_ptr.h" 23 #include "base/memory/scoped_ptr.h"
23 #include "base/synchronization/lock.h" 24 #include "base/synchronization/lock.h"
24 #include "base/time/time.h" 25 #include "base/time/time.h"
25 #include "net/base/net_export.h" 26 #include "net/base/net_export.h"
26 #include "net/cookies/canonical_cookie.h" 27 #include "net/cookies/canonical_cookie.h"
27 #include "net/cookies/cookie_constants.h" 28 #include "net/cookies/cookie_constants.h"
28 #include "net/cookies/cookie_store.h" 29 #include "net/cookies/cookie_store.h"
29 30 #include "url/gurl.h"
30 class GURL;
31 31
32 namespace base { 32 namespace base {
33 class Histogram; 33 class Histogram;
34 class HistogramBase; 34 class HistogramBase;
35 class TimeTicks; 35 class TimeTicks;
36 } // namespace base 36 } // namespace base
37 37
38 namespace net { 38 namespace net {
39 39
40 class CookieMonsterDelegate; 40 class CookieMonsterDelegate;
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 // Both |other| and |this| must be loaded for this operation to succeed. 308 // Both |other| and |this| must be loaded for this operation to succeed.
309 // Furthermore, there may not be any cookies stored in |other| for |key|. 309 // Furthermore, there may not be any cookies stored in |other| for |key|.
310 // Returns false if any of these conditions is not met. 310 // Returns false if any of these conditions is not met.
311 bool CopyCookiesForKeyToOtherCookieMonster(std::string key, 311 bool CopyCookiesForKeyToOtherCookieMonster(std::string key,
312 CookieMonster* other); 312 CookieMonster* other);
313 313
314 // Find the key (for lookup in cookies_) based on the given domain. 314 // Find the key (for lookup in cookies_) based on the given domain.
315 // See comment on keys before the CookieMap typedef. 315 // See comment on keys before the CookieMap typedef.
316 std::string GetKey(const std::string& domain) const; 316 std::string GetKey(const std::string& domain) const;
317 317
318 virtual scoped_ptr<CookieChangedSubscription> AddCallbackForCookie(
319 const GURL& url,
320 const std::string& name,
321 const CookieChangedCallback& callback) override;
322
318 bool loaded(); 323 bool loaded();
319 324
320 private: 325 private:
321 // For queueing the cookie monster calls. 326 // For queueing the cookie monster calls.
322 class CookieMonsterTask; 327 class CookieMonsterTask;
323 template <typename Result> class DeleteTask; 328 template <typename Result> class DeleteTask;
324 class DeleteAllCreatedBetweenTask; 329 class DeleteAllCreatedBetweenTask;
325 class DeleteAllCreatedBetweenForHostTask; 330 class DeleteAllCreatedBetweenForHostTask;
326 class DeleteAllForHostTask; 331 class DeleteAllForHostTask;
327 class DeleteAllTask; 332 class DeleteAllTask;
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 base::Time last_statistic_record_time_; 693 base::Time last_statistic_record_time_;
689 694
690 bool keep_expired_cookies_; 695 bool keep_expired_cookies_;
691 bool persist_session_cookies_; 696 bool persist_session_cookies_;
692 697
693 // Static setting for whether or not file scheme cookies are allows when 698 // Static setting for whether or not file scheme cookies are allows when
694 // a new CookieMonster is created, or the accepted schemes on a CookieMonster 699 // a new CookieMonster is created, or the accepted schemes on a CookieMonster
695 // instance are reset back to defaults. 700 // instance are reset back to defaults.
696 static bool default_enable_file_scheme_; 701 static bool default_enable_file_scheme_;
697 702
703 typedef std::map<std::pair<GURL, std::string>,
704 linked_ptr<CookieChangedCallbackList>> CookieChangedHookMap;
705 CookieChangedHookMap hook_map_;
706
707 void RunCallbacks(const CanonicalCookie& cookie);
708
698 DISALLOW_COPY_AND_ASSIGN(CookieMonster); 709 DISALLOW_COPY_AND_ASSIGN(CookieMonster);
699 }; 710 };
700 711
701 class NET_EXPORT CookieMonsterDelegate 712 class NET_EXPORT CookieMonsterDelegate
702 : public base::RefCountedThreadSafe<CookieMonsterDelegate> { 713 : public base::RefCountedThreadSafe<CookieMonsterDelegate> {
703 public: 714 public:
704 // The publicly relevant reasons a cookie might be changed. 715 // The publicly relevant reasons a cookie might be changed.
705 enum ChangeCause { 716 enum ChangeCause {
706 // The cookie was changed directly by a consumer's action. 717 // The cookie was changed directly by a consumer's action.
707 CHANGE_COOKIE_EXPLICIT, 718 CHANGE_COOKIE_EXPLICIT,
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
775 virtual ~PersistentCookieStore() {} 786 virtual ~PersistentCookieStore() {}
776 787
777 private: 788 private:
778 friend class base::RefCountedThreadSafe<PersistentCookieStore>; 789 friend class base::RefCountedThreadSafe<PersistentCookieStore>;
779 DISALLOW_COPY_AND_ASSIGN(PersistentCookieStore); 790 DISALLOW_COPY_AND_ASSIGN(PersistentCookieStore);
780 }; 791 };
781 792
782 } // namespace net 793 } // namespace net
783 794
784 #endif // NET_COOKIES_COOKIE_MONSTER_H_ 795 #endif // NET_COOKIES_COOKIE_MONSTER_H_
OLDNEW
« no previous file with comments | « net/cookies/canonical_cookie.cc ('k') | net/cookies/cookie_monster.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698