| 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 "components/signin/core/browser/account_tracker_service.h" | 5 #include "components/signin/core/browser/account_tracker_service.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
| (...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 return (email.find('@') == std::string::npos) ? email : | 594 return (email.find('@') == std::string::npos) ? email : |
| 595 gaia::CanonicalizeEmail(email); | 595 gaia::CanonicalizeEmail(email); |
| 596 case MIGRATION_DONE: | 596 case MIGRATION_DONE: |
| 597 return gaia; | 597 return gaia; |
| 598 default: | 598 default: |
| 599 NOTREACHED(); | 599 NOTREACHED(); |
| 600 return email; | 600 return email; |
| 601 } | 601 } |
| 602 } | 602 } |
| 603 | 603 |
| 604 void AccountTrackerService::SeedAccountInfo(const std::string& gaia, | 604 std::string AccountTrackerService::SeedAccountInfo(const std::string& gaia, |
| 605 const std::string& email) { | 605 const std::string& email) { |
| 606 DVLOG(1) << "AccountTrackerService::SeedAccountInfo" | |
| 607 << " gaia_id=" << gaia | |
| 608 << " email=" << email; | |
| 609 | |
| 610 DCHECK(!gaia.empty()); | 606 DCHECK(!gaia.empty()); |
| 611 DCHECK(!email.empty()); | 607 DCHECK(!email.empty()); |
| 612 const std::string account_id = PickAccountIdForAccount(gaia, email); | 608 const std::string account_id = PickAccountIdForAccount(gaia, email); |
| 613 const bool already_exists = ContainsKey(accounts_, account_id); | 609 const bool already_exists = ContainsKey(accounts_, account_id); |
| 614 StartTrackingAccount(account_id); | 610 StartTrackingAccount(account_id); |
| 615 AccountState& state = accounts_[account_id]; | 611 AccountState& state = accounts_[account_id]; |
| 616 DCHECK(!already_exists || state.info.gaia == gaia); | 612 DCHECK(!already_exists || state.info.gaia == gaia); |
| 617 state.info.gaia = gaia; | 613 state.info.gaia = gaia; |
| 618 state.info.email = email; | 614 state.info.email = email; |
| 619 SaveToPrefs(state); | 615 SaveToPrefs(state); |
| 616 |
| 617 DVLOG(1) << "AccountTrackerService::SeedAccountInfo" |
| 618 << " account_id=" << account_id |
| 619 << " gaia_id=" << gaia |
| 620 << " email=" << email; |
| 621 |
| 622 return account_id; |
| 620 } | 623 } |
| OLD | NEW |