Index: ash/desktop_background/desktop_background_controller.cc |
=================================================================== |
--- ash/desktop_background/desktop_background_controller.cc (revision 149939) |
+++ ash/desktop_background/desktop_background_controller.cc (working copy) |
@@ -23,10 +23,6 @@ |
namespace ash { |
namespace { |
- |
-const int kSmallWallpaperMaximalWidth = 1366; |
-const int kSmallWallpaperMaximalHeight = 800; |
- |
internal::RootWindowLayoutManager* GetRootWindowLayoutManager( |
aura::RootWindow* root_window) { |
return static_cast<internal::RootWindowLayoutManager*>( |
@@ -36,11 +32,11 @@ |
// Stores the current wallpaper data. |
struct DesktopBackgroundController::WallpaperData { |
- WallpaperData(int index, WallpaperResolution resolution) |
+ explicit WallpaperData(int index) |
: wallpaper_index(index), |
- wallpaper_layout(GetWallpaperViewInfo(index, resolution).layout), |
+ wallpaper_layout(GetWallpaperInfo(index).layout), |
wallpaper_image(*(ui::ResourceBundle::GetSharedInstance().GetImageNamed( |
- GetWallpaperViewInfo(index, resolution).id).ToImageSkia())) { |
+ GetWallpaperInfo(index).id).ToImageSkia())) { |
} |
WallpaperData(WallpaperLayout layout, const gfx::ImageSkia& image) |
: wallpaper_index(-1), |
@@ -58,9 +54,7 @@ |
: public base::RefCountedThreadSafe< |
DesktopBackgroundController::WallpaperOperation> { |
public: |
- WallpaperOperation(int index, WallpaperResolution resolution) |
- : index_(index), |
- resolution_(resolution) { |
+ explicit WallpaperOperation(int index) : index_(index) { |
} |
static void Run(scoped_refptr<WallpaperOperation> wo) { |
@@ -70,7 +64,7 @@ |
void LoadingWallpaper() { |
if (cancel_flag_.IsSet()) |
return; |
- wallpaper_data_.reset(new WallpaperData(index_, resolution_)); |
+ wallpaper_data_.reset(new WallpaperData(index_)); |
} |
void Cancel() { |
@@ -91,10 +85,8 @@ |
scoped_ptr<WallpaperData> wallpaper_data_; |
- const int index_; |
+ int index_; |
- const WallpaperResolution resolution_; |
- |
DISALLOW_COPY_AND_ASSIGN(WallpaperOperation); |
}; |
@@ -131,17 +123,7 @@ |
switch (desktop_background_mode_) { |
case BACKGROUND_IMAGE: |
if (current_wallpaper_.get()) { |
- gfx::Size root_window_size = root_window->GetHostSize(); |
- int wallpaper_width = current_wallpaper_->wallpaper_image.width(); |
- int wallpaper_height = current_wallpaper_->wallpaper_image.height(); |
- // Loads a higher resolution wallpaper if needed. |
- if ((wallpaper_width < root_window_size.width() || |
- wallpaper_height < root_window_size.height()) && |
- current_wallpaper_->wallpaper_index != -1 && |
- current_wallpaper_->wallpaper_layout != TILE) |
- SetDefaultWallpaper(current_wallpaper_->wallpaper_index, true); |
- else |
- SetDesktopBackgroundImage(root_window); |
+ SetDesktopBackgroundImage(root_window); |
} else { |
internal::CreateDesktopBackground(root_window); |
} |
@@ -152,8 +134,7 @@ |
} |
} |
-void DesktopBackgroundController::SetDefaultWallpaper(int index, |
- bool force_reload) { |
+void DesktopBackgroundController::SetDefaultWallpaper(int index) { |
// We should not change background when index is invalid. For instance, at |
// login screen or stub_user login. |
if (index == ash::GetInvalidWallpaperIndex()) { |
@@ -164,23 +145,12 @@ |
return; |
} |
- if (!force_reload && current_wallpaper_.get() && |
- current_wallpaper_->wallpaper_index == index) |
+ if (current_wallpaper_.get() && current_wallpaper_->wallpaper_index == index) |
return; |
CancelPendingWallpaperOperation(); |
- WallpaperResolution resolution = SMALL; |
- Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); |
- for (Shell::RootWindowList::iterator iter = root_windows.begin(); |
- iter != root_windows.end(); ++iter) { |
- gfx::Size root_window_size = (*iter)->GetHostSize(); |
- if (root_window_size.width() > kSmallWallpaperMaximalWidth || |
- root_window_size.height() > kSmallWallpaperMaximalHeight) |
- resolution = LARGE; |
- } |
- |
- wallpaper_op_ = new WallpaperOperation(index, resolution); |
+ wallpaper_op_ = new WallpaperOperation(index); |
base::WorkerPool::PostTaskAndReply( |
FROM_HERE, |
base::Bind(&WallpaperOperation::Run, wallpaper_op_), |