Index: chrome/browser/extensions/api/identity/account_tracker.cc |
diff --git a/chrome/browser/extensions/api/identity/account_tracker.cc b/chrome/browser/extensions/api/identity/account_tracker.cc |
index daea002bc0100679d0aec0c327a7547f37d948cf..425c0799e60edb71207bf36362288fff9e426cfd 100644 |
--- a/chrome/browser/extensions/api/identity/account_tracker.cc |
+++ b/chrome/browser/extensions/api/identity/account_tracker.cc |
@@ -11,7 +11,6 @@ |
#include "chrome/browser/profiles/profile.h" |
#include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
#include "chrome/browser/signin/signin_manager.h" |
-#include "chrome/browser/signin/signin_manager_factory.h" |
#include "components/signin/core/browser/profile_oauth2_token_service.h" |
#include "content/public/browser/notification_details.h" |
#include "extensions/browser/extension_system.h" |
@@ -24,9 +23,12 @@ AccountTracker::AccountTracker(Profile* profile) : profile_(profile) { |
service->AddObserver(this); |
service->signin_error_controller()->AddProvider(this); |
SigninManagerFactory::GetForProfile(profile_)->AddObserver(this); |
+ SigninManagerFactory::GetInstance()->AddObserver(this); |
} |
-AccountTracker::~AccountTracker() {} |
+AccountTracker::~AccountTracker() { |
+ SigninManagerFactory::GetInstance()->RemoveObserver(this); |
+} |
void AccountTracker::ReportAuthError(const std::string& account_id, |
const GoogleServiceAuthError& error) { |
@@ -89,6 +91,14 @@ void AccountTracker::GoogleSignedOut(const std::string& username) { |
} |
} |
+void AccountTracker::SigninManagerCreated(SigninManagerBase* manager) { |
+ manager->AddObserver(this); |
+} |
+ |
+void AccountTracker::SigninManagerShutdown(SigninManagerBase* manager) { |
+ manager->RemoveObserver(this); |
+} |
+ |
const std::string AccountTracker::signin_manager_account_id() { |
return SigninManagerFactory::GetForProfile(profile_) |
->GetAuthenticatedAccountId(); |