| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 virtual bool HasTokenForService(const char* service) const; | 155 virtual bool HasTokenForService(const char* service) const; |
| 156 const std::string& GetTokenForService(const char* const service) const; | 156 const std::string& GetTokenForService(const char* const service) const; |
| 157 | 157 |
| 158 // For tests only. Doesn't save to the WebDB. | 158 // For tests only. Doesn't save to the WebDB. |
| 159 void IssueAuthTokenForTest(const std::string& service, | 159 void IssueAuthTokenForTest(const std::string& service, |
| 160 const std::string& auth_token); | 160 const std::string& auth_token); |
| 161 | 161 |
| 162 // GaiaAuthConsumer implementation. | 162 // GaiaAuthConsumer implementation. |
| 163 virtual void OnIssueAuthTokenSuccess(const std::string& service, | 163 virtual void OnIssueAuthTokenSuccess(const std::string& service, |
| 164 const std::string& auth_token) OVERRIDE; | 164 const std::string& auth_token) OVERRIDE; |
| 165 virtual void OnIssueAuthTokenFailure(const std::string& service, | 165 virtual void OnIssueAuthTokenFailure( |
| 166 const GoogleServiceAuthError& error) | 166 const std::string& service, |
| 167 OVERRIDE; | 167 const GoogleServiceAuthError& error) OVERRIDE; |
| 168 | 168 |
| 169 // GaiaOAuthConsumer implementation. | 169 // GaiaOAuthConsumer implementation. |
| 170 virtual void OnOAuthGetAccessTokenSuccess(const std::string& token, | 170 virtual void OnOAuthGetAccessTokenSuccess(const std::string& token, |
| 171 const std::string& secret) OVERRIDE; | 171 const std::string& secret) OVERRIDE; |
| 172 virtual void OnOAuthGetAccessTokenFailure( | 172 virtual void OnOAuthGetAccessTokenFailure( |
| 173 const GoogleServiceAuthError& error) OVERRIDE; | 173 const GoogleServiceAuthError& error) OVERRIDE; |
| 174 | 174 |
| 175 virtual void OnOAuthWrapBridgeSuccess(const std::string& service_scope, | 175 virtual void OnOAuthWrapBridgeSuccess(const std::string& service_scope, |
| 176 const std::string& token, | 176 const std::string& token, |
| 177 const std::string& expires_in) OVERRIDE; | 177 const std::string& expires_in) OVERRIDE; |
| 178 virtual void OnOAuthWrapBridgeFailure(const std::string& service_name, | 178 virtual void OnOAuthWrapBridgeFailure( |
| 179 const GoogleServiceAuthError& error) | 179 const std::string& service_name, |
| 180 OVERRIDE; | 180 const GoogleServiceAuthError& error) OVERRIDE; |
| 181 | 181 |
| 182 // WebDataServiceConsumer implementation. | 182 // WebDataServiceConsumer implementation. |
| 183 virtual void OnWebDataServiceRequestDone(WebDataService::Handle h, | 183 virtual void OnWebDataServiceRequestDone( |
| 184 const WDTypedResult* result); | 184 WebDataService::Handle h, |
| 185 const WDTypedResult* result) OVERRIDE; |
| 185 | 186 |
| 186 // content::NotificationObserver implementation. | 187 // content::NotificationObserver implementation. |
| 187 virtual void Observe(int type, | 188 virtual void Observe(int type, |
| 188 const content::NotificationSource& source, | 189 const content::NotificationSource& source, |
| 189 const content::NotificationDetails& details); | 190 const content::NotificationDetails& details) OVERRIDE; |
| 190 | 191 |
| 191 private: | 192 private: |
| 192 | 193 |
| 193 void FireTokenAvailableNotification(const std::string& service, | 194 void FireTokenAvailableNotification(const std::string& service, |
| 194 const std::string& auth_token); | 195 const std::string& auth_token); |
| 195 | 196 |
| 196 void FireTokenRequestFailedNotification(const std::string& service, | 197 void FireTokenRequestFailedNotification(const std::string& service, |
| 197 const GoogleServiceAuthError& error); | 198 const GoogleServiceAuthError& error); |
| 198 | 199 |
| 199 void LoadTokensIntoMemory(const std::map<std::string, std::string>& in_toks, | 200 void LoadTokensIntoMemory(const std::map<std::string, std::string>& in_toks, |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 content::NotificationRegistrar registrar_; | 253 content::NotificationRegistrar registrar_; |
| 253 | 254 |
| 254 FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, LoadTokensIntoMemoryBasic); | 255 FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, LoadTokensIntoMemoryBasic); |
| 255 FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, LoadTokensIntoMemoryAdvanced); | 256 FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, LoadTokensIntoMemoryAdvanced); |
| 256 FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, FullIntegrationNewServicesAdded); | 257 FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, FullIntegrationNewServicesAdded); |
| 257 | 258 |
| 258 DISALLOW_COPY_AND_ASSIGN(TokenService); | 259 DISALLOW_COPY_AND_ASSIGN(TokenService); |
| 259 }; | 260 }; |
| 260 | 261 |
| 261 #endif // CHROME_BROWSER_NET_GAIA_TOKEN_SERVICE_H_ | 262 #endif // CHROME_BROWSER_NET_GAIA_TOKEN_SERVICE_H_ |
| OLD | NEW |