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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 signin_internals_util::SigninDiagnosticsObserver* observer); | 109 signin_internals_util::SigninDiagnosticsObserver* observer); |
110 | 110 |
111 // Initialize this token service with a request source | 111 // Initialize this token service with a request source |
112 // (usually from a GaiaAuthConsumer constant), and the profile. | 112 // (usually from a GaiaAuthConsumer constant), and the profile. |
113 // Typically you'd then update the credentials. | 113 // Typically you'd then update the credentials. |
114 void Initialize(const char* const source, Profile* profile); | 114 void Initialize(const char* const source, Profile* profile); |
115 | 115 |
116 // Used to determine whether Initialize() has been called. | 116 // Used to determine whether Initialize() has been called. |
117 bool Initialized() const { return !source_.empty(); } | 117 bool Initialized() const { return !source_.empty(); } |
118 | 118 |
119 // Add a token not supported by a fetcher. | |
120 void AddAuthTokenManually(const std::string& service, | |
121 const std::string& auth_token); | |
122 | |
123 // Update ClientLogin credentials in the token service. | 119 // Update ClientLogin credentials in the token service. |
124 // Afterwards you can StartFetchingTokens. | 120 // Afterwards you can StartFetchingTokens. |
125 void UpdateCredentials( | 121 void UpdateCredentials( |
126 const GaiaAuthConsumer::ClientLoginResult& credentials); | 122 const GaiaAuthConsumer::ClientLoginResult& credentials); |
127 | 123 |
128 // Update credentials in the token service with oauth2 tokens. | 124 // Update credentials in the token service with oauth2 tokens. |
129 // Afterwards you can StartFetchingTokens. | 125 // Afterwards you can StartFetchingTokens. |
130 void UpdateCredentialsWithOAuth2( | 126 void UpdateCredentialsWithOAuth2( |
131 const GaiaAuthConsumer::ClientOAuthResult& credentials); | 127 const GaiaAuthConsumer::ClientOAuthResult& credentials); |
132 | 128 |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 | 253 |
258 friend class TokenServiceTest; | 254 friend class TokenServiceTest; |
259 FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, LoadTokensIntoMemoryBasic); | 255 FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, LoadTokensIntoMemoryBasic); |
260 FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, LoadTokensIntoMemoryAdvanced); | 256 FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, LoadTokensIntoMemoryAdvanced); |
261 FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, FullIntegrationNewServicesAdded); | 257 FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, FullIntegrationNewServicesAdded); |
262 | 258 |
263 DISALLOW_COPY_AND_ASSIGN(TokenService); | 259 DISALLOW_COPY_AND_ASSIGN(TokenService); |
264 }; | 260 }; |
265 | 261 |
266 #endif // CHROME_BROWSER_SIGNIN_TOKEN_SERVICE_H_ | 262 #endif // CHROME_BROWSER_SIGNIN_TOKEN_SERVICE_H_ |
OLD | NEW |