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

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

Issue 196783002: Export a private webstore API to call into the new inline sign-in flow. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add API tests Created 6 years, 9 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/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();

Powered by Google App Engine
This is Rietveld 408576698