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

Side by Side Diff: google_apis/gaia/oauth2_token_service.h

Issue 63253003: Fix issues with token refresh in AccountReconcilor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: wip Created 7 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 GOOGLE_APIS_GAIA_OAUTH2_TOKEN_SERVICE_H_ 5 #ifndef GOOGLE_APIS_GAIA_OAUTH2_TOKEN_SERVICE_H_
6 #define GOOGLE_APIS_GAIA_OAUTH2_TOKEN_SERVICE_H_ 6 #define GOOGLE_APIS_GAIA_OAUTH2_TOKEN_SERVICE_H_
7 7
8 #include <deque>
8 #include <map> 9 #include <map>
9 #include <set> 10 #include <set>
10 #include <string> 11 #include <string>
11 12
12 #include "base/basictypes.h" 13 #include "base/basictypes.h"
13 #include "base/gtest_prod_util.h" 14 #include "base/gtest_prod_util.h"
14 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
15 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
16 #include "base/observer_list.h" 17 #include "base/observer_list.h"
17 #include "base/threading/non_thread_safe.h" 18 #include "base/threading/non_thread_safe.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 79
79 // Classes that want to listen for token availability should implement this 80 // Classes that want to listen for token availability should implement this
80 // interface and register with the AddObserver() call. 81 // interface and register with the AddObserver() call.
81 class Observer { 82 class Observer {
82 public: 83 public:
83 // Called whenever a new login-scoped refresh token is available for 84 // Called whenever a new login-scoped refresh token is available for
84 // account |account_id|. Once available, access tokens can be retrieved for 85 // account |account_id|. Once available, access tokens can be retrieved for
85 // this account. This is called during initial startup for each token 86 // this account. This is called during initial startup for each token
86 // loaded. 87 // loaded.
87 virtual void OnRefreshTokenAvailable(const std::string& account_id) {} 88 virtual void OnRefreshTokenAvailable(const std::string& account_id) {}
89 virtual void OnRefreshTokenAvailable(
90 const std::deque<std::string>& account_ids) {}
88 // Called whenever the login-scoped refresh token becomes unavailable for 91 // Called whenever the login-scoped refresh token becomes unavailable for
89 // account |account_id|. 92 // account |account_id|.
90 virtual void OnRefreshTokenRevoked(const std::string& account_id) {} 93 virtual void OnRefreshTokenRevoked(const std::string& account_id) {}
91 // Called after all refresh tokens are loaded during OAuth2TokenService 94 // Called after all refresh tokens are loaded during OAuth2TokenService
92 // startup. 95 // startup.
93 virtual void OnRefreshTokensLoaded() {} 96 virtual void OnRefreshTokensLoaded() {}
94 protected: 97 protected:
95 virtual ~Observer() {} 98 virtual ~Observer() {}
96 }; 99 };
97 100
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 void ClearCacheForAccount(const std::string& account_id); 225 void ClearCacheForAccount(const std::string& account_id);
223 226
224 // Cancels all requests that are currently in progress. 227 // Cancels all requests that are currently in progress.
225 void CancelAllRequests(); 228 void CancelAllRequests();
226 229
227 // Cancels all requests related to a given |account_id|. 230 // Cancels all requests related to a given |account_id|.
228 void CancelRequestsForAccount(const std::string& account_id); 231 void CancelRequestsForAccount(const std::string& account_id);
229 232
230 // Called by subclasses to notify observers. 233 // Called by subclasses to notify observers.
231 virtual void FireRefreshTokenAvailable(const std::string& account_id); 234 virtual void FireRefreshTokenAvailable(const std::string& account_id);
235 virtual void FireRefreshTokenAvailable(
236 const std::deque<std::string>& account_ids);
232 virtual void FireRefreshTokenRevoked(const std::string& account_id); 237 virtual void FireRefreshTokenRevoked(const std::string& account_id);
233 virtual void FireRefreshTokensLoaded(); 238 virtual void FireRefreshTokensLoaded();
234 239
235 // Creates a request implementation. Can be overriden by derived classes to 240 // Creates a request implementation. Can be overriden by derived classes to
236 // provide additional control of token consumption. |consumer| will outlive 241 // provide additional control of token consumption. |consumer| will outlive
237 // the created request. 242 // the created request.
238 virtual scoped_ptr<RequestImpl> CreateRequest( 243 virtual scoped_ptr<RequestImpl> CreateRequest(
239 const std::string& account_id, 244 const std::string& account_id,
240 Consumer* consumer); 245 Consumer* consumer);
241 246
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 static int max_fetch_retry_num_; 347 static int max_fetch_retry_num_;
343 348
344 FRIEND_TEST_ALL_PREFIXES(OAuth2TokenServiceTest, RequestParametersOrderTest); 349 FRIEND_TEST_ALL_PREFIXES(OAuth2TokenServiceTest, RequestParametersOrderTest);
345 FRIEND_TEST_ALL_PREFIXES(OAuth2TokenServiceTest, 350 FRIEND_TEST_ALL_PREFIXES(OAuth2TokenServiceTest,
346 SameScopesRequestedForDifferentClients); 351 SameScopesRequestedForDifferentClients);
347 352
348 DISALLOW_COPY_AND_ASSIGN(OAuth2TokenService); 353 DISALLOW_COPY_AND_ASSIGN(OAuth2TokenService);
349 }; 354 };
350 355
351 #endif // GOOGLE_APIS_GAIA_OAUTH2_TOKEN_SERVICE_H_ 356 #endif // GOOGLE_APIS_GAIA_OAUTH2_TOKEN_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698