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 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 return (email.find('@') == std::string::npos) ? email : | 577 return (email.find('@') == std::string::npos) ? email : |
578 gaia::CanonicalizeEmail(email); | 578 gaia::CanonicalizeEmail(email); |
579 case MIGRATION_DONE: | 579 case MIGRATION_DONE: |
580 return gaia; | 580 return gaia; |
581 default: | 581 default: |
582 NOTREACHED(); | 582 NOTREACHED(); |
583 return email; | 583 return email; |
584 } | 584 } |
585 } | 585 } |
586 | 586 |
587 void AccountTrackerService::SeedAccountInfo(const std::string& gaia, | 587 std::string AccountTrackerService::SeedAccountInfo(const std::string& gaia, |
588 const std::string& email) { | 588 const std::string& email) { |
589 DVLOG(1) << "AccountTrackerService::SeedAccountInfo" | |
590 << " gaia_id=" << gaia | |
591 << " email=" << email; | |
592 | |
593 DCHECK(!gaia.empty()); | 589 DCHECK(!gaia.empty()); |
594 DCHECK(!email.empty()); | 590 DCHECK(!email.empty()); |
595 const std::string account_id = PickAccountIdForAccount(gaia, email); | 591 const std::string account_id = PickAccountIdForAccount(gaia, email); |
596 const bool already_exists = ContainsKey(accounts_, account_id); | 592 const bool already_exists = ContainsKey(accounts_, account_id); |
597 StartTrackingAccount(account_id); | 593 StartTrackingAccount(account_id); |
598 AccountState& state = accounts_[account_id]; | 594 AccountState& state = accounts_[account_id]; |
599 DCHECK(!already_exists || state.info.gaia == gaia); | 595 DCHECK(!already_exists || state.info.gaia == gaia); |
600 state.info.gaia = gaia; | 596 state.info.gaia = gaia; |
601 state.info.email = email; | 597 state.info.email = email; |
602 SaveToPrefs(state); | 598 SaveToPrefs(state); |
| 599 |
| 600 DVLOG(1) << "AccountTrackerService::SeedAccountInfo" |
| 601 << " account_id=" << account_id |
| 602 << " gaia_id=" << gaia |
| 603 << " email=" << email; |
| 604 |
| 605 return account_id; |
603 } | 606 } |
OLD | NEW |