summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/api/identity/identity_api.h
diff options
context:
space:
mode:
authorcourage@chromium.org <courage@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-22 02:29:23 +0000
committercourage@chromium.org <courage@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-22 02:29:23 +0000
commitd2db51aa31ca57ce620723f5b6758f09a5ae593b (patch)
treecf76733442e6d2aafc85ddb8d21f03da583de413 /chrome/browser/extensions/api/identity/identity_api.h
parentd8b42e288d8fc5994163eed9c77ba87a5c16e489 (diff)
downloadchromium_src-d2db51aa31ca57ce620723f5b6758f09a5ae593b.zip
chromium_src-d2db51aa31ca57ce620723f5b6758f09a5ae593b.tar.gz
chromium_src-d2db51aa31ca57ce620723f5b6758f09a5ae593b.tar.bz2
Identity API: Add AccountTracker and attach it to identity.onSignInChanged
The AccountTracker class fetches gaia IDs for all accounts signed into Chrome, and calls its observers any time an account is added, removed, or changes sign-in state. The IdentityAPI class observes the AccountTracker and routes the events to listening apps and extensions. BUG=305830 Review URL: https://codereview.chromium.org/30503002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@230017 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/api/identity/identity_api.h')
-rw-r--r--chrome/browser/extensions/api/identity/identity_api.h21
1 files changed, 10 insertions, 11 deletions
diff --git a/chrome/browser/extensions/api/identity/identity_api.h b/chrome/browser/extensions/api/identity/identity_api.h
index e37c603..a9a7746 100644
--- a/chrome/browser/extensions/api/identity/identity_api.h
+++ b/chrome/browser/extensions/api/identity/identity_api.h
@@ -13,7 +13,9 @@
#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/gaia_web_auth_flow.h"
+#include "chrome/browser/extensions/api/identity/identity_event_router.h"
#include "chrome/browser/extensions/api/identity/identity_mint_queue.h"
#include "chrome/browser/extensions/api/identity/identity_signin_flow.h"
#include "chrome/browser/extensions/api/identity/web_auth_flow.h"
@@ -239,8 +241,7 @@ class IdentityTokenCacheValue {
};
class IdentityAPI : public ProfileKeyedAPI,
- public SigninGlobalError::AuthStatusProvider,
- public OAuth2TokenService::Observer {
+ public AccountTracker::Observer {
public:
struct TokenCacheKey {
TokenCacheKey(const std::string& extension_id,
@@ -255,7 +256,6 @@ class IdentityAPI : public ProfileKeyedAPI,
explicit IdentityAPI(Profile* profile);
virtual ~IdentityAPI();
- void Initialize();
// Request serialization queue for getAuthToken.
IdentityMintRequestQueue* mint_queue();
@@ -278,12 +278,11 @@ class IdentityAPI : public ProfileKeyedAPI,
virtual void Shutdown() OVERRIDE;
static ProfileKeyedAPIFactory<IdentityAPI>* GetFactoryInstance();
- // AuthStatusProvider implementation.
- virtual std::string GetAccountId() const OVERRIDE;
- virtual GoogleServiceAuthError GetAuthStatus() const OVERRIDE;
-
- // OAuth2TokenService::Observer implementation:
- virtual void OnRefreshTokenAvailable(const std::string& account_id) OVERRIDE;
+ // AccountTracker::Observer implementation:
+ virtual void OnAccountAdded(const AccountIds& ids) OVERRIDE;
+ virtual void OnAccountRemoved(const AccountIds& ids) OVERRIDE;
+ virtual void OnAccountSignInChanged(const AccountIds& ids, bool is_signed_in)
+ OVERRIDE;
private:
friend class ProfileKeyedAPIFactory<IdentityAPI>;
@@ -295,10 +294,10 @@ class IdentityAPI : public ProfileKeyedAPI,
static const bool kServiceIsNULLWhileTesting = true;
Profile* profile_;
- GoogleServiceAuthError error_;
- bool initialized_;
IdentityMintRequestQueue mint_queue_;
CachedTokens token_cache_;
+ AccountTracker account_tracker_;
+ IdentityEventRouter identity_event_router_;
};
template <>