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

Side by Side Diff: net/cookies/cookie_monster.h

Issue 2874973002: Flush Channel IDs when Cookies get saved to a persistent backend (Closed)
Patch Set: clean up a few things Created 3 years, 7 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 unified diff | Download patch
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 <stddef.h> 10 #include <stddef.h>
(...skipping 20 matching lines...) Expand all
31 #include "net/cookies/cookie_constants.h" 31 #include "net/cookies/cookie_constants.h"
32 #include "net/cookies/cookie_store.h" 32 #include "net/cookies/cookie_store.h"
33 #include "url/gurl.h" 33 #include "url/gurl.h"
34 34
35 namespace base { 35 namespace base {
36 class HistogramBase; 36 class HistogramBase;
37 } // namespace base 37 } // namespace base
38 38
39 namespace net { 39 namespace net {
40 40
41 class ChannelIDService;
41 class CookieMonsterDelegate; 42 class CookieMonsterDelegate;
42 43
43 // The cookie monster is the system for storing and retrieving cookies. It has 44 // The cookie monster is the system for storing and retrieving cookies. It has
44 // an in-memory list of all cookies, and synchronizes non-session cookies to an 45 // an in-memory list of all cookies, and synchronizes non-session cookies to an
45 // optional permanent storage that implements the PersistentCookieStore 46 // optional permanent storage that implements the PersistentCookieStore
46 // interface. 47 // interface.
47 // 48 //
48 // Tasks may be deferred if all affected cookies are not yet loaded from the 49 // Tasks may be deferred if all affected cookies are not yet loaded from the
49 // backing store. Otherwise, callbacks may be invoked immediately. 50 // backing store. Otherwise, callbacks may be invoked immediately.
50 // 51 //
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 static const size_t kDomainCookiesQuotaHigh; 128 static const size_t kDomainCookiesQuotaHigh;
128 129
129 // The store passed in should not have had Init() called on it yet. This 130 // The store passed in should not have had Init() called on it yet. This
130 // class will take care of initializing it. The backing store is NOT owned by 131 // class will take care of initializing it. The backing store is NOT owned by
131 // this class, but it must remain valid for the duration of the cookie 132 // this class, but it must remain valid for the duration of the cookie
132 // monster's existence. If |store| is NULL, then no backing store will be 133 // monster's existence. If |store| is NULL, then no backing store will be
133 // updated. If |delegate| is non-NULL, it will be notified on 134 // updated. If |delegate| is non-NULL, it will be notified on
134 // creation/deletion of cookies. 135 // creation/deletion of cookies.
135 CookieMonster(PersistentCookieStore* store, CookieMonsterDelegate* delegate); 136 CookieMonster(PersistentCookieStore* store, CookieMonsterDelegate* delegate);
136 137
138 // Like above, but includes a non-owning pointer |channel_id_service| for the
139 // corresponding ChannelIDService used with this CookieStore.
mattm 2017/05/12 00:02:47 add note about |channel_id_service| lifetime
nharper 2017/05/12 02:47:23 Done.
140 CookieMonster(PersistentCookieStore* store,
141 CookieMonsterDelegate* delegate,
142 ChannelIDService* channel_id_service);
143
137 // Only used during unit testing. 144 // Only used during unit testing.
138 CookieMonster(PersistentCookieStore* store, 145 CookieMonster(PersistentCookieStore* store,
139 CookieMonsterDelegate* delegate, 146 CookieMonsterDelegate* delegate,
140 base::TimeDelta last_access_threshold); 147 base::TimeDelta last_access_threshold);
141 148
142 ~CookieMonster() override; 149 ~CookieMonster() override;
143 150
144 // Replaces all the cookies by |list|. This method does not flush the backend. 151 // Replaces all the cookies by |list|. This method does not flush the backend.
145 // This method does not support setting secure cookies, which need source 152 // This method does not support setting secure cookies, which need source
146 // URLs. 153 // URLs.
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 static const int kDefaultCookieableSchemesCount; 217 static const int kDefaultCookieableSchemesCount;
211 218
212 std::unique_ptr<CookieChangedSubscription> AddCallbackForCookie( 219 std::unique_ptr<CookieChangedSubscription> AddCallbackForCookie(
213 const GURL& url, 220 const GURL& url,
214 const std::string& name, 221 const std::string& name,
215 const CookieChangedCallback& callback) override; 222 const CookieChangedCallback& callback) override;
216 223
217 bool IsEphemeral() override; 224 bool IsEphemeral() override;
218 225
219 private: 226 private:
227 CookieMonster(PersistentCookieStore* store,
228 CookieMonsterDelegate* delegate,
229 ChannelIDService* channel_id_service,
230 base::TimeDelta last_access_threshold);
231
220 // For queueing the cookie monster calls. 232 // For queueing the cookie monster calls.
221 class CookieMonsterTask; 233 class CookieMonsterTask;
222 template <typename Result> 234 template <typename Result>
223 class DeleteTask; 235 class DeleteTask;
224 class DeleteAllCreatedBetweenTask; 236 class DeleteAllCreatedBetweenTask;
225 class DeleteAllCreatedBetweenWithPredicateTask; 237 class DeleteAllCreatedBetweenWithPredicateTask;
226 class DeleteCookieTask; 238 class DeleteCookieTask;
227 class DeleteCanonicalCookieTask; 239 class DeleteCanonicalCookieTask;
228 class GetCookieListForURLWithOptionsTask; 240 class GetCookieListForURLWithOptionsTask;
229 class GetAllCookiesTask; 241 class GetAllCookiesTask;
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 721
710 // During loading, holds the set of all loaded cookie creation times. Used to 722 // During loading, holds the set of all loaded cookie creation times. Used to
711 // avoid ever letting cookies with duplicate creation times into the store; 723 // avoid ever letting cookies with duplicate creation times into the store;
712 // that way we don't have to worry about what sections of code are safe 724 // that way we don't have to worry about what sections of code are safe
713 // to call while it's in that state. 725 // to call while it's in that state.
714 std::set<int64_t> creation_times_; 726 std::set<int64_t> creation_times_;
715 727
716 std::vector<std::string> cookieable_schemes_; 728 std::vector<std::string> cookieable_schemes_;
717 729
718 scoped_refptr<CookieMonsterDelegate> delegate_; 730 scoped_refptr<CookieMonsterDelegate> delegate_;
731 ChannelIDService* channel_id_service_;
719 732
720 base::Time last_statistic_record_time_; 733 base::Time last_statistic_record_time_;
721 734
722 bool persist_session_cookies_; 735 bool persist_session_cookies_;
723 736
724 using CookieChangedHookMap = 737 using CookieChangedHookMap =
725 std::map<std::pair<GURL, std::string>, 738 std::map<std::pair<GURL, std::string>,
726 std::unique_ptr<CookieChangedCallbackList>>; 739 std::unique_ptr<CookieChangedCallbackList>>;
727 CookieChangedHookMap hook_map_; 740 CookieChangedHookMap hook_map_;
728 741
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 virtual ~PersistentCookieStore() {} 815 virtual ~PersistentCookieStore() {}
803 816
804 private: 817 private:
805 friend class base::RefCountedThreadSafe<PersistentCookieStore>; 818 friend class base::RefCountedThreadSafe<PersistentCookieStore>;
806 DISALLOW_COPY_AND_ASSIGN(PersistentCookieStore); 819 DISALLOW_COPY_AND_ASSIGN(PersistentCookieStore);
807 }; 820 };
808 821
809 } // namespace net 822 } // namespace net
810 823
811 #endif // NET_COOKIES_COOKIE_MONSTER_H_ 824 #endif // NET_COOKIES_COOKIE_MONSTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698