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

Unified Diff: chrome/browser/profiles/profile_impl.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/profiles/profile_impl.cc
diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc
index 6eb96e9124b0403f2162ae6a12ebe790e1d9cee6..c6c8c6ed6659e33402ec48756fb45d4fa5c99f88 100644
--- a/chrome/browser/profiles/profile_impl.cc
+++ b/chrome/browser/profiles/profile_impl.cc
@@ -777,8 +777,8 @@ bool ProfileImpl::IsSupervised() {
bool ProfileImpl::IsChild() {
#if defined(ENABLE_SUPERVISED_USERS)
- return GetPrefs()->GetString(prefs::kSupervisedUserId) ==
- supervised_users::kChildAccountSUID;
+ return user_manager::UserID::FromUserEmail(GetPrefs()->GetString(prefs::kSupervisedUserId)) ==
+ supervised_users::GetChildAccountSUID();
#else
return false;
#endif
@@ -1159,8 +1159,8 @@ void ProfileImpl::ChangeAppLocale(
if (via != APP_LOCALE_CHANGED_VIA_PUBLIC_SESSION_LOGIN)
local_state->SetString(prefs::kApplicationLocale, new_locale);
- if (user_manager::UserManager::Get()->GetOwnerEmail() ==
- chromeos::ProfileHelper::Get()->GetUserByProfile(this)->email())
+ if (user_manager::UserManager::Get()->GetOwnerID() ==
+ chromeos::ProfileHelper::Get()->GetUserByProfile(this)->GetUserID())
local_state->SetString(prefs::kOwnerLocale, new_locale);
}
@@ -1231,8 +1231,8 @@ void ProfileImpl::UpdateProfileSupervisedUserIdCache() {
ProfileInfoCache& cache = profile_manager->GetProfileInfoCache();
size_t index = cache.GetIndexOfProfileWithPath(GetPath());
if (index != std::string::npos) {
- std::string supervised_user_id =
- GetPrefs()->GetString(prefs::kSupervisedUserId);
+ const user_manager::UserID supervised_user_id(
+ user_manager::UserID::FromUserEmail(GetPrefs()->GetString(prefs::kSupervisedUserId)));
cache.SetSupervisedUserIdOfProfileAtIndex(index, supervised_user_id);
ProfileMetrics::UpdateReportedProfilesStatistics(profile_manager);
}

Powered by Google App Engine
This is Rietveld 408576698