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

Unified Diff: chrome/browser/signin/easy_unlock_service_signin_chromeos.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_signin_chromeos.cc
diff --git a/chrome/browser/signin/easy_unlock_service_signin_chromeos.cc b/chrome/browser/signin/easy_unlock_service_signin_chromeos.cc
index ad3536f856e0c06e985c3d3a5f3ae6af37c9bdf6..2ee6cb89f874739ef32574395adb06e64b6e7c6b 100644
--- a/chrome/browser/signin/easy_unlock_service_signin_chromeos.cc
+++ b/chrome/browser/signin/easy_unlock_service_signin_chromeos.cc
@@ -38,7 +38,7 @@ uint32 GetNextBackoffInterval(uint32 backoff) {
}
void LoadDataForUser(
- const std::string& user_id,
+ const user_manager::UserID& user_id,
uint32 backoff_ms,
const chromeos::EasyUnlockKeyManager::GetDeviceDataListCallback& callback);
@@ -49,7 +49,7 @@ void LoadDataForUser(
// |LoadDataForUser| call with some backoff. If no further retires are allowed,
// it invokes |callback| with the |LoadDataForUser| results.
void RetryDataLoadOnError(
- const std::string& user_id,
+ const user_manager::UserID& user_id,
uint32 backoff_ms,
const chromeos::EasyUnlockKeyManager::GetDeviceDataListCallback& callback,
bool success,
@@ -73,7 +73,7 @@ void RetryDataLoadOnError(
// Loads device data list associated with the user's Easy unlock keys.
void LoadDataForUser(
- const std::string& user_id,
+ const user_manager::UserID& user_id,
uint32 backoff_ms,
const chromeos::EasyUnlockKeyManager::GetDeviceDataListCallback& callback) {
chromeos::EasyUnlockKeyManager* key_manager =
@@ -95,6 +95,7 @@ EasyUnlockServiceSignin::UserData::~UserData() {}
EasyUnlockServiceSignin::EasyUnlockServiceSignin(Profile* profile)
: EasyUnlockService(profile),
+ user_id_(std::string(), std::string()),
allow_cryptohome_backoff_(true),
service_active_(false),
user_pod_last_focused_timestamp_(base::TimeTicks::Now()),
@@ -104,7 +105,7 @@ EasyUnlockServiceSignin::EasyUnlockServiceSignin(Profile* profile)
EasyUnlockServiceSignin::~EasyUnlockServiceSignin() {
}
-void EasyUnlockServiceSignin::SetCurrentUser(const std::string& user_id) {
+void EasyUnlockServiceSignin::SetCurrentUser(const user_manager::UserID& user_id) {
OnFocusedUserChanged(user_id);
}
@@ -112,7 +113,7 @@ EasyUnlockService::Type EasyUnlockServiceSignin::GetType() const {
return EasyUnlockService::TYPE_SIGNIN;
}
-std::string EasyUnlockServiceSignin::GetUserEmail() const {
+user_manager::UserID EasyUnlockServiceSignin::GetUserID() const {
return user_id_;
}
@@ -177,9 +178,9 @@ std::string EasyUnlockServiceSignin::GetWrappedSecret() const {
}
void EasyUnlockServiceSignin::RecordEasySignInOutcome(
- const std::string& user_id,
+ const user_manager::UserID& user_id,
bool success) const {
- DCHECK_EQ(GetUserEmail(), user_id);
+ DCHECK(GetUserID() == user_id);
RecordEasyUnlockSigninEvent(
success ? EASY_UNLOCK_SUCCESS : EASY_UNLOCK_FAILURE);
@@ -191,10 +192,10 @@ void EasyUnlockServiceSignin::RecordEasySignInOutcome(
}
void EasyUnlockServiceSignin::RecordPasswordLoginEvent(
- const std::string& user_id) const {
+ const user_manager::UserID& user_id) const {
// This happens during tests, where a user could log in without the user pod
// being focused.
- if (GetUserEmail() != user_id)
+ if (GetUserID() != user_id)
return;
if (!IsEnabled())
@@ -284,7 +285,7 @@ void EasyUnlockServiceSignin::OnScreenDidUnlock(
Shutdown();
}
-void EasyUnlockServiceSignin::OnFocusedUserChanged(const std::string& user_id) {
+void EasyUnlockServiceSignin::OnFocusedUserChanged(const user_manager::UserID& user_id) {
if (user_id_ == user_id)
return;
@@ -330,7 +331,7 @@ void EasyUnlockServiceSignin::LoadCurrentUserDataIfNeeded() {
if (user_id_.empty() || !service_active_)
return;
- std::map<std::string, UserData*>::iterator it = user_data_.find(user_id_);
+ std::map<user_manager::UserID, UserData*>::iterator it = user_data_.find(user_id_);
if (it == user_data_.end())
user_data_.insert(std::make_pair(user_id_, new UserData()));
@@ -349,7 +350,7 @@ void EasyUnlockServiceSignin::LoadCurrentUserDataIfNeeded() {
}
void EasyUnlockServiceSignin::OnUserDataLoaded(
- const std::string& user_id,
+ const user_manager::UserID& user_id,
bool success,
const chromeos::EasyUnlockDeviceKeyDataList& devices) {
allow_cryptohome_backoff_ = false;
@@ -385,7 +386,7 @@ const EasyUnlockServiceSignin::UserData*
if (user_id_.empty())
return NULL;
- std::map<std::string, UserData*>::const_iterator it =
+ std::map<user_manager::UserID, UserData*>::const_iterator it =
user_data_.find(user_id_);
if (it == user_data_.end())
return NULL;

Powered by Google App Engine
This is Rietveld 408576698