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

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

Issue 479353003: Add IsAuthenticated() method to SigninManager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comments 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 | Annotate | Revision Log
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/account_reconcilor.h" 5 #include "components/signin/core/browser/account_reconcilor.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 305
306 void AccountReconcilor::UnregisterWithTokenService() { 306 void AccountReconcilor::UnregisterWithTokenService() {
307 if (!registered_with_token_service_) 307 if (!registered_with_token_service_)
308 return; 308 return;
309 309
310 token_service_->RemoveObserver(this); 310 token_service_->RemoveObserver(this);
311 registered_with_token_service_ = false; 311 registered_with_token_service_ = false;
312 } 312 }
313 313
314 bool AccountReconcilor::IsProfileConnected() { 314 bool AccountReconcilor::IsProfileConnected() {
315 return !signin_manager_->GetAuthenticatedUsername().empty(); 315 return signin_manager_->IsAuthenticated();
316 } 316 }
317 317
318 void AccountReconcilor::OnCookieChanged(const net::CanonicalCookie* cookie) { 318 void AccountReconcilor::OnCookieChanged(const net::CanonicalCookie* cookie) {
319 if (cookie->Name() == "LSID" && 319 if (cookie->Name() == "LSID" &&
320 cookie->Domain() == GaiaUrls::GetInstance()->gaia_url().host() && 320 cookie->Domain() == GaiaUrls::GetInstance()->gaia_url().host() &&
321 cookie->IsSecure() && cookie->IsHttpOnly()) { 321 cookie->IsSecure() && cookie->IsHttpOnly()) {
322 VLOG(1) << "AccountReconcilor::OnCookieChanged: LSID changed"; 322 VLOG(1) << "AccountReconcilor::OnCookieChanged: LSID changed";
323 323
324 // It is possible that O2RT is not available at this moment. 324 // It is possible that O2RT is not available at this moment.
325 if (!token_service_->GetAccounts().size()) { 325 if (!token_service_->GetAccounts().size()) {
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 if (error.state() == GoogleServiceAuthError::NONE) { 524 if (error.state() == GoogleServiceAuthError::NONE) {
525 gaia_accounts_ = accounts; 525 gaia_accounts_ = accounts;
526 are_gaia_accounts_set_ = true; 526 are_gaia_accounts_set_ = true;
527 FinishReconcile(); 527 FinishReconcile();
528 } else { 528 } else {
529 AbortReconcile(); 529 AbortReconcile();
530 } 530 }
531 } 531 }
532 532
533 void AccountReconcilor::ValidateAccountsFromTokenService() { 533 void AccountReconcilor::ValidateAccountsFromTokenService() {
534 primary_account_ = signin_manager_->GetAuthenticatedUsername(); 534 primary_account_ = signin_manager_->GetAuthenticatedAccountId();
535 DCHECK(!primary_account_.empty()); 535 DCHECK(!primary_account_.empty());
536 536
537 chrome_accounts_ = token_service_->GetAccounts(); 537 chrome_accounts_ = token_service_->GetAccounts();
538 538
539 VLOG(1) << "AccountReconcilor::ValidateAccountsFromTokenService: " 539 VLOG(1) << "AccountReconcilor::ValidateAccountsFromTokenService: "
540 << "Chrome " << chrome_accounts_.size() << " accounts, " 540 << "Chrome " << chrome_accounts_.size() << " accounts, "
541 << "Primary is '" << primary_account_ << "'"; 541 << "Primary is '" << primary_account_ << "'";
542 542
543 DCHECK(!requests_); 543 DCHECK(!requests_);
544 requests_ = 544 requests_ =
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 797
798 void AccountReconcilor::HandleRefreshTokenFetched( 798 void AccountReconcilor::HandleRefreshTokenFetched(
799 const std::string& account_id, 799 const std::string& account_id,
800 const std::string& refresh_token) { 800 const std::string& refresh_token) {
801 if (!refresh_token.empty()) 801 if (!refresh_token.empty())
802 PerformAddAccountToTokenService(account_id, refresh_token); 802 PerformAddAccountToTokenService(account_id, refresh_token);
803 803
804 MarkAccountAsAddedToChrome(account_id); 804 MarkAccountAsAddedToChrome(account_id);
805 CalculateIfReconcileIsDone(); 805 CalculateIfReconcileIsDone();
806 } 806 }
OLDNEW
« no previous file with comments | « components/signin/core/browser/about_signin_internals.cc ('k') | components/signin/core/browser/signin_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698