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

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

Issue 2937963003: Shift cookie system callbacks to OnceCallback to impedance match mojo. (Closed)
Patch Set: Finish Merge Created 3 years, 6 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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 base::TimeDelta last_access_threshold); 148 base::TimeDelta last_access_threshold);
149 149
150 ~CookieMonster() override; 150 ~CookieMonster() override;
151 151
152 // Writes all the cookies in |list| into the store, replacing existing 152 // Writes all the cookies in |list| into the store, replacing existing
153 // cookies that collide. Does not affect cookies not listed in |list|. 153 // cookies that collide. Does not affect cookies not listed in |list|.
154 // This method does not flush the backend. 154 // This method does not flush the backend.
155 // TODO(rdsmith, mmenke): Do not use this function; it is deprecated 155 // TODO(rdsmith, mmenke): Do not use this function; it is deprecated
156 // and should be removed. 156 // and should be removed.
157 // See https://codereview.chromium.org/2882063002/#msg64. 157 // See https://codereview.chromium.org/2882063002/#msg64.
158 void SetAllCookiesAsync(const CookieList& list, 158 void SetAllCookiesAsync(const CookieList& list, SetCookiesCallback callback);
159 const SetCookiesCallback& callback);
160 159
161 // CookieStore implementation. 160 // CookieStore implementation.
162 void SetCookieWithOptionsAsync(const GURL& url, 161 void SetCookieWithOptionsAsync(const GURL& url,
163 const std::string& cookie_line, 162 const std::string& cookie_line,
164 const CookieOptions& options, 163 const CookieOptions& options,
165 const SetCookiesCallback& callback) override; 164 SetCookiesCallback callback) override;
166 void SetCookieWithDetailsAsync(const GURL& url, 165 void SetCookieWithDetailsAsync(const GURL& url,
167 const std::string& name, 166 const std::string& name,
168 const std::string& value, 167 const std::string& value,
169 const std::string& domain, 168 const std::string& domain,
170 const std::string& path, 169 const std::string& path,
171 base::Time creation_time, 170 base::Time creation_time,
172 base::Time expiration_time, 171 base::Time expiration_time,
173 base::Time last_access_time, 172 base::Time last_access_time,
174 bool secure, 173 bool secure,
175 bool http_only, 174 bool http_only,
176 CookieSameSite same_site, 175 CookieSameSite same_site,
177 CookiePriority priority, 176 CookiePriority priority,
178 const SetCookiesCallback& callback) override; 177 SetCookiesCallback callback) override;
179 void SetCanonicalCookieAsync(std::unique_ptr<CanonicalCookie> cookie, 178 void SetCanonicalCookieAsync(std::unique_ptr<CanonicalCookie> cookie,
180 bool secure_source, 179 bool secure_source,
181 bool modify_http_only, 180 bool modify_http_only,
182 const SetCookiesCallback& callback) override; 181 SetCookiesCallback callback) override;
183 void GetCookiesWithOptionsAsync(const GURL& url, 182 void GetCookiesWithOptionsAsync(const GURL& url,
184 const CookieOptions& options, 183 const CookieOptions& options,
185 const GetCookiesCallback& callback) override; 184 GetCookiesCallback callback) override;
186 void GetCookieListWithOptionsAsync( 185 void GetCookieListWithOptionsAsync(const GURL& url,
187 const GURL& url, 186 const CookieOptions& options,
188 const CookieOptions& options, 187 GetCookieListCallback callback) override;
189 const GetCookieListCallback& callback) override; 188 void GetAllCookiesAsync(GetCookieListCallback callback) override;
190 void GetAllCookiesAsync(const GetCookieListCallback& callback) override;
191 void DeleteCookieAsync(const GURL& url, 189 void DeleteCookieAsync(const GURL& url,
192 const std::string& cookie_name, 190 const std::string& cookie_name,
193 const base::Closure& callback) override; 191 base::OnceClosure callback) override;
194 void DeleteCanonicalCookieAsync(const CanonicalCookie& cookie, 192 void DeleteCanonicalCookieAsync(const CanonicalCookie& cookie,
195 const DeleteCallback& callback) override; 193 DeleteCallback callback) override;
196 void DeleteAllCreatedBetweenAsync(const base::Time& delete_begin, 194 void DeleteAllCreatedBetweenAsync(const base::Time& delete_begin,
197 const base::Time& delete_end, 195 const base::Time& delete_end,
198 const DeleteCallback& callback) override; 196 DeleteCallback callback) override;
199 void DeleteAllCreatedBetweenWithPredicateAsync( 197 void DeleteAllCreatedBetweenWithPredicateAsync(
200 const base::Time& delete_begin, 198 const base::Time& delete_begin,
201 const base::Time& delete_end, 199 const base::Time& delete_end,
202 const base::Callback<bool(const CanonicalCookie&)>& predicate, 200 const base::Callback<bool(const CanonicalCookie&)>& predicate,
203 const DeleteCallback& callback) override; 201 DeleteCallback callback) override;
204 void DeleteSessionCookiesAsync(const DeleteCallback&) override; 202 void DeleteSessionCookiesAsync(DeleteCallback) override;
205 void FlushStore(const base::Closure& callback) override; 203 void FlushStore(base::OnceClosure callback) override;
206 void SetForceKeepSessionState() override; 204 void SetForceKeepSessionState() override;
207 205
208 // Resets the list of cookieable schemes to the supplied schemes. Does 206 // Resets the list of cookieable schemes to the supplied schemes. Does
209 // nothing if called after first use of the instance (i.e. after the 207 // nothing if called after first use of the instance (i.e. after the
210 // instance initialization process). 208 // instance initialization process).
211 void SetCookieableSchemes(const std::vector<std::string>& schemes); 209 void SetCookieableSchemes(const std::vector<std::string>& schemes);
212 210
213 // Enables writing session cookies into the cookie database. If this this 211 // Enables writing session cookies into the cookie database. If this this
214 // method is called, it must be called before first use of the instance 212 // method is called, it must be called before first use of the instance
215 // (i.e. as part of the instance initialization process). 213 // (i.e. as part of the instance initialization process).
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 // This function has the side effect of changing the order of |old_cookies| 658 // This function has the side effect of changing the order of |old_cookies|
661 // and |new_cookies|. |cookies_to_add| and |cookies_to_delete| must be empty, 659 // and |new_cookies|. |cookies_to_add| and |cookies_to_delete| must be empty,
662 // and none of the arguments can be null. 660 // and none of the arguments can be null.
663 void ComputeCookieDiff(CookieList* old_cookies, 661 void ComputeCookieDiff(CookieList* old_cookies,
664 CookieList* new_cookies, 662 CookieList* new_cookies,
665 CookieList* cookies_to_add, 663 CookieList* cookies_to_add,
666 CookieList* cookies_to_delete); 664 CookieList* cookies_to_delete);
667 665
668 // Runs the given callback. Used to avoid running callbacks after the store 666 // Runs the given callback. Used to avoid running callbacks after the store
669 // has been destroyed. 667 // has been destroyed.
670 void RunCallback(const base::Closure& callback); 668 void RunCallback(base::OnceClosure callback);
671 669
672 // Run all cookie changed callbacks that are monitoring |cookie|. 670 // Run all cookie changed callbacks that are monitoring |cookie|.
673 // |removed| is true if the cookie was deleted. 671 // |removed| is true if the cookie was deleted.
674 void RunCookieChangedCallbacks(const CanonicalCookie& cookie, 672 void RunCookieChangedCallbacks(const CanonicalCookie& cookie,
675 CookieStore::ChangeCause cause); 673 CookieStore::ChangeCause cause);
676 674
677 // Histogram variables; see CookieMonster::InitializeHistograms() in 675 // Histogram variables; see CookieMonster::InitializeHistograms() in
678 // cookie_monster.cc for details. 676 // cookie_monster.cc for details.
679 base::HistogramBase* histogram_expiration_duration_minutes_; 677 base::HistogramBase* histogram_expiration_duration_minutes_;
680 base::HistogramBase* histogram_evicted_last_access_minutes_; 678 base::HistogramBase* histogram_evicted_last_access_minutes_;
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
818 816
819 virtual void AddCookie(const CanonicalCookie& cc) = 0; 817 virtual void AddCookie(const CanonicalCookie& cc) = 0;
820 virtual void UpdateCookieAccessTime(const CanonicalCookie& cc) = 0; 818 virtual void UpdateCookieAccessTime(const CanonicalCookie& cc) = 0;
821 virtual void DeleteCookie(const CanonicalCookie& cc) = 0; 819 virtual void DeleteCookie(const CanonicalCookie& cc) = 0;
822 820
823 // Instructs the store to not discard session only cookies on shutdown. 821 // Instructs the store to not discard session only cookies on shutdown.
824 virtual void SetForceKeepSessionState() = 0; 822 virtual void SetForceKeepSessionState() = 0;
825 823
826 // Flushes the store and posts |callback| when complete. |callback| may be 824 // Flushes the store and posts |callback| when complete. |callback| may be
827 // NULL. 825 // NULL.
828 virtual void Flush(const base::Closure& callback) = 0; 826 virtual void Flush(base::OnceClosure callback) = 0;
829 827
830 protected: 828 protected:
831 PersistentCookieStore() {} 829 PersistentCookieStore() {}
832 virtual ~PersistentCookieStore() {} 830 virtual ~PersistentCookieStore() {}
833 831
834 private: 832 private:
835 friend class base::RefCountedThreadSafe<PersistentCookieStore>; 833 friend class base::RefCountedThreadSafe<PersistentCookieStore>;
836 DISALLOW_COPY_AND_ASSIGN(PersistentCookieStore); 834 DISALLOW_COPY_AND_ASSIGN(PersistentCookieStore);
837 }; 835 };
838 836
839 } // namespace net 837 } // namespace net
840 838
841 #endif // NET_COOKIES_COOKIE_MONSTER_H_ 839 #endif // NET_COOKIES_COOKIE_MONSTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698