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

Side by Side Diff: components/signin/core/browser/account_tracker_service.cc

Issue 964563002: Replace SetAuthenticatedUsername with SetAuthenticatedAccountId. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@priv
Patch Set: rebased Created 5 years, 8 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 "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
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;
Mike Lerman 2015/04/08 14:45:27 Thought: Is it worth setting a class variable in t
Roger Tawa OOO till Jul 10th 2015/04/08 20:24:21 I don't think it's worth it. SeedAccountInfo is c
603 } 606 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698