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

Unified Diff: chrome/browser/signin/easy_unlock_service_regular.cc

Issue 1165323004: We should use UserID object to identify users instead of username. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/signin/easy_unlock_service_regular.cc
diff --git a/chrome/browser/signin/easy_unlock_service_regular.cc b/chrome/browser/signin/easy_unlock_service_regular.cc
index b02d769c63fb10c99a77e4721da353a8eb14942d..8e7ab3652e13b29a081f095c15ac26a9e9e9ec71 100644
--- a/chrome/browser/signin/easy_unlock_service_regular.cc
+++ b/chrome/browser/signin/easy_unlock_service_regular.cc
@@ -93,14 +93,8 @@ EasyUnlockService::Type EasyUnlockServiceRegular::GetType() const {
return EasyUnlockService::TYPE_REGULAR;
}
-std::string EasyUnlockServiceRegular::GetUserEmail() const {
- const SigninManagerBase* signin_manager =
- SigninManagerFactory::GetForProfileIfExists(profile());
- // |profile| has to be a signed-in profile with SigninManager already
- // created. Otherwise, just crash to collect stack.
- DCHECK(signin_manager);
- const std::string user_email = signin_manager->GetAuthenticatedUsername();
- return user_email.empty() ? user_email : gaia::CanonicalizeEmail(user_email);
+user_manager::UserID EasyUnlockServiceRegular::GetUserID() const {
+ return user_manager::UserID::FromUserEmail(GetUserEmail());
}
void EasyUnlockServiceRegular::LaunchSetup() {
@@ -151,7 +145,7 @@ void EasyUnlockServiceRegular::SetHardlockAfterKeyOperation(
EasyUnlockScreenlockStateHandler::HardlockState state_on_success,
bool success) {
if (success)
- SetHardlockStateForUser(GetUserEmail(), state_on_success);
+ SetHardlockStateForUser(GetUserID(), state_on_success);
// Even if the refresh keys operation suceeded, we still fetch and check the
// cryptohome keys against the keys in local preferences as a sanity check.
@@ -267,13 +261,13 @@ std::string EasyUnlockServiceRegular::GetWrappedSecret() const {
}
void EasyUnlockServiceRegular::RecordEasySignInOutcome(
- const std::string& user_id,
+ const user_manager::UserID& user_id,
bool success) const {
NOTREACHED();
}
void EasyUnlockServiceRegular::RecordPasswordLoginEvent(
- const std::string& user_id) const {
+ const user_manager::UserID& user_id) const {
NOTREACHED();
}
@@ -392,10 +386,20 @@ void EasyUnlockServiceRegular::OnScreenDidUnlock(
}
void EasyUnlockServiceRegular::OnFocusedUserChanged(
- const std::string& user_id) {
+ const user_manager::UserID& user_id) {
// Nothing to do.
}
+std::string EasyUnlockServiceRegular::GetUserEmail() const {
+ const SigninManagerBase* signin_manager =
+ SigninManagerFactory::GetForProfileIfExists(profile());
+ // |profile| has to be a signed-in profile with SigninManager already
+ // created. Otherwise, just crash to collect stack.
+ DCHECK(signin_manager);
+ const std::string user_email = signin_manager->GetAuthenticatedUsername();
+ return user_email.empty() ? user_email : gaia::CanonicalizeEmail(user_email);
+}
+
void EasyUnlockServiceRegular::OnPrefsChanged() {
SyncProfilePrefsToLocalState();
UpdateAppState();

Powered by Google App Engine
This is Rietveld 408576698