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

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

Issue 643183003: Adding instrumentation to locate the source of jankiness (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 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 "base/profiler/scoped_profile.h"
8 #include "components/signin/core/browser/profile_oauth2_token_service.h" 9 #include "components/signin/core/browser/profile_oauth2_token_service.h"
9 #include "components/signin/core/browser/signin_client.h" 10 #include "components/signin/core/browser/signin_client.h"
10 #include "components/signin/core/common/signin_pref_names.h" 11 #include "components/signin/core/common/signin_pref_names.h"
11 #include "google_apis/gaia/gaia_oauth_client.h" 12 #include "google_apis/gaia/gaia_oauth_client.h"
12 13
13 // TODO(guohui): this class should be moved to a more generic place for reuse. 14 // TODO(guohui): this class should be moved to a more generic place for reuse.
14 class SigninAccountIdHelper::GaiaIdFetcher 15 class SigninAccountIdHelper::GaiaIdFetcher
15 : public OAuth2TokenService::Consumer, 16 : public OAuth2TokenService::Consumer,
16 public gaia::GaiaOAuthClient::Delegate { 17 public gaia::GaiaOAuthClient::Delegate {
17 public: 18 public:
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 token_service_->RemoveObserver(this); 130 token_service_->RemoveObserver(this);
130 } 131 }
131 132
132 void SigninAccountIdHelper::GoogleSignedOut(const std::string& account_id, 133 void SigninAccountIdHelper::GoogleSignedOut(const std::string& account_id,
133 const std::string& username) { 134 const std::string& username) {
134 client_->GetPrefs()->ClearPref(prefs::kGoogleServicesUserAccountId); 135 client_->GetPrefs()->ClearPref(prefs::kGoogleServicesUserAccountId);
135 } 136 }
136 137
137 void SigninAccountIdHelper::OnRefreshTokenAvailable( 138 void SigninAccountIdHelper::OnRefreshTokenAvailable(
138 const std::string& account_id) { 139 const std::string& account_id) {
140 // TODO(vadimt): Remove ScopedProfile below once crbug.com/422460 is fixed.
141 tracked_objects::ScopedProfile tracking_profile(
142 FROM_HERE_WITH_EXPLICIT_FUNCTION(
143 "422460 SigninAccountIdHelper::OnRefreshTokenAvailable"));
144
139 if (account_id == signin_manager_->GetAuthenticatedAccountId()) { 145 if (account_id == signin_manager_->GetAuthenticatedAccountId()) {
140 std::string current_gaia_id = 146 std::string current_gaia_id =
141 client_->GetPrefs()->GetString(prefs::kGoogleServicesUserAccountId); 147 client_->GetPrefs()->GetString(prefs::kGoogleServicesUserAccountId);
142 if (current_gaia_id.empty() && !disable_for_test_) { 148 if (current_gaia_id.empty() && !disable_for_test_) {
143 id_fetcher_.reset( 149 id_fetcher_.reset(
144 new GaiaIdFetcher(client_, token_service_, signin_manager_, this)); 150 new GaiaIdFetcher(client_, token_service_, signin_manager_, this));
145 } 151 }
146 } 152 }
147 } 153 }
148 154
149 void SigninAccountIdHelper::OnPrimaryAccountIdFetched( 155 void SigninAccountIdHelper::OnPrimaryAccountIdFetched(
150 const std::string& gaia_id) { 156 const std::string& gaia_id) {
151 if (!gaia_id.empty()) { 157 if (!gaia_id.empty()) {
152 client_->GetPrefs()->SetString(prefs::kGoogleServicesUserAccountId, 158 client_->GetPrefs()->SetString(prefs::kGoogleServicesUserAccountId,
153 gaia_id); 159 gaia_id);
154 } 160 }
155 } 161 }
156 162
157 // static 163 // static
158 bool SigninAccountIdHelper::disable_for_test_ = false; 164 bool SigninAccountIdHelper::disable_for_test_ = false;
159 165
160 // static 166 // static
161 void SigninAccountIdHelper::SetDisableForTest(bool disable_for_test) { 167 void SigninAccountIdHelper::SetDisableForTest(bool disable_for_test) {
162 disable_for_test_ = disable_for_test; 168 disable_for_test_ = disable_for_test;
163 } 169 }
OLDNEW
« no previous file with comments | « components/signin/core/browser/account_tracker_service.cc ('k') | google_apis/gaia/account_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698