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

Side by Side Diff: chrome/browser/browsing_data/browsing_data_cookie_helper.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 #ifndef CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_COOKIE_HELPER_H_ 5 #ifndef CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_COOKIE_HELPER_H_
6 #define CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_COOKIE_HELPER_H_ 6 #define CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_COOKIE_HELPER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 13 matching lines...) Expand all
24 } 24 }
25 25
26 // This class fetches cookie information on behalf of a caller 26 // This class fetches cookie information on behalf of a caller
27 // on the UI thread. 27 // on the UI thread.
28 // A client of this class need to call StartFetching from the UI thread to 28 // A client of this class need to call StartFetching from the UI thread to
29 // initiate the flow, and it'll be notified by the callback in its UI 29 // initiate the flow, and it'll be notified by the callback in its UI
30 // thread at some later point. 30 // thread at some later point.
31 class BrowsingDataCookieHelper 31 class BrowsingDataCookieHelper
32 : public base::RefCountedThreadSafe<BrowsingDataCookieHelper> { 32 : public base::RefCountedThreadSafe<BrowsingDataCookieHelper> {
33 public: 33 public:
34 using FetchCallback = base::Callback<void(const net::CookieList&)>; 34 using FetchCallback = base::Callback<void(const net::CookieList&)>;
Ryan Sleevi 2017/06/19 07:34:06 Is there a reason not to change this to a OnceCall
Randy Smith (Not in Mondays) 2017/06/21 17:54:53 Yes, though ideal would be to fix it. The MockBro
35 explicit BrowsingDataCookieHelper( 35 explicit BrowsingDataCookieHelper(
36 net::URLRequestContextGetter* request_context_getter); 36 net::URLRequestContextGetter* request_context_getter);
37 37
38 // Starts the fetching process, which will notify its completion via 38 // Starts the fetching process, which will notify its completion via
39 // callback. 39 // callback.
40 // This must be called only in the UI thread. 40 // This must be called only in the UI thread.
41 virtual void StartFetching(const FetchCallback& callback); 41 virtual void StartFetching(const FetchCallback& callback);
42 42
43 // Requests a single cookie to be deleted in the IO thread. This must be 43 // Requests a single cookie to be deleted in the IO thread. This must be
44 // called in the UI thread. 44 // called in the UI thread.
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 const std::string& cookie_line, 107 const std::string& cookie_line,
108 const net::CookieOptions& options); 108 const net::CookieOptions& options);
109 109
110 // Clears the list of canned cookies. 110 // Clears the list of canned cookies.
111 void Reset(); 111 void Reset();
112 112
113 // True if no cookie are currently stored. 113 // True if no cookie are currently stored.
114 bool empty() const; 114 bool empty() const;
115 115
116 // BrowsingDataCookieHelper methods. 116 // BrowsingDataCookieHelper methods.
117 void StartFetching( 117 void StartFetching(const FetchCallback& callback) override;
118 const net::CookieMonster::GetCookieListCallback& callback) override;
119 void DeleteCookie(const net::CanonicalCookie& cookie) override; 118 void DeleteCookie(const net::CanonicalCookie& cookie) override;
120 119
121 // Returns the number of stored cookies. 120 // Returns the number of stored cookies.
122 size_t GetCookieCount() const; 121 size_t GetCookieCount() const;
123 122
124 // Returns the map that contains the cookie lists for all frame urls. 123 // Returns the map that contains the cookie lists for all frame urls.
125 const OriginCookieSetMap& origin_cookie_set_map() { 124 const OriginCookieSetMap& origin_cookie_set_map() {
126 return origin_cookie_set_map_; 125 return origin_cookie_set_map_;
127 } 126 }
128 127
(...skipping 13 matching lines...) Expand all
142 void AddCookie(const GURL& frame_url, 141 void AddCookie(const GURL& frame_url,
143 const net::CanonicalCookie& cookie); 142 const net::CanonicalCookie& cookie);
144 143
145 // Map that contains the cookie sets for all frame origins. 144 // Map that contains the cookie sets for all frame origins.
146 OriginCookieSetMap origin_cookie_set_map_; 145 OriginCookieSetMap origin_cookie_set_map_;
147 146
148 DISALLOW_COPY_AND_ASSIGN(CannedBrowsingDataCookieHelper); 147 DISALLOW_COPY_AND_ASSIGN(CannedBrowsingDataCookieHelper);
149 }; 148 };
150 149
151 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_COOKIE_HELPER_H_ 150 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_COOKIE_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698