Chromium Code Reviews| 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 161 // Typical use is to create an OAuth2 token for appropriate scope and then | 161 // Typical use is to create an OAuth2 token for appropriate scope and then |
| 162 // use that token to call a Google API. | 162 // use that token to call a Google API. |
| 163 virtual bool HasOAuthLoginToken() const; | 163 virtual bool HasOAuthLoginToken() const; |
| 164 virtual const std::string& GetOAuth2LoginRefreshToken() const; | 164 virtual const std::string& GetOAuth2LoginRefreshToken() const; |
| 165 const std::string& GetOAuth2LoginAccessToken() const; | 165 const std::string& GetOAuth2LoginAccessToken() const; |
| 166 | 166 |
| 167 // For tests only. Doesn't save to the WebDB. | 167 // For tests only. Doesn't save to the WebDB. |
| 168 void IssueAuthTokenForTest(const std::string& service, | 168 void IssueAuthTokenForTest(const std::string& service, |
| 169 const std::string& auth_token); | 169 const std::string& auth_token); |
| 170 | 170 |
| 171 GaiaAuthConsumer::ClientLoginResult credentials() const { | |
|
Andrew T Wilson (Slow)
2012/08/11 01:40:20
Should we return a const reference instead of a co
Raghu Simha
2012/08/13 19:48:29
I returned a copy because |credentials_| is a simp
| |
| 172 return credentials_; | |
| 173 } | |
| 174 | |
| 171 // GaiaAuthConsumer implementation. | 175 // GaiaAuthConsumer implementation. |
| 172 virtual void OnIssueAuthTokenSuccess(const std::string& service, | 176 virtual void OnIssueAuthTokenSuccess(const std::string& service, |
| 173 const std::string& auth_token) OVERRIDE; | 177 const std::string& auth_token) OVERRIDE; |
| 174 virtual void OnIssueAuthTokenFailure( | 178 virtual void OnIssueAuthTokenFailure( |
| 175 const std::string& service, | 179 const std::string& service, |
| 176 const GoogleServiceAuthError& error) OVERRIDE; | 180 const GoogleServiceAuthError& error) OVERRIDE; |
| 177 virtual void OnClientOAuthSuccess(const ClientOAuthResult& result) OVERRIDE; | 181 virtual void OnClientOAuthSuccess(const ClientOAuthResult& result) OVERRIDE; |
| 178 virtual void OnClientOAuthFailure( | 182 virtual void OnClientOAuthFailure( |
| 179 const GoogleServiceAuthError& error) OVERRIDE; | 183 const GoogleServiceAuthError& error) OVERRIDE; |
| 180 | 184 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 248 | 252 |
| 249 friend class TokenServiceTest; | 253 friend class TokenServiceTest; |
| 250 FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, LoadTokensIntoMemoryBasic); | 254 FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, LoadTokensIntoMemoryBasic); |
| 251 FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, LoadTokensIntoMemoryAdvanced); | 255 FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, LoadTokensIntoMemoryAdvanced); |
| 252 FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, FullIntegrationNewServicesAdded); | 256 FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, FullIntegrationNewServicesAdded); |
| 253 | 257 |
| 254 DISALLOW_COPY_AND_ASSIGN(TokenService); | 258 DISALLOW_COPY_AND_ASSIGN(TokenService); |
| 255 }; | 259 }; |
| 256 | 260 |
| 257 #endif // CHROME_BROWSER_SIGNIN_TOKEN_SERVICE_H_ | 261 #endif // CHROME_BROWSER_SIGNIN_TOKEN_SERVICE_H_ |
| OLD | NEW |