OLD | NEW |
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 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 std::vector<std::pair<std::string, bool> > accounts; | 305 std::vector<std::pair<std::string, bool> > accounts; |
306 gaia::ParseListAccountsData(data, &accounts); | 306 gaia::ParseListAccountsData(data, &accounts); |
307 std::string user_email = gaia::CanonicalizeEmail(GetPrimaryAccountId()); | 307 std::string user_email = gaia::CanonicalizeEmail(GetPrimaryAccountId()); |
308 if (!accounts.empty()) { | 308 if (!accounts.empty()) { |
309 bool found = false; | 309 bool found = false; |
310 bool first = true; | 310 bool first = true; |
311 for (std::vector<std::pair<std::string, bool> >::const_iterator iter = | 311 for (std::vector<std::pair<std::string, bool> >::const_iterator iter = |
312 accounts.begin(); | 312 accounts.begin(); |
313 iter != accounts.end(); ++iter) { | 313 iter != accounts.end(); ++iter) { |
314 if (gaia::CanonicalizeEmail(iter->first) == user_email) { | 314 if (gaia::CanonicalizeEmail(iter->first) == user_email) { |
315 found = true; | 315 found = iter->second; |
316 break; | 316 break; |
317 } | 317 } |
318 | 318 |
319 first = false; | 319 first = false; |
320 } | 320 } |
321 | 321 |
322 if (!found) | 322 if (!found) |
323 outcome = POST_MERGE_MISSING_PRIMARY_ACCOUNT; | 323 outcome = POST_MERGE_MISSING_PRIMARY_ACCOUNT; |
324 else if (!first) | 324 else if (!first) |
325 outcome = POST_MERGE_PRIMARY_NOT_FIRST_ACCOUNT; | 325 outcome = POST_MERGE_PRIMARY_NOT_FIRST_ACCOUNT; |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 FOR_EACH_OBSERVER(Observer, observer_list_, | 403 FOR_EACH_OBSERVER(Observer, observer_list_, |
404 OnSessionRestoreStateChanged(user_profile_, state_)); | 404 OnSessionRestoreStateChanged(user_profile_, state_)); |
405 } | 405 } |
406 | 406 |
407 void OAuth2LoginManager::SetSessionRestoreStartForTesting( | 407 void OAuth2LoginManager::SetSessionRestoreStartForTesting( |
408 const base::Time& time) { | 408 const base::Time& time) { |
409 session_restore_start_ = time; | 409 session_restore_start_ = time; |
410 } | 410 } |
411 | 411 |
412 } // namespace chromeos | 412 } // namespace chromeos |
OLD | NEW |