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

Unified Diff: chrome/browser/signin/signin_account_id_helper.cc

Issue 186773005: Move SigninAccountIdHelper away from listening to Signin notifications (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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
« no previous file with comments | « chrome/browser/signin/signin_account_id_helper.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/signin/signin_account_id_helper.cc
diff --git a/chrome/browser/signin/signin_account_id_helper.cc b/chrome/browser/signin/signin_account_id_helper.cc
index 1443b048fe8cf2dac3a6b385ab91cc5309534b02..6a91339a50395d1a5590b677b5cad699658e3029 100644
--- a/chrome/browser/signin/signin_account_id_helper.cc
+++ b/chrome/browser/signin/signin_account_id_helper.cc
@@ -5,13 +5,10 @@
#include "chrome/browser/signin/signin_account_id_helper.h"
#include "base/prefs/pref_service.h"
-#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/signin/profile_oauth2_token_service.h"
#include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
-#include "chrome/browser/signin/signin_manager.h"
#include "chrome/common/pref_names.h"
-#include "content/public/browser/notification_service.h"
#include "google_apis/gaia/gaia_oauth_client.h"
// TODO(guohui): this class should be moved to a more generic place for reuse.
@@ -107,9 +104,7 @@ void SigninAccountIdHelper::GaiaIdFetcher::OnNetworkError(
SigninAccountIdHelper::SigninAccountIdHelper(SigninManagerBase* signin_manager)
: signin_manager_(signin_manager) {
DCHECK(signin_manager_);
- registrar_.Add(this, chrome::NOTIFICATION_GOOGLE_SIGNED_OUT,
- content::Source<Profile>(signin_manager_->profile()));
-
+ signin_manager_->AddObserver(this);
ProfileOAuth2TokenService* token_service =
ProfileOAuth2TokenServiceFactory::GetForProfile(
signin_manager_->profile());
@@ -123,18 +118,14 @@ SigninAccountIdHelper::SigninAccountIdHelper(SigninManagerBase* signin_manager)
}
SigninAccountIdHelper::~SigninAccountIdHelper() {
+ signin_manager_->RemoveObserver(this);
ProfileOAuth2TokenServiceFactory::GetForProfile(signin_manager_->profile())->
RemoveObserver(this);
}
-void SigninAccountIdHelper::Observe(
- int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) {
- if (type == chrome::NOTIFICATION_GOOGLE_SIGNED_OUT) {
- signin_manager_->profile()->GetPrefs()->
- ClearPref(prefs::kGoogleServicesUserAccountId);
- }
+void SigninAccountIdHelper::GoogleSignedOut(const std::string& username) {
+ signin_manager_->profile()->GetPrefs()->ClearPref(
+ prefs::kGoogleServicesUserAccountId);
}
void SigninAccountIdHelper::OnRefreshTokenAvailable(
« no previous file with comments | « chrome/browser/signin/signin_account_id_helper.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698