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

Side by Side Diff: chrome/browser/chromeos/login/signin/oauth2_login_verifier.cc

Issue 1162103003: ListAccounts will return the Gaia ID as well as the email of the account. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 6 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 "chrome/browser/chromeos/login/signin/oauth2_login_verifier.h" 5 #include "chrome/browser/chromeos/login/signin/oauth2_login_verifier.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "content/public/browser/browser_thread.h" 10 #include "content/public/browser/browser_thread.h"
(...skipping 15 matching lines...) Expand all
26 cookie_manager_service_->AddObserver(this); 26 cookie_manager_service_->AddObserver(this);
27 } 27 }
28 28
29 OAuth2LoginVerifier::~OAuth2LoginVerifier() { 29 OAuth2LoginVerifier::~OAuth2LoginVerifier() {
30 cookie_manager_service_->RemoveObserver(this); 30 cookie_manager_service_->RemoveObserver(this);
31 } 31 }
32 32
33 void OAuth2LoginVerifier::VerifyUserCookies(Profile* profile) { 33 void OAuth2LoginVerifier::VerifyUserCookies(Profile* profile) {
34 DCHECK_CURRENTLY_ON(BrowserThread::UI); 34 DCHECK_CURRENTLY_ON(BrowserThread::UI);
35 35
36 std::vector<std::pair<std::string, bool> > accounts; 36 std::vector<gaia::ListedAccount> accounts;
37 if (cookie_manager_service_->ListAccounts(&accounts)) { 37 if (cookie_manager_service_->ListAccounts(&accounts)) {
38 OnGaiaAccountsInCookieUpdated( 38 OnGaiaAccountsInCookieUpdated(
39 accounts, GoogleServiceAuthError(GoogleServiceAuthError::NONE)); 39 accounts, GoogleServiceAuthError(GoogleServiceAuthError::NONE));
40 } 40 }
41 } 41 }
42 42
43 void OAuth2LoginVerifier::VerifyProfileTokens(Profile* profile) { 43 void OAuth2LoginVerifier::VerifyProfileTokens(Profile* profile) {
44 DCHECK_CURRENTLY_ON(BrowserThread::UI); 44 DCHECK_CURRENTLY_ON(BrowserThread::UI);
45 if (access_token_.empty()) { 45 if (access_token_.empty()) {
46 cookie_manager_service_->AddAccountToCookie(primary_account_id_); 46 cookie_manager_service_->AddAccountToCookie(primary_account_id_);
(...skipping 14 matching lines...) Expand all
61 delegate_->OnSessionMergeSuccess(); 61 delegate_->OnSessionMergeSuccess();
62 return; 62 return;
63 } 63 }
64 64
65 LOG(WARNING) << "Failed MergeSession request," 65 LOG(WARNING) << "Failed MergeSession request,"
66 << " error: " << error.state(); 66 << " error: " << error.state();
67 delegate_->OnSessionMergeFailure(error.IsTransientError()); 67 delegate_->OnSessionMergeFailure(error.IsTransientError());
68 } 68 }
69 69
70 void OAuth2LoginVerifier::OnGaiaAccountsInCookieUpdated( 70 void OAuth2LoginVerifier::OnGaiaAccountsInCookieUpdated(
71 const std::vector<std::pair<std::string, bool> >& accounts, 71 const std::vector<gaia::ListedAccount>& accounts,
72 const GoogleServiceAuthError& error) { 72 const GoogleServiceAuthError& error) {
73 if (error.state() == GoogleServiceAuthError::State::NONE) { 73 if (error.state() == GoogleServiceAuthError::State::NONE) {
74 VLOG(1) << "ListAccounts successful."; 74 VLOG(1) << "ListAccounts successful.";
75 delegate_->OnListAccountsSuccess(accounts); 75 delegate_->OnListAccountsSuccess(accounts);
76 return; 76 return;
77 } 77 }
78 78
79 LOG(WARNING) << "Failed to get list of session accounts, " 79 LOG(WARNING) << "Failed to get list of session accounts, "
80 << " error: " << error.state(); 80 << " error: " << error.state();
81 delegate_->OnListAccountsFailure(error.IsTransientError()); 81 delegate_->OnListAccountsFailure(error.IsTransientError());
82 } 82 }
83 83
84 } // namespace chromeos 84 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698