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

Side by Side Diff: components/signin/core/browser/gaia_cookie_manager_service.h

Issue 1129463004: Let Ubertoken Fetch be primed with an access token. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 COMPONENTS_SIGNIN_CORE_BROWSER_GAIA_COOKIE_MANAGER_SERVICE_H 5 #ifndef COMPONENTS_SIGNIN_CORE_BROWSER_GAIA_COOKIE_MANAGER_SERVICE_H
6 #define COMPONENTS_SIGNIN_CORE_BROWSER_GAIA_COOKIE_MANAGER_SERVICE_H 6 #define COMPONENTS_SIGNIN_CORE_BROWSER_GAIA_COOKIE_MANAGER_SERVICE_H
7 7
8 #include <deque> 8 #include <deque>
9 9
10 #include "base/observer_list.h" 10 #include "base/observer_list.h"
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 153
154 GaiaCookieManagerService(OAuth2TokenService* token_service, 154 GaiaCookieManagerService(OAuth2TokenService* token_service,
155 const std::string& source, 155 const std::string& source,
156 SigninClient* signin_client); 156 SigninClient* signin_client);
157 ~GaiaCookieManagerService() override; 157 ~GaiaCookieManagerService() override;
158 158
159 void Init(); 159 void Init();
160 void Shutdown() override; 160 void Shutdown() override;
161 161
162 void AddAccountToCookie(const std::string& account_id); 162 void AddAccountToCookie(const std::string& account_id);
163 void AddAccountToCookieWithToken(const std::string& account_id,
164 const std::string& access_token);
163 165
164 // Returns if the listed accounts are up to date or not (ignore the out 166 // Returns if the listed accounts are up to date or not (ignore the out
165 // parameter if return is false). The parameter will be assigned the current 167 // parameter if return is false). The parameter will be assigned the current
166 // cached accounts. If the accounts are not up to date, a ListAccounts fetch 168 // cached accounts. If the accounts are not up to date, a ListAccounts fetch
167 // is sent GAIA and Observer::OnGaiaAccountsInCookieUpdated will be called. 169 // is sent GAIA and Observer::OnGaiaAccountsInCookieUpdated will be called.
168 bool ListAccounts(std::vector<std::pair<std::string,bool> >* accounts); 170 bool ListAccounts(std::vector<std::pair<std::string,bool> >* accounts);
169 171
170 // Add or remove observers of this helper. 172 // Add or remove observers of this helper.
171 void AddObserver(Observer* observer); 173 void AddObserver(Observer* observer);
172 void RemoveObserver(Observer* observer); 174 void RemoveObserver(Observer* observer);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 // Overridden from UbertokenConsumer. 209 // Overridden from UbertokenConsumer.
208 void OnUbertokenSuccess(const std::string& token) override; 210 void OnUbertokenSuccess(const std::string& token) override;
209 void OnUbertokenFailure(const GoogleServiceAuthError& error) override; 211 void OnUbertokenFailure(const GoogleServiceAuthError& error) override;
210 212
211 // Overridden from GaiaAuthConsumer. 213 // Overridden from GaiaAuthConsumer.
212 void OnMergeSessionSuccess(const std::string& data) override; 214 void OnMergeSessionSuccess(const std::string& data) override;
213 void OnMergeSessionFailure(const GoogleServiceAuthError& error) override; 215 void OnMergeSessionFailure(const GoogleServiceAuthError& error) override;
214 void OnListAccountsSuccess(const std::string& data) override; 216 void OnListAccountsSuccess(const std::string& data) override;
215 void OnListAccountsFailure(const GoogleServiceAuthError& error) override; 217 void OnListAccountsFailure(const GoogleServiceAuthError& error) override;
216 218
219 // Helper method for AddAccountToCookie* methods.
220 void AddAccountToCookieInternal(const std::string& account_id);
221
217 // Starts the proess of fetching the uber token and performing a merge session 222 // Starts the proess of fetching the uber token and performing a merge session
218 // for the next account. Virtual so that it can be overriden in tests. 223 // for the next account. Virtual so that it can be overriden in tests.
219 virtual void StartFetchingUbertoken(); 224 virtual void StartFetchingUbertoken();
220 225
221 // Virtual for testing purposes. 226 // Virtual for testing purposes.
222 virtual void StartFetchingMergeSession(); 227 virtual void StartFetchingMergeSession();
223 228
224 // Virtual for testing purpose. 229 // Virtual for testing purpose.
225 virtual void StartLogOutUrlFetch(); 230 virtual void StartLogOutUrlFetch();
226 231
(...skipping 16 matching lines...) Expand all
243 // and network delay. 248 // and network delay.
244 net::BackoffEntry fetcher_backoff_; 249 net::BackoffEntry fetcher_backoff_;
245 // We can safely depend on the SigninClient here because there is an explicit 250 // We can safely depend on the SigninClient here because there is an explicit
246 // dependency, as noted in the GaiaCookieManagerServiceFactory. 251 // dependency, as noted in the GaiaCookieManagerServiceFactory.
247 base::OneShotTimer<SigninClient> fetcher_timer_; 252 base::OneShotTimer<SigninClient> fetcher_timer_;
248 int fetcher_retries_; 253 int fetcher_retries_;
249 254
250 // The last fetched ubertoken, for use in MergeSession retries. 255 // The last fetched ubertoken, for use in MergeSession retries.
251 std::string uber_token_; 256 std::string uber_token_;
252 257
258 // The access token that can be used to prime the UberToken fetch.
259 std::string access_token_;
260
253 // Subscription to be called whenever the GAIA cookies change. 261 // Subscription to be called whenever the GAIA cookies change.
254 scoped_ptr<SigninClient::CookieChangedSubscription> 262 scoped_ptr<SigninClient::CookieChangedSubscription>
255 cookie_changed_subscription_; 263 cookie_changed_subscription_;
256 264
257 // A worklist for this class. Stores any pending requests that couldn't be 265 // A worklist for this class. Stores any pending requests that couldn't be
258 // executed right away, since this class only permits one request to be 266 // executed right away, since this class only permits one request to be
259 // executed at a time. 267 // executed at a time.
260 std::deque<GaiaCookieRequest> requests_; 268 std::deque<GaiaCookieRequest> requests_;
261 269
262 // List of observers to notify when merge session completes. 270 // List of observers to notify when merge session completes.
263 // Makes sure list is empty on destruction. 271 // Makes sure list is empty on destruction.
264 ObserverList<Observer, true> observer_list_; 272 ObserverList<Observer, true> observer_list_;
265 273
266 // Source to use with GAIA endpoints for accounting. 274 // Source to use with GAIA endpoints for accounting.
267 std::string source_; 275 std::string source_;
268 276
269 // True once the ExternalCCResultFetcher has completed once. 277 // True once the ExternalCCResultFetcher has completed once.
270 bool external_cc_result_fetched_; 278 bool external_cc_result_fetched_;
271 279
272 std::vector<std::pair<std::string, bool> > listed_accounts_; 280 std::vector<std::pair<std::string, bool> > listed_accounts_;
273 281
274 bool list_accounts_fetched_once_; 282 bool list_accounts_fetched_once_;
275 scoped_ptr<net::URLFetcher> logout_url_request_; 283 scoped_ptr<net::URLFetcher> logout_url_request_;
276 284
277 DISALLOW_COPY_AND_ASSIGN(GaiaCookieManagerService); 285 DISALLOW_COPY_AND_ASSIGN(GaiaCookieManagerService);
278 }; 286 };
279 287
280 #endif // COMPONENTS_SIGNIN_CORE_BROWSER_GAIA_COOKIE_MANAGER_SERVICE_H 288 #endif // COMPONENTS_SIGNIN_CORE_BROWSER_GAIA_COOKIE_MANAGER_SERVICE_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698