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 2d49b4d18cd27d7c67b7d577080e3b74d7c976d5..ad83164b5acb153369322285543ce7eb094d27f9 100644 |
--- a/ash/desktop_background/desktop_background_controller.cc |
+++ b/ash/desktop_background/desktop_background_controller.cc |
@@ -106,7 +106,6 @@ DesktopBackgroundController::DesktopBackgroundController() |
desktop_background_mode_(BACKGROUND_SOLID_COLOR), |
background_color_(kTransparentColor), |
weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { |
- InstallComponentForAllWindows(); |
} |
DesktopBackgroundController::~DesktopBackgroundController() { |
@@ -213,22 +212,10 @@ void DesktopBackgroundController::CancelPendingWallpaperOperation() { |
void DesktopBackgroundController::SetDesktopBackgroundSolidColorMode( |
SkColor color) { |
background_color_ = color; |
- if (desktop_background_mode_ != BACKGROUND_SOLID_COLOR) { |
+ if (desktop_background_mode_ != BACKGROUND_SOLID_COLOR) |
desktop_background_mode_ = BACKGROUND_SOLID_COLOR; |
- InstallComponentForAllWindows(); |
- return; |
- } |
- Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); |
- for (Shell::RootWindowList::iterator iter = root_windows.begin(); |
- iter != root_windows.end(); ++iter) { |
- aura::RootWindow* root_window = *iter; |
- internal::DesktopBackgroundWidgetController* component = root_window-> |
- GetProperty(internal::kWindowDesktopComponent); |
- DCHECK(component); |
- DCHECK(component->layer()); |
- component->layer()->SetColor(background_color_ ); |
- } |
+ InstallComponentForAllWindows(); |
} |
void DesktopBackgroundController::CreateEmptyWallpaper() { |
@@ -260,23 +247,8 @@ void DesktopBackgroundController::OnWindowDestroying(aura::Window* window) { |
void DesktopBackgroundController::SetDesktopBackgroundImageMode() { |
if (desktop_background_mode_ != BACKGROUND_IMAGE) { |
desktop_background_mode_ = BACKGROUND_IMAGE; |
- InstallComponentForAllWindows(); |
- return; |
- } |
- |
- Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); |
- for (Shell::RootWindowList::iterator iter = root_windows.begin(); |
- iter != root_windows.end(); ++iter) { |
- aura::RootWindow* root_window = *iter; |
- internal::DesktopBackgroundWidgetController* component = root_window-> |
- GetProperty(internal::kWindowDesktopComponent); |
- DCHECK(component); |
- DCHECK(component->widget()); |
- aura::Window* window = component->widget()->GetNativeView(); |
- gfx::Rect bounds = window->bounds(); |
- window->SchedulePaintInRect(gfx::Rect(0, 0, |
- bounds.width(), bounds.height())); |
} |
+ InstallComponentForAllWindows(); |
} |
void DesktopBackgroundController::OnWallpaperLoadCompleted( |
@@ -311,6 +283,7 @@ void DesktopBackgroundController::InstallComponent( |
views::Widget* widget = internal::CreateDesktopBackground(root_window, |
container_id); |
component = new internal::DesktopBackgroundWidgetController(widget); |
+ root_window_component_map_[root_window] = component; |
break; |
} |
case BACKGROUND_SOLID_COLOR: { |
@@ -328,6 +301,12 @@ void DesktopBackgroundController::InstallComponent( |
// First time for this root window |
root_window->AddObserver(this); |
} |
+} |
+ |
+void DesktopBackgroundController::SetComponentForRootWindow( |
+ aura::RootWindow* root_window) { |
+ internal::DesktopBackgroundWidgetController* component = |
+ root_window_component_map_[root_window]; |
root_window->SetProperty(internal::kWindowDesktopComponent, component); |
} |