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

Unified Diff: chrome/browser/chromeos/extensions/wallpaper_private_api.cc

Issue 23480087: Use username_hash instead of email (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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/extensions/wallpaper_private_api.cc
diff --git a/chrome/browser/chromeos/extensions/wallpaper_private_api.cc b/chrome/browser/chromeos/extensions/wallpaper_private_api.cc
index 9448649d6ad1eeb8b4f3f3b0e46a807e2e75d058..34b83aa4dda24f636deb50ec382eda81af85ecc5 100644
--- a/chrome/browser/chromeos/extensions/wallpaper_private_api.cc
+++ b/chrome/browser/chromeos/extensions/wallpaper_private_api.cc
@@ -243,12 +243,15 @@ bool WallpaperPrivateSetWallpaperIfExistsFunction::RunImpl() {
} else {
type_ = chromeos::User::CUSTOMIZED;
file_name = urlOrFile_;
+ std::string username_hash =
+ chromeos::UserManager::Get()->GetLoggedInUser()->username_hash();
const char* sub_dir = (resolution == ash::WALLPAPER_RESOLUTION_SMALL) ?
chromeos::kSmallWallpaperSubDir : chromeos::kLargeWallpaperSubDir;
wallpaper_path = chromeos::WallpaperManager::Get()->GetCustomWallpaperPath(
- sub_dir, email, file_name);
+ sub_dir, username_hash, file_name);
+
fallback_path = chromeos::WallpaperManager::Get()->GetCustomWallpaperPath(
- chromeos::kOriginalWallpaperSubDir, email, file_name);
+ chromeos::kOriginalWallpaperSubDir, username_hash, file_name);
}
sequence_token_ = BrowserThread::GetBlockingPool()->
@@ -468,8 +471,10 @@ bool WallpaperPrivateSetCustomWallpaperFunction::RunImpl() {
EXTENSION_FUNCTION_VALIDATE(args_->GetString(3, &file_name_));
EXTENSION_FUNCTION_VALIDATE(!file_name_.empty());
- // Gets email address while at UI thread.
+ // Gets email address and username hash while at UI thread.
email_ = chromeos::UserManager::Get()->GetLoggedInUser()->email();
+ user_id_hash_ =
+ chromeos::UserManager::Get()->GetLoggedInUser()->username_hash();
image_data_.assign(input->GetBuffer(), input->GetSize());
StartDecode(image_data_);
@@ -485,7 +490,7 @@ void WallpaperPrivateSetCustomWallpaperFunction::OnWallpaperDecoded(
image_data_.end());
chromeos::UserImage image(wallpaper, raw_image);
base::FilePath thumbnail_path = wallpaper_manager->GetCustomWallpaperPath(
- chromeos::kThumbnailWallpaperSubDir, email_, file_name_);
+ chromeos::kThumbnailWallpaperSubDir, user_id_hash_, file_name_);
sequence_token_ = BrowserThread::GetBlockingPool()->
GetNamedSequenceToken(chromeos::kWallpaperSequenceTokenName);
@@ -494,9 +499,10 @@ void WallpaperPrivateSetCustomWallpaperFunction::OnWallpaperDecoded(
GetSequencedTaskRunnerWithShutdownBehavior(sequence_token_,
base::SequencedWorkerPool::BLOCK_SHUTDOWN);
- // In the new wallpaper picker UI, we do not depend on WallpaperDelegate
- // to refresh thumbnail. Uses a null delegate here.
- wallpaper_manager->SetCustomWallpaper(email_, file_name_, layout_,
+ wallpaper_manager->SetCustomWallpaper(email_,
+ user_id_hash_,
+ file_name_,
+ layout_,
chromeos::User::CUSTOMIZED,
image);
unsafe_wallpaper_decoder_ = NULL;
@@ -629,8 +635,11 @@ bool WallpaperPrivateGetThumbnailFunction::RunImpl() {
thumbnail_path = thumbnail_path.Append(file_name);
} else {
file_name = urlOrFile;
+ std::string username_hash =
+ chromeos::UserManager::Get()->GetLoggedInUser()->username_hash();
thumbnail_path = chromeos::WallpaperManager::Get()->
- GetCustomWallpaperPath(chromeos::kThumbnailWallpaperSubDir, email,
+ GetCustomWallpaperPath(chromeos::kThumbnailWallpaperSubDir,
+ username_hash,
file_name);
}
« no previous file with comments | « chrome/browser/chromeos/extensions/wallpaper_private_api.h ('k') | chrome/browser/chromeos/login/wallpaper_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698