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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 // Typical use is to create an OAuth2 token for appropriate scope and then | 170 // Typical use is to create an OAuth2 token for appropriate scope and then |
171 // use that token to call a Google API. | 171 // use that token to call a Google API. |
172 virtual bool HasOAuthLoginToken() const; | 172 virtual bool HasOAuthLoginToken() const; |
173 virtual const std::string& GetOAuth2LoginRefreshToken() const; | 173 virtual const std::string& GetOAuth2LoginRefreshToken() const; |
174 const std::string& GetOAuth2LoginAccessToken() const; | 174 const std::string& GetOAuth2LoginAccessToken() const; |
175 | 175 |
176 // For tests only. Doesn't save to the WebDB. | 176 // For tests only. Doesn't save to the WebDB. |
177 void IssueAuthTokenForTest(const std::string& service, | 177 void IssueAuthTokenForTest(const std::string& service, |
178 const std::string& auth_token); | 178 const std::string& auth_token); |
179 | 179 |
| 180 const GaiaAuthConsumer::ClientLoginResult& credentials() const { |
| 181 return credentials_; |
| 182 } |
| 183 |
180 // GaiaAuthConsumer implementation. | 184 // GaiaAuthConsumer implementation. |
181 virtual void OnIssueAuthTokenSuccess(const std::string& service, | 185 virtual void OnIssueAuthTokenSuccess(const std::string& service, |
182 const std::string& auth_token) OVERRIDE; | 186 const std::string& auth_token) OVERRIDE; |
183 virtual void OnIssueAuthTokenFailure( | 187 virtual void OnIssueAuthTokenFailure( |
184 const std::string& service, | 188 const std::string& service, |
185 const GoogleServiceAuthError& error) OVERRIDE; | 189 const GoogleServiceAuthError& error) OVERRIDE; |
186 virtual void OnClientOAuthSuccess(const ClientOAuthResult& result) OVERRIDE; | 190 virtual void OnClientOAuthSuccess(const ClientOAuthResult& result) OVERRIDE; |
187 virtual void OnClientOAuthFailure( | 191 virtual void OnClientOAuthFailure( |
188 const GoogleServiceAuthError& error) OVERRIDE; | 192 const GoogleServiceAuthError& error) OVERRIDE; |
189 | 193 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 | 261 |
258 friend class TokenServiceTest; | 262 friend class TokenServiceTest; |
259 FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, LoadTokensIntoMemoryBasic); | 263 FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, LoadTokensIntoMemoryBasic); |
260 FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, LoadTokensIntoMemoryAdvanced); | 264 FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, LoadTokensIntoMemoryAdvanced); |
261 FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, FullIntegrationNewServicesAdded); | 265 FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, FullIntegrationNewServicesAdded); |
262 | 266 |
263 DISALLOW_COPY_AND_ASSIGN(TokenService); | 267 DISALLOW_COPY_AND_ASSIGN(TokenService); |
264 }; | 268 }; |
265 | 269 |
266 #endif // CHROME_BROWSER_SIGNIN_TOKEN_SERVICE_H_ | 270 #endif // CHROME_BROWSER_SIGNIN_TOKEN_SERVICE_H_ |
OLD | NEW |