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

Side by Side Diff: components/signin/core/browser/signin_account_id_helper.cc

Issue 502343002: Add account_id to signin manager notifications. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@isauth
Patch Set: Fix android trybots Created 6 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/signin/core/browser/signin_account_id_helper.h" 5 #include "components/signin/core/browser/signin_account_id_helper.h"
6 6
7 #include "base/prefs/pref_service.h" 7 #include "base/prefs/pref_service.h"
8 #include "components/signin/core/browser/profile_oauth2_token_service.h" 8 #include "components/signin/core/browser/profile_oauth2_token_service.h"
9 #include "components/signin/core/browser/signin_client.h" 9 #include "components/signin/core/browser/signin_client.h"
10 #include "components/signin/core/common/signin_pref_names.h" 10 #include "components/signin/core/common/signin_pref_names.h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 new GaiaIdFetcher(client_, token_service_, signin_manager_, this)); 122 new GaiaIdFetcher(client_, token_service_, signin_manager_, this));
123 } 123 }
124 token_service_->AddObserver(this); 124 token_service_->AddObserver(this);
125 } 125 }
126 126
127 SigninAccountIdHelper::~SigninAccountIdHelper() { 127 SigninAccountIdHelper::~SigninAccountIdHelper() {
128 signin_manager_->RemoveObserver(this); 128 signin_manager_->RemoveObserver(this);
129 token_service_->RemoveObserver(this); 129 token_service_->RemoveObserver(this);
130 } 130 }
131 131
132 void SigninAccountIdHelper::GoogleSignedOut(const std::string& username) { 132 void SigninAccountIdHelper::GoogleSignedOut(const std::string& account_id,
133 const std::string& username) {
133 client_->GetPrefs()->ClearPref(prefs::kGoogleServicesUserAccountId); 134 client_->GetPrefs()->ClearPref(prefs::kGoogleServicesUserAccountId);
134 } 135 }
135 136
136 void SigninAccountIdHelper::OnRefreshTokenAvailable( 137 void SigninAccountIdHelper::OnRefreshTokenAvailable(
137 const std::string& account_id) { 138 const std::string& account_id) {
138 if (account_id == signin_manager_->GetAuthenticatedAccountId()) { 139 if (account_id == signin_manager_->GetAuthenticatedAccountId()) {
139 std::string current_gaia_id = 140 std::string current_gaia_id =
140 client_->GetPrefs()->GetString(prefs::kGoogleServicesUserAccountId); 141 client_->GetPrefs()->GetString(prefs::kGoogleServicesUserAccountId);
141 if (current_gaia_id.empty() && !disable_for_test_) { 142 if (current_gaia_id.empty() && !disable_for_test_) {
142 id_fetcher_.reset( 143 id_fetcher_.reset(
(...skipping 10 matching lines...) Expand all
153 } 154 }
154 } 155 }
155 156
156 // static 157 // static
157 bool SigninAccountIdHelper::disable_for_test_ = false; 158 bool SigninAccountIdHelper::disable_for_test_ = false;
158 159
159 // static 160 // static
160 void SigninAccountIdHelper::SetDisableForTest(bool disable_for_test) { 161 void SigninAccountIdHelper::SetDisableForTest(bool disable_for_test) {
161 disable_for_test_ = disable_for_test; 162 disable_for_test_ = disable_for_test;
162 } 163 }
OLDNEW
« no previous file with comments | « components/signin/core/browser/signin_account_id_helper.h ('k') | components/signin/core/browser/signin_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698