| 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 #ifndef CHROME_BROWSER_EXTENSIONS_API_IDENTITY_IDENTITY_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_IDENTITY_IDENTITY_API_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_IDENTITY_IDENTITY_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_IDENTITY_IDENTITY_API_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 ~TokenCacheKey(); | 243 ~TokenCacheKey(); |
| 244 bool operator<(const TokenCacheKey& rhs) const; | 244 bool operator<(const TokenCacheKey& rhs) const; |
| 245 std::string extension_id; | 245 std::string extension_id; |
| 246 std::set<std::string> scopes; | 246 std::set<std::string> scopes; |
| 247 }; | 247 }; |
| 248 | 248 |
| 249 typedef std::map<TokenCacheKey, IdentityTokenCacheValue> CachedTokens; | 249 typedef std::map<TokenCacheKey, IdentityTokenCacheValue> CachedTokens; |
| 250 | 250 |
| 251 explicit IdentityAPI(Profile* profile); | 251 explicit IdentityAPI(Profile* profile); |
| 252 virtual ~IdentityAPI(); | 252 virtual ~IdentityAPI(); |
| 253 void Initialize(); |
| 253 | 254 |
| 254 // Request serialization queue for getAuthToken. | 255 // Request serialization queue for getAuthToken. |
| 255 IdentityMintRequestQueue* mint_queue(); | 256 IdentityMintRequestQueue* mint_queue(); |
| 256 | 257 |
| 257 // Token cache | 258 // Token cache |
| 258 void SetCachedToken(const std::string& extension_id, | 259 void SetCachedToken(const std::string& extension_id, |
| 259 const std::vector<std::string> scopes, | 260 const std::vector<std::string> scopes, |
| 260 const IdentityTokenCacheValue& token_data); | 261 const IdentityTokenCacheValue& token_data); |
| 261 void EraseCachedToken(const std::string& extension_id, | 262 void EraseCachedToken(const std::string& extension_id, |
| 262 const std::string& token); | 263 const std::string& token); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 283 friend class ProfileKeyedAPIFactory<IdentityAPI>; | 284 friend class ProfileKeyedAPIFactory<IdentityAPI>; |
| 284 | 285 |
| 285 // ProfileKeyedAPI implementation. | 286 // ProfileKeyedAPI implementation. |
| 286 static const char* service_name() { | 287 static const char* service_name() { |
| 287 return "IdentityAPI"; | 288 return "IdentityAPI"; |
| 288 } | 289 } |
| 289 static const bool kServiceIsNULLWhileTesting = true; | 290 static const bool kServiceIsNULLWhileTesting = true; |
| 290 | 291 |
| 291 Profile* profile_; | 292 Profile* profile_; |
| 292 GoogleServiceAuthError error_; | 293 GoogleServiceAuthError error_; |
| 294 bool initialized_; |
| 293 IdentityMintRequestQueue mint_queue_; | 295 IdentityMintRequestQueue mint_queue_; |
| 294 CachedTokens token_cache_; | 296 CachedTokens token_cache_; |
| 295 }; | 297 }; |
| 296 | 298 |
| 297 template <> | 299 template <> |
| 298 void ProfileKeyedAPIFactory<IdentityAPI>::DeclareFactoryDependencies(); | 300 void ProfileKeyedAPIFactory<IdentityAPI>::DeclareFactoryDependencies(); |
| 299 | 301 |
| 300 } // namespace extensions | 302 } // namespace extensions |
| 301 | 303 |
| 302 #endif // CHROME_BROWSER_EXTENSIONS_API_IDENTITY_IDENTITY_API_H_ | 304 #endif // CHROME_BROWSER_EXTENSIONS_API_IDENTITY_IDENTITY_API_H_ |
| OLD | NEW |