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

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

Issue 27283002: Identity API: Add chrome.identity.onSignInChanged routing and IDL (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: build fix Created 7 years, 2 months 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.cc
diff --git a/chrome/browser/extensions/api/identity/identity_api.cc b/chrome/browser/extensions/api/identity/identity_api.cc
index 890f99443daecfe880f334763e2d1df758a3bb1f..206c91f2cfeb1c5a21a13682826eb7647bdd6c37 100644
--- a/chrome/browser/extensions/api/identity/identity_api.cc
+++ b/chrome/browser/extensions/api/identity/identity_api.cc
@@ -666,14 +666,20 @@ const base::Time& IdentityTokenCacheValue::expiration_time() const {
IdentityAPI::IdentityAPI(Profile* profile)
: profile_(profile),
- error_(GoogleServiceAuthError::NONE) {
- SigninGlobalError::GetForProfile(profile_)->AddProvider(this);
- ProfileOAuth2TokenServiceFactory::GetForProfile(profile_)->AddObserver(this);
+ error_(GoogleServiceAuthError::NONE),
+ initialized_(false) {
}
IdentityAPI::~IdentityAPI() {
}
+void IdentityAPI::Initialize() {
+ SigninGlobalError::GetForProfile(profile_)->AddProvider(this);
+ ProfileOAuth2TokenServiceFactory::GetForProfile(profile_)->AddObserver(this);
+
+ initialized_ = true;
+}
+
IdentityMintRequestQueue* IdentityAPI::mint_queue() {
return &mint_queue_;
}
@@ -725,9 +731,14 @@ void IdentityAPI::ReportAuthError(const GoogleServiceAuthError& error) {
}
void IdentityAPI::Shutdown() {
+ if (!initialized_)
+ return;
+
SigninGlobalError::GetForProfile(profile_)->RemoveProvider(this);
ProfileOAuth2TokenServiceFactory::GetForProfile(profile_)->
RemoveObserver(this);
+
+ initialized_ = false;
}
static base::LazyInstance<ProfileKeyedAPIFactory<IdentityAPI> >
« no previous file with comments | « chrome/browser/extensions/api/identity/identity_api.h ('k') | chrome/browser/extensions/api/identity/identity_event_router.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698