Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(738)

Unified Diff: chrome/browser/extensions/api/identity/identity_api.h

Issue 99173004: Identity API: add multi-account support to token cache and request queues (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/identity/identity_api.h
diff --git a/chrome/browser/extensions/api/identity/identity_api.h b/chrome/browser/extensions/api/identity/identity_api.h
index fc2378802875b7856fec4e6d34959f0cddad28c3..58adae66210b64cb572df25062a24562c94ab117 100644
--- a/chrome/browser/extensions/api/identity/identity_api.h
+++ b/chrome/browser/extensions/api/identity/identity_api.h
@@ -14,6 +14,7 @@
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "chrome/browser/extensions/api/identity/account_tracker.h"
+#include "chrome/browser/extensions/api/identity/extension_token_key.h"
#include "chrome/browser/extensions/api/identity/gaia_web_auth_flow.h"
#include "chrome/browser/extensions/api/identity/identity_mint_queue.h"
#include "chrome/browser/extensions/api/identity/identity_signin_flow.h"
@@ -169,6 +170,7 @@ class IdentityGetAuthTokenFunction : public ChromeAsyncExtensionFunction,
OAuth2MintTokenFlow::Mode gaia_mint_token_mode_;
bool should_prompt_for_signin_;
+ scoped_ptr<ExtensionTokenKey> token_key_;
std::string oauth2_client_id_;
// When launched in interactive mode, and if there is no existing grant,
// a permissions prompt will be popped up to the user.
@@ -252,16 +254,7 @@ class IdentityTokenCacheValue {
class IdentityAPI : public ProfileKeyedAPI,
public AccountTracker::Observer {
public:
- struct TokenCacheKey {
- TokenCacheKey(const std::string& extension_id,
- const std::set<std::string> scopes);
- ~TokenCacheKey();
- bool operator<(const TokenCacheKey& rhs) const;
- std::string extension_id;
- std::set<std::string> scopes;
- };
-
- typedef std::map<TokenCacheKey, IdentityTokenCacheValue> CachedTokens;
+ typedef std::map<ExtensionTokenKey, IdentityTokenCacheValue> CachedTokens;
explicit IdentityAPI(Profile* profile);
virtual ~IdentityAPI();
@@ -270,14 +263,12 @@ class IdentityAPI : public ProfileKeyedAPI,
IdentityMintRequestQueue* mint_queue();
// Token cache
- void SetCachedToken(const std::string& extension_id,
- const std::vector<std::string> scopes,
+ void SetCachedToken(const ExtensionTokenKey& key,
const IdentityTokenCacheValue& token_data);
void EraseCachedToken(const std::string& extension_id,
const std::string& token);
void EraseAllCachedTokens();
- const IdentityTokenCacheValue& GetCachedToken(
- const std::string& extension_id, const std::vector<std::string> scopes);
+ const IdentityTokenCacheValue& GetCachedToken(const ExtensionTokenKey& key);
const CachedTokens& GetAllCachedTokens();

Powered by Google App Engine
This is Rietveld 408576698