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

Unified Diff: chrome/browser/chromeos/login/users/chrome_user_manager_impl.cc

Issue 1497973002: This CL replaces e-mail with AccountId in wallpaper manager code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update after review. Created 5 years 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/chromeos/login/users/chrome_user_manager_impl.cc
diff --git a/chrome/browser/chromeos/login/users/chrome_user_manager_impl.cc b/chrome/browser/chromeos/login/users/chrome_user_manager_impl.cc
index fd4df223203ab9d84fb3d3127f586c1d46565b7a..426a0530ef659e99443ce3fe3a3bcdf25881dd97 100644
--- a/chrome/browser/chromeos/login/users/chrome_user_manager_impl.cc
+++ b/chrome/browser/chromeos/login/users/chrome_user_manager_impl.cc
@@ -438,22 +438,26 @@ void ChromeUserManagerImpl::Observe(
void ChromeUserManagerImpl::OnExternalDataSet(const std::string& policy,
const std::string& user_id) {
+ const AccountId account_id =
+ user_manager::UserManager::Get()->GetKnownUserAccountId(user_id,
+ std::string());
if (policy == policy::key::kUserAvatarImage)
- GetUserImageManager(AccountId::FromUserEmail(user_id))
- ->OnExternalDataSet(policy);
+ GetUserImageManager(account_id)->OnExternalDataSet(policy);
else if (policy == policy::key::kWallpaperImage)
- WallpaperManager::Get()->OnPolicySet(policy, user_id);
+ WallpaperManager::Get()->OnPolicySet(policy, account_id);
else
NOTREACHED();
}
void ChromeUserManagerImpl::OnExternalDataCleared(const std::string& policy,
const std::string& user_id) {
+ const AccountId account_id =
+ user_manager::UserManager::Get()->GetKnownUserAccountId(user_id,
+ std::string());
if (policy == policy::key::kUserAvatarImage)
- GetUserImageManager(AccountId::FromUserEmail(user_id))
- ->OnExternalDataCleared(policy);
+ GetUserImageManager(account_id)->OnExternalDataCleared(policy);
else if (policy == policy::key::kWallpaperImage)
- WallpaperManager::Get()->OnPolicyCleared(policy, user_id);
+ WallpaperManager::Get()->OnPolicyCleared(policy, account_id);
else
NOTREACHED();
}
@@ -462,17 +466,22 @@ void ChromeUserManagerImpl::OnExternalDataFetched(
const std::string& policy,
const std::string& user_id,
scoped_ptr<std::string> data) {
+ const AccountId account_id =
+ user_manager::UserManager::Get()->GetKnownUserAccountId(user_id,
+ std::string());
if (policy == policy::key::kUserAvatarImage)
- GetUserImageManager(AccountId::FromUserEmail(user_id))
- ->OnExternalDataFetched(policy, data.Pass());
+ GetUserImageManager(account_id)->OnExternalDataFetched(policy, data.Pass());
else if (policy == policy::key::kWallpaperImage)
- WallpaperManager::Get()->OnPolicyFetched(policy, user_id, data.Pass());
+ WallpaperManager::Get()->OnPolicyFetched(policy, account_id, data.Pass());
else
NOTREACHED();
}
void ChromeUserManagerImpl::OnPolicyUpdated(const std::string& user_id) {
- const user_manager::User* user = FindUser(AccountId::FromUserEmail(user_id));
+ const AccountId account_id =
+ user_manager::UserManager::Get()->GetKnownUserAccountId(user_id,
+ std::string());
+ const user_manager::User* user = FindUser(account_id);
if (!user || user->GetType() != user_manager::USER_TYPE_PUBLIC_ACCOUNT)
return;
UpdatePublicAccountDisplayName(user_id);
@@ -658,8 +667,7 @@ void ChromeUserManagerImpl::GuestUserLoggedIn() {
false);
// Initializes wallpaper after active_user_ is set.
- WallpaperManager::Get()->SetUserWallpaperNow(
- login::GuestAccountId().GetUserEmail());
+ WallpaperManager::Get()->SetUserWallpaperNow(login::GuestAccountId());
}
void ChromeUserManagerImpl::RegularUserLoggedIn(const AccountId& account_id) {
@@ -674,7 +682,7 @@ void ChromeUserManagerImpl::RegularUserLoggedIn(const AccountId& account_id) {
}
if (IsCurrentUserNew())
- WallpaperManager::Get()->SetUserWallpaperNow(account_id.GetUserEmail());
+ WallpaperManager::Get()->SetUserWallpaperNow(account_id);
GetUserImageManager(account_id)->UserLoggedIn(IsCurrentUserNew(), false);
@@ -690,7 +698,7 @@ void ChromeUserManagerImpl::RegularUserLoggedInAsEphemeral(
ChromeUserManager::RegularUserLoggedInAsEphemeral(account_id);
GetUserImageManager(account_id)->UserLoggedIn(IsCurrentUserNew(), false);
- WallpaperManager::Get()->SetUserWallpaperNow(account_id.GetUserEmail());
+ WallpaperManager::Get()->SetUserWallpaperNow(account_id);
}
void ChromeUserManagerImpl::SupervisedUserLoggedIn(
@@ -705,11 +713,11 @@ void ChromeUserManagerImpl::SupervisedUserLoggedIn(
SetIsCurrentUserNew(true);
active_user_ = user_manager::User::CreateSupervisedUser(account_id);
// Leaving OAuth token status at the default state = unknown.
- WallpaperManager::Get()->SetUserWallpaperNow(account_id.GetUserEmail());
+ WallpaperManager::Get()->SetUserWallpaperNow(account_id);
} else {
if (supervised_user_manager_->CheckForFirstRun(account_id.GetUserEmail())) {
SetIsCurrentUserNew(true);
- WallpaperManager::Get()->SetUserWallpaperNow(account_id.GetUserEmail());
+ WallpaperManager::Get()->SetUserWallpaperNow(account_id);
} else {
SetIsCurrentUserNew(false);
}
@@ -768,8 +776,7 @@ void ChromeUserManagerImpl::KioskAppLoggedIn(
user_manager::User::USER_IMAGE_INVALID,
false);
- WallpaperManager::Get()->SetUserWallpaperNow(
- kiosk_app_account_id.GetUserEmail());
+ WallpaperManager::Get()->SetUserWallpaperNow(kiosk_app_account_id);
// TODO(bartfab): Add KioskAppUsers to the users_ list and keep metadata like
// the kiosk_app_id in these objects, removing the need to re-parse the
@@ -813,8 +820,7 @@ void ChromeUserManagerImpl::DemoAccountLoggedIn() {
IDR_PROFILE_PICTURE_LOADING)),
user_manager::User::USER_IMAGE_INVALID,
false);
- WallpaperManager::Get()->SetUserWallpaperNow(
- login::DemoAccountId().GetUserEmail());
+ WallpaperManager::Get()->SetUserWallpaperNow(login::DemoAccountId());
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
command_line->AppendSwitch(::switches::kForceAppMode);
@@ -857,7 +863,7 @@ void ChromeUserManagerImpl::RemoveNonCryptohomeData(
const AccountId& account_id) {
ChromeUserManager::RemoveNonCryptohomeData(account_id);
- WallpaperManager::Get()->RemoveUserWallpaperInfo(account_id.GetUserEmail());
+ WallpaperManager::Get()->RemoveUserWallpaperInfo(account_id);
GetUserImageManager(account_id)->DeleteUserImage();
supervised_user_manager_->RemoveNonCryptohomeData(account_id.GetUserEmail());

Powered by Google App Engine
This is Rietveld 408576698