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

Unified Diff: chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.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/chromeos/login/users/wallpaper/wallpaper_manager.cc
diff --git a/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.cc b/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.cc
index 1c4aa18b8dac898954dd03cac5ef3f3b3de7347b..b468027c3f5816b2ce02c61039415725328c618e 100644
--- a/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.cc
+++ b/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.cc
@@ -135,7 +135,7 @@ class WallpaperManager::PendingWallpaper :
// Do LoadWallpaper() - image not found in cache.
PendingWallpaper(
const base::TimeDelta delay,
- const std::string& user_id)
+ const user_manager::UserID& user_id)
: user_id_(user_id),
default_(false),
on_finish_(new MovableOnDestroyCallback(
@@ -254,7 +254,7 @@ class WallpaperManager::PendingWallpaper :
manager->RemovePendingWallpaperFromList(this);
}
- std::string user_id_;
+ const user_manager::UserID user_id_;
wallpaper::WallpaperInfo info_;
gfx::ImageSkia user_wallpaper_;
base::FilePath wallpaper_path_;
@@ -334,7 +334,7 @@ void WallpaperManager::EnsureLoggedInUserWallpaperLoaded() {
return;
}
SetUserWallpaperNow(
- user_manager::UserManager::Get()->GetLoggedInUser()->email());
+ user_manager::UserManager::Get()->GetLoggedInUser()->GetUserID());
}
void WallpaperManager::InitializeWallpaper() {
@@ -372,12 +372,12 @@ void WallpaperManager::InitializeWallpaper() {
if (!user_manager->IsUserLoggedIn()) {
if (!StartupUtils::IsDeviceRegistered())
- SetDefaultWallpaperDelayed(chromeos::login::kSignInUser);
+ SetDefaultWallpaperDelayed(chromeos::login::GetSignInUserID());
else
InitializeRegisteredDeviceWallpaper();
return;
}
- SetUserWallpaperDelayed(user_manager->GetLoggedInUser()->email());
+ SetUserWallpaperDelayed(user_manager->GetLoggedInUser()->GetUserID());
}
void WallpaperManager::Observe(int type,
@@ -424,18 +424,18 @@ void WallpaperManager::Observe(int type,
}
}
-void WallpaperManager::RemoveUserWallpaperInfo(const std::string& user_id) {
+void WallpaperManager::RemoveUserWallpaperInfo(const user_manager::UserID& user_id) {
WallpaperInfo info;
GetUserWallpaperInfo(user_id, &info);
PrefService* prefs = g_browser_process->local_state();
DictionaryPrefUpdate prefs_wallpapers_info_update(
prefs, wallpaper::kUsersWallpaperInfo);
- prefs_wallpapers_info_update->RemoveWithoutPathExpansion(user_id, NULL);
+ prefs_wallpapers_info_update->RemoveWithoutPathExpansion(user_id.GetUserEmail(), NULL);
DeleteUserWallpapers(user_id, info.location);
}
void WallpaperManager::OnPolicyFetched(const std::string& policy,
- const std::string& user_id,
+ const user_manager::UserID& user_id,
scoped_ptr<std::string> data) {
if (!data)
return;
@@ -449,7 +449,7 @@ void WallpaperManager::OnPolicyFetched(const std::string& policy,
}
void WallpaperManager::SetCustomWallpaper(
- const std::string& user_id,
+ const user_manager::UserID& user_id,
const std::string& user_id_hash,
const std::string& file,
wallpaper::WallpaperLayout layout,
@@ -528,16 +528,16 @@ void WallpaperManager::SetCustomWallpaper(
wallpaper_cache_[user_id] = CustomWallpaperElement(wallpaper_path, image);
}
-void WallpaperManager::SetDefaultWallpaperNow(const std::string& user_id) {
+void WallpaperManager::SetDefaultWallpaperNow(const user_manager::UserID& user_id) {
GetPendingWallpaper(user_id, false)->ResetSetDefaultWallpaper();
}
-void WallpaperManager::SetDefaultWallpaperDelayed(const std::string& user_id) {
+void WallpaperManager::SetDefaultWallpaperDelayed(const user_manager::UserID& user_id) {
GetPendingWallpaper(user_id, true)->ResetSetDefaultWallpaper();
}
void WallpaperManager::DoSetDefaultWallpaper(
- const std::string& user_id,
+ const user_manager::UserID& user_id,
MovableOnDestroyCallbackHolder on_finish) {
// There is no visible background in kiosk mode.
if (user_manager::UserManager::Get()->IsLoggedInAsKioskApp())
@@ -592,7 +592,7 @@ void WallpaperManager::DoSetDefaultWallpaper(
default_wallpaper_image_->image(), layout);
}
-void WallpaperManager::SetUserWallpaperInfo(const std::string& user_id,
+void WallpaperManager::SetUserWallpaperInfo(const user_manager::UserID& user_id,
const WallpaperInfo& info,
bool is_persistent) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
@@ -610,10 +610,10 @@ void WallpaperManager::SetUserWallpaperInfo(const std::string& user_id,
wallpaper_info_dict->SetString(kNewWallpaperLocationNodeName, info.location);
wallpaper_info_dict->SetInteger(kNewWallpaperLayoutNodeName, info.layout);
wallpaper_info_dict->SetInteger(kNewWallpaperTypeNodeName, info.type);
- wallpaper_update->SetWithoutPathExpansion(user_id, wallpaper_info_dict);
+ wallpaper_update->SetWithoutPathExpansion(user_id.GetUserEmail(), wallpaper_info_dict);
}
-void WallpaperManager::ScheduleSetUserWallpaper(const std::string& user_id,
+void WallpaperManager::ScheduleSetUserWallpaper(const user_manager::UserID& user_id,
bool delayed) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
// Some unit tests come here without a UserManager or without a pref system.q
@@ -695,7 +695,7 @@ void WallpaperManager::ScheduleSetUserWallpaper(const std::string& user_id,
}
void WallpaperManager::SetWallpaperFromImageSkia(
- const std::string& user_id,
+ const user_manager::UserID& user_id,
const gfx::ImageSkia& image,
wallpaper::WallpaperLayout layout,
bool update_wallpaper) {
@@ -746,7 +746,7 @@ WallpaperManager::WallpaperManager()
}
WallpaperManager::PendingWallpaper* WallpaperManager::GetPendingWallpaper(
- const std::string& user_id,
+ const user_manager::UserID& user_id,
bool delayed) {
if (!pending_inactive_) {
loading_.push_back(new WallpaperManager::PendingWallpaper(
@@ -790,7 +790,7 @@ void WallpaperManager::InitializeRegisteredDeviceWallpaper() {
int public_session_user_index = FindPublicSession(users);
if ((!show_users && public_session_user_index == -1) || users.empty()) {
// Boot into sign in form, preload default wallpaper.
- SetDefaultWallpaperDelayed(chromeos::login::kSignInUser);
+ SetDefaultWallpaperDelayed(chromeos::login::GetSignInUserID());
return;
}
@@ -799,11 +799,11 @@ void WallpaperManager::InitializeRegisteredDeviceWallpaper() {
// Normal boot, load user wallpaper.
// If normal boot animation is disabled wallpaper would be set
// asynchronously once user pods are loaded.
- SetUserWallpaperDelayed(users[index]->email());
+ SetUserWallpaperDelayed(users[index]->GetUserID());
}
}
-bool WallpaperManager::GetUserWallpaperInfo(const std::string& user_id,
+bool WallpaperManager::GetUserWallpaperInfo(const user_manager::UserID& user_id,
WallpaperInfo* info) const {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
@@ -820,7 +820,7 @@ bool WallpaperManager::GetUserWallpaperInfo(const std::string& user_id,
const base::DictionaryValue* info_dict;
if (!g_browser_process->local_state()
->GetDictionary(wallpaper::kUsersWallpaperInfo)
- ->GetDictionaryWithoutPathExpansion(user_id, &info_dict)) {
+ ->GetDictionaryWithoutPathExpansion(user_id.GetUserEmail(), &info_dict)) {
return false;
}
@@ -849,7 +849,7 @@ bool WallpaperManager::GetUserWallpaperInfo(const std::string& user_id,
}
void WallpaperManager::OnWallpaperDecoded(
- const std::string& user_id,
+ const user_manager::UserID& user_id,
wallpaper::WallpaperLayout layout,
bool update_wallpaper,
MovableOnDestroyCallbackHolder on_finish,
@@ -882,7 +882,7 @@ void WallpaperManager::OnWallpaperDecoded(
}
}
-void WallpaperManager::StartLoad(const std::string& user_id,
+void WallpaperManager::StartLoad(const user_manager::UserID& user_id,
const WallpaperInfo& info,
bool update_wallpaper,
const base::FilePath& wallpaper_path,
@@ -961,7 +961,7 @@ size_t WallpaperManager::GetPendingListSizeForTesting() const {
}
void WallpaperManager::UserChangedChildStatus(user_manager::User* user) {
- SetUserWallpaperNow(user->email());
+ SetUserWallpaperNow(user->GetUserID());
}
void WallpaperManager::OnDefaultWallpaperDecoded(
@@ -1031,7 +1031,7 @@ void WallpaperManager::SetDefaultWallpaperPath(
}
if (need_update_screen) {
- DoSetDefaultWallpaper(std::string(),
+ DoSetDefaultWallpaper(user_manager::UserID(std::string(), std::string()),
MovableOnDestroyCallbackHolder().Pass());
}
}

Powered by Google App Engine
This is Rietveld 408576698