| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/desktop_background/desktop_background_controller.h" | 5 #include "ash/desktop_background/desktop_background_controller.h" |
| 6 | 6 |
| 7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
| 8 #include "ash/aura/wm_window_aura.h" |
| 8 #include "ash/common/shell_window_ids.h" | 9 #include "ash/common/shell_window_ids.h" |
| 9 #include "ash/common/wm/root_window_layout_manager.h" | 10 #include "ash/common/wm/root_window_layout_manager.h" |
| 10 #include "ash/desktop_background/desktop_background_controller_observer.h" | 11 #include "ash/desktop_background/desktop_background_controller_observer.h" |
| 11 #include "ash/desktop_background/desktop_background_view.h" | 12 #include "ash/desktop_background/desktop_background_view.h" |
| 12 #include "ash/desktop_background/desktop_background_widget_controller.h" | 13 #include "ash/desktop_background/desktop_background_widget_controller.h" |
| 13 #include "ash/desktop_background/user_wallpaper_delegate.h" | 14 #include "ash/desktop_background/user_wallpaper_delegate.h" |
| 14 #include "ash/display/display_info.h" | 15 #include "ash/display/display_info.h" |
| 15 #include "ash/display/display_manager.h" | 16 #include "ash/display/display_manager.h" |
| 16 #include "ash/root_window_controller.h" | 17 #include "ash/root_window_controller.h" |
| 17 #include "ash/shell.h" | 18 #include "ash/shell.h" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 current_wallpaper_.get()) { | 136 current_wallpaper_.get()) { |
| 136 timer_.Stop(); | 137 timer_.Stop(); |
| 137 timer_.Start(FROM_HERE, | 138 timer_.Start(FROM_HERE, |
| 138 base::TimeDelta::FromMilliseconds(wallpaper_reload_delay_), | 139 base::TimeDelta::FromMilliseconds(wallpaper_reload_delay_), |
| 139 base::Bind(&DesktopBackgroundController::UpdateWallpaper, | 140 base::Bind(&DesktopBackgroundController::UpdateWallpaper, |
| 140 base::Unretained(this), false /* clear cache */)); | 141 base::Unretained(this), false /* clear cache */)); |
| 141 } | 142 } |
| 142 } | 143 } |
| 143 } | 144 } |
| 144 | 145 |
| 145 void DesktopBackgroundController::OnRootWindowAdded(aura::Window* root_window) { | 146 void DesktopBackgroundController::OnRootWindowAdded(WmWindow* root_window) { |
| 146 // The background hasn't been set yet. | 147 // The background hasn't been set yet. |
| 147 if (desktop_background_mode_ == BACKGROUND_NONE) | 148 if (desktop_background_mode_ == BACKGROUND_NONE) |
| 148 return; | 149 return; |
| 149 | 150 |
| 150 // Handle resolution change for "built-in" images. | 151 // Handle resolution change for "built-in" images. |
| 151 gfx::Size max_display_size = GetMaxDisplaySizeInNative(); | 152 gfx::Size max_display_size = GetMaxDisplaySizeInNative(); |
| 152 if (current_max_display_size_ != max_display_size) { | 153 if (current_max_display_size_ != max_display_size) { |
| 153 current_max_display_size_ = max_display_size; | 154 current_max_display_size_ = max_display_size; |
| 154 if (desktop_background_mode_ == BACKGROUND_IMAGE && | 155 if (desktop_background_mode_ == BACKGROUND_IMAGE && |
| 155 current_wallpaper_.get()) | 156 current_wallpaper_.get()) |
| 156 UpdateWallpaper(true /* clear cache */); | 157 UpdateWallpaper(true /* clear cache */); |
| 157 } | 158 } |
| 158 | 159 |
| 159 InstallDesktopController(root_window); | 160 InstallDesktopController(WmWindowAura::GetAuraWindow(root_window)); |
| 160 } | 161 } |
| 161 | 162 |
| 162 // static | 163 // static |
| 163 gfx::Size DesktopBackgroundController::GetMaxDisplaySizeInNative() { | 164 gfx::Size DesktopBackgroundController::GetMaxDisplaySizeInNative() { |
| 164 // Return an empty size for test environments where the screen is null. | 165 // Return an empty size for test environments where the screen is null. |
| 165 if (!display::Screen::GetScreen()) | 166 if (!display::Screen::GetScreen()) |
| 166 return gfx::Size(); | 167 return gfx::Size(); |
| 167 | 168 |
| 168 int width = 0; | 169 int width = 0; |
| 169 int height = 0; | 170 int height = 0; |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 : kShellWindowId_DesktopBackgroundContainer; | 283 : kShellWindowId_DesktopBackgroundContainer; |
| 283 } | 284 } |
| 284 | 285 |
| 285 void DesktopBackgroundController::UpdateWallpaper(bool clear_cache) { | 286 void DesktopBackgroundController::UpdateWallpaper(bool clear_cache) { |
| 286 current_wallpaper_.reset(NULL); | 287 current_wallpaper_.reset(NULL); |
| 287 ash::Shell::GetInstance()->user_wallpaper_delegate()->UpdateWallpaper( | 288 ash::Shell::GetInstance()->user_wallpaper_delegate()->UpdateWallpaper( |
| 288 clear_cache); | 289 clear_cache); |
| 289 } | 290 } |
| 290 | 291 |
| 291 } // namespace ash | 292 } // namespace ash |
| OLD | NEW |