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

Side by Side Diff: chrome/browser/chromeos/login/signin/oauth2_login_manager.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_manager.h" 5 #include "chrome/browser/chromeos/login/signin/oauth2_login_manager.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 void OAuth2LoginManager::OnSessionMergeFailure(bool connection_error) { 300 void OAuth2LoginManager::OnSessionMergeFailure(bool connection_error) {
301 LOG(ERROR) << "OAuth2 refresh and GAIA token verification failed!" 301 LOG(ERROR) << "OAuth2 refresh and GAIA token verification failed!"
302 << " connection_error: " << connection_error; 302 << " connection_error: " << connection_error;
303 RecordSessionRestoreOutcome(SESSION_RESTORE_MERGE_SESSION_FAILED, 303 RecordSessionRestoreOutcome(SESSION_RESTORE_MERGE_SESSION_FAILED,
304 connection_error ? 304 connection_error ?
305 SESSION_RESTORE_CONNECTION_FAILED : 305 SESSION_RESTORE_CONNECTION_FAILED :
306 SESSION_RESTORE_FAILED); 306 SESSION_RESTORE_FAILED);
307 } 307 }
308 308
309 void OAuth2LoginManager::OnListAccountsSuccess( 309 void OAuth2LoginManager::OnListAccountsSuccess(
310 const std::vector<std::pair<std::string, bool>>& accounts) { 310 const std::vector<gaia::ListedAccount>& accounts) {
311 MergeVerificationOutcome outcome = POST_MERGE_SUCCESS; 311 MergeVerificationOutcome outcome = POST_MERGE_SUCCESS;
312 // Let's analyze which accounts we see logged in here: 312 // Let's analyze which accounts we see logged in here:
313 std::string user_email = gaia::CanonicalizeEmail(GetPrimaryAccountId()); 313 std::string user_email = gaia::CanonicalizeEmail(GetPrimaryAccountId());
314 if (!accounts.empty()) { 314 if (!accounts.empty()) {
315 bool found = false; 315 bool found = false;
316 bool first = true; 316 bool first = true;
317 for (std::vector<std::pair<std::string, bool> >::const_iterator iter = 317 for (std::vector<gaia::ListedAccount>::const_iterator iter =
318 accounts.begin(); 318 accounts.begin();
319 iter != accounts.end(); ++iter) { 319 iter != accounts.end(); ++iter) {
320 if (gaia::CanonicalizeEmail(iter->first) == user_email) { 320 if (iter->email == user_email) {
321 found = iter->second; 321 found = iter->valid;
322 break; 322 break;
323 } 323 }
324 324
325 first = false; 325 first = false;
326 } 326 }
327 327
328 if (!found) 328 if (!found)
329 outcome = POST_MERGE_MISSING_PRIMARY_ACCOUNT; 329 outcome = POST_MERGE_MISSING_PRIMARY_ACCOUNT;
330 else if (!first) 330 else if (!first)
331 outcome = POST_MERGE_PRIMARY_NOT_FIRST_ACCOUNT; 331 outcome = POST_MERGE_PRIMARY_NOT_FIRST_ACCOUNT;
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 FOR_EACH_OBSERVER(Observer, observer_list_, 409 FOR_EACH_OBSERVER(Observer, observer_list_,
410 OnSessionRestoreStateChanged(user_profile_, state_)); 410 OnSessionRestoreStateChanged(user_profile_, state_));
411 } 411 }
412 412
413 void OAuth2LoginManager::SetSessionRestoreStartForTesting( 413 void OAuth2LoginManager::SetSessionRestoreStartForTesting(
414 const base::Time& time) { 414 const base::Time& time) {
415 session_restore_start_ = time; 415 session_restore_start_ = time;
416 } 416 }
417 417
418 } // namespace chromeos 418 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698