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

Unified Diff: ash/desktop_background/desktop_background_controller.cc

Issue 10375010: Implement user selected wallpaper feature. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge Created 8 years, 7 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: ash/desktop_background/desktop_background_controller.cc
diff --git a/ash/desktop_background/desktop_background_controller.cc b/ash/desktop_background/desktop_background_controller.cc
index f95c32e9391c4da59e398b819e4a4ba03b71ab04..5b2562e39f8f7f2156f6b680f9e375ee05a0a8a3 100644
--- a/ash/desktop_background/desktop_background_controller.cc
+++ b/ash/desktop_background/desktop_background_controller.cc
@@ -41,10 +41,8 @@ class DesktopBackgroundController::WallpaperOperation
void LoadingWallpaper() {
if (cancel_flag_.IsSet())
return;
-
wallpaper_ = ui::ResourceBundle::GetSharedInstance().GetImageNamed(
GetWallpaperInfo(index_).id).ToSkBitmap();
-
if (cancel_flag_.IsSet())
return;
layout_ = GetWallpaperInfo(index_).layout;
@@ -58,7 +56,7 @@ class DesktopBackgroundController::WallpaperOperation
return wallpaper_;
}
- ImageLayout image_layout() {
+ WallpaperLayout wallpaper_layout() {
return layout_;
}
@@ -69,12 +67,11 @@ class DesktopBackgroundController::WallpaperOperation
private:
friend class base::RefCountedThreadSafe<
DesktopBackgroundController::WallpaperOperation>;
- ~WallpaperOperation(){};
base::CancellationFlag cancel_flag_;
const SkBitmap* wallpaper_;
- ImageLayout layout_;
+ WallpaperLayout layout_;
int index_;
DISALLOW_COPY_AND_ASSIGN(WallpaperOperation);
@@ -93,6 +90,7 @@ DesktopBackgroundController::~DesktopBackgroundController() {
void DesktopBackgroundController::SetDefaultWallpaper(int index) {
if (previous_index_ == index)
return;
+
CancelPendingWallpaperOperation();
wallpaper_op_ = new WallpaperOperation(index);
@@ -105,6 +103,15 @@ void DesktopBackgroundController::SetDefaultWallpaper(int index) {
true /* task_is_slow */);
}
+void DesktopBackgroundController::SetCustomWallpaper(const SkBitmap& wallpaper,
+ WallpaperLayout layout) {
+ internal::RootWindowLayoutManager* root_window_layout =
+ Shell::GetInstance()->root_window_layout();
+ root_window_layout->SetBackgroundLayer(NULL);
+ internal::CreateDesktopBackground(wallpaper, layout);
+ desktop_background_mode_ = BACKGROUND_IMAGE;
+}
+
void DesktopBackgroundController::CancelPendingWallpaperOperation() {
// Set canceled flag of previous request to skip unneeded loading.
if (wallpaper_op_.get())
@@ -148,7 +155,7 @@ void DesktopBackgroundController::SetDesktopBackgroundImageMode(
Shell::GetInstance()->root_window_layout();
root_window_layout->SetBackgroundLayer(NULL);
if(wo->wallpaper()) {
- internal::CreateDesktopBackground(*wo->wallpaper(), wo->image_layout());
+ internal::CreateDesktopBackground(*wo->wallpaper(), wo->wallpaper_layout());
desktop_background_mode_ = BACKGROUND_IMAGE;
}
}
« no previous file with comments | « ash/desktop_background/desktop_background_controller.h ('k') | ash/desktop_background/desktop_background_resources.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698