Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/oauth2_login_manager.h" | 5 #include "chrome/browser/chromeos/login/oauth2_login_manager.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 285 << " connection_error: " << connection_error; | 285 << " connection_error: " << connection_error; |
| 286 RecordSessionRestoreOutcome(SESSION_RESTORE_MERGE_SESSION_FAILED, | 286 RecordSessionRestoreOutcome(SESSION_RESTORE_MERGE_SESSION_FAILED, |
| 287 connection_error ? | 287 connection_error ? |
| 288 SESSION_RESTORE_CONNECTION_FAILED : | 288 SESSION_RESTORE_CONNECTION_FAILED : |
| 289 SESSION_RESTORE_FAILED); | 289 SESSION_RESTORE_FAILED); |
| 290 } | 290 } |
| 291 | 291 |
| 292 void OAuth2LoginManager::OnListAccountsSuccess(const std::string& data) { | 292 void OAuth2LoginManager::OnListAccountsSuccess(const std::string& data) { |
| 293 MergeVerificationOutcome outcome = POST_MERGE_SUCCESS; | 293 MergeVerificationOutcome outcome = POST_MERGE_SUCCESS; |
| 294 // Let's analyze which accounts we see logged in here: | 294 // Let's analyze which accounts we see logged in here: |
| 295 std::vector<std::string> accounts; | 295 std::vector<std::pair<std::string, bool> > accounts; |
|
bartfab (slow)
2014/02/17 15:22:04
Nit: #include <utility>
Roger Tawa OOO till Jul 10th
2014/02/18 19:37:54
Done.
| |
| 296 gaia::ParseListAccountsData(data, &accounts); | 296 gaia::ParseListAccountsData(data, &accounts); |
| 297 std::string user_email = gaia::CanonicalizeEmail(GetPrimaryAccountId()); | 297 std::string user_email = gaia::CanonicalizeEmail(GetPrimaryAccountId()); |
| 298 if (!accounts.empty()) { | 298 if (!accounts.empty()) { |
| 299 bool found = false; | 299 bool found = false; |
| 300 bool first = true; | 300 bool first = true; |
| 301 for (std::vector<std::string>::const_iterator iter = accounts.begin(); | 301 for (std::vector<std::pair<std::string, bool> >::const_iterator iter = |
| 302 accounts.begin(); | |
| 302 iter != accounts.end(); ++iter) { | 303 iter != accounts.end(); ++iter) { |
| 303 if (gaia::CanonicalizeEmail(*iter) == user_email) { | 304 if (gaia::CanonicalizeEmail(iter->first) == user_email) { |
| 304 found = true; | 305 found = true; |
| 305 break; | 306 break; |
| 306 } | 307 } |
| 307 | 308 |
| 308 first = false; | 309 first = false; |
| 309 } | 310 } |
| 310 | 311 |
| 311 if (!found) | 312 if (!found) |
| 312 outcome = POST_MERGE_MISSING_PRIMARY_ACCOUNT; | 313 outcome = POST_MERGE_MISSING_PRIMARY_ACCOUNT; |
| 313 else if (!first) | 314 else if (!first) |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 392 FOR_EACH_OBSERVER(Observer, observer_list_, | 393 FOR_EACH_OBSERVER(Observer, observer_list_, |
| 393 OnSessionRestoreStateChanged(user_profile_, state_)); | 394 OnSessionRestoreStateChanged(user_profile_, state_)); |
| 394 } | 395 } |
| 395 | 396 |
| 396 void OAuth2LoginManager::SetSessionRestoreStartForTesting( | 397 void OAuth2LoginManager::SetSessionRestoreStartForTesting( |
| 397 const base::Time& time) { | 398 const base::Time& time) { |
| 398 session_restore_start_ = time; | 399 session_restore_start_ = time; |
| 399 } | 400 } |
| 400 | 401 |
| 401 } // namespace chromeos | 402 } // namespace chromeos |
| OLD | NEW |