| OLD | NEW |
| 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 // The TokenService will supply authentication tokens for any service that | 5 // The TokenService will supply authentication tokens for any service that |
| 6 // needs it, such as sync. Whenever the user logs in, a controller watching | 6 // needs it, such as sync. Whenever the user logs in, a controller watching |
| 7 // the token service is expected either to call ClientLogin to derive a new | 7 // the token service is expected either to call ClientLogin to derive a new |
| 8 // SID and LSID, or to use GAIA OAuth requests to derive an OAuth1 access | 8 // SID and LSID, or to use GAIA OAuth requests to derive an OAuth1 access |
| 9 // token for the OAuthLogin scope. Whenever such credentials are available, | 9 // token for the OAuthLogin scope. Whenever such credentials are available, |
| 10 // the TokenService should be updated with new credentials. The controller | 10 // the TokenService should be updated with new credentials. The controller |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 #include "base/observer_list.h" | 53 #include "base/observer_list.h" |
| 54 #include "chrome/browser/signin/signin_internals_util.h" | 54 #include "chrome/browser/signin/signin_internals_util.h" |
| 55 #include "chrome/browser/webdata/web_data_service.h" | 55 #include "chrome/browser/webdata/web_data_service.h" |
| 56 #include "components/browser_context_keyed_service/browser_context_keyed_service
.h" | 56 #include "components/browser_context_keyed_service/browser_context_keyed_service
.h" |
| 57 #include "google_apis/gaia/gaia_auth_consumer.h" | 57 #include "google_apis/gaia/gaia_auth_consumer.h" |
| 58 #include "google_apis/gaia/gaia_auth_fetcher.h" | 58 #include "google_apis/gaia/gaia_auth_fetcher.h" |
| 59 #include "google_apis/gaia/google_service_auth_error.h" | 59 #include "google_apis/gaia/google_service_auth_error.h" |
| 60 | 60 |
| 61 class Profile; | 61 class Profile; |
| 62 class TokenServiceTest; | 62 class TokenServiceTest; |
| 63 class TokenWebData; |
| 63 | 64 |
| 64 namespace net { | 65 namespace net { |
| 65 class URLRequestContextGetter; | 66 class URLRequestContextGetter; |
| 66 } | 67 } |
| 67 | 68 |
| 68 // The TokenService is a Profile member, so all calls are expected | 69 // The TokenService is a Profile member, so all calls are expected |
| 69 // from the UI thread. | 70 // from the UI thread. |
| 70 class TokenService : public GaiaAuthConsumer, | 71 class TokenService : public GaiaAuthConsumer, |
| 71 public ProfileKeyedService, | 72 public ProfileKeyedService, |
| 72 public WebDataServiceConsumer { | 73 public WebDataServiceConsumer { |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 void SaveAuthTokenToDB(const std::string& service, | 221 void SaveAuthTokenToDB(const std::string& service, |
| 221 const std::string& auth_token); | 222 const std::string& auth_token); |
| 222 | 223 |
| 223 // Returns the index of the given service. | 224 // Returns the index of the given service. |
| 224 static int GetServiceIndex(const std::string& service); | 225 static int GetServiceIndex(const std::string& service); |
| 225 | 226 |
| 226 // The profile with which this instance was initialized, or NULL. | 227 // The profile with which this instance was initialized, or NULL. |
| 227 Profile* profile_; | 228 Profile* profile_; |
| 228 | 229 |
| 229 // Web data service to access tokens from. | 230 // Web data service to access tokens from. |
| 230 scoped_refptr<WebDataService> web_data_service_; | 231 scoped_refptr<TokenWebData> token_web_data_; |
| 231 // Getter to use for fetchers. | 232 // Getter to use for fetchers. |
| 232 scoped_refptr<net::URLRequestContextGetter> getter_; | 233 scoped_refptr<net::URLRequestContextGetter> getter_; |
| 233 // Request handle to load Gaia tokens from DB. | 234 // Request handle to load Gaia tokens from DB. |
| 234 WebDataService::Handle token_loading_query_; | 235 WebDataService::Handle token_loading_query_; |
| 235 // True if token loading has completed (regardless of success). | 236 // True if token loading has completed (regardless of success). |
| 236 bool tokens_loaded_; | 237 bool tokens_loaded_; |
| 237 | 238 |
| 238 // Gaia request source for Gaia accounting. | 239 // Gaia request source for Gaia accounting. |
| 239 std::string source_; | 240 std::string source_; |
| 240 // Credentials from ClientLogin for Issuing auth tokens. | 241 // Credentials from ClientLogin for Issuing auth tokens. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 256 | 257 |
| 257 friend class TokenServiceTest; | 258 friend class TokenServiceTest; |
| 258 FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, LoadTokensIntoMemoryBasic); | 259 FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, LoadTokensIntoMemoryBasic); |
| 259 FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, LoadTokensIntoMemoryAdvanced); | 260 FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, LoadTokensIntoMemoryAdvanced); |
| 260 FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, FullIntegrationNewServicesAdded); | 261 FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, FullIntegrationNewServicesAdded); |
| 261 | 262 |
| 262 DISALLOW_COPY_AND_ASSIGN(TokenService); | 263 DISALLOW_COPY_AND_ASSIGN(TokenService); |
| 263 }; | 264 }; |
| 264 | 265 |
| 265 #endif // CHROME_BROWSER_SIGNIN_TOKEN_SERVICE_H_ | 266 #endif // CHROME_BROWSER_SIGNIN_TOKEN_SERVICE_H_ |
| OLD | NEW |