| 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/desktop_background/desktop_background_controller_observer.h" | 8 #include "ash/desktop_background/desktop_background_controller_observer.h" |
| 9 #include "ash/desktop_background/desktop_background_view.h" | 9 #include "ash/desktop_background/desktop_background_view.h" |
| 10 #include "ash/desktop_background/desktop_background_widget_controller.h" | 10 #include "ash/desktop_background/desktop_background_widget_controller.h" |
| 11 #include "ash/desktop_background/user_wallpaper_delegate.h" | 11 #include "ash/desktop_background/user_wallpaper_delegate.h" |
| 12 #include "ash/display/display_info.h" | 12 #include "ash/display/display_info.h" |
| 13 #include "ash/display/display_manager.h" | 13 #include "ash/display/display_manager.h" |
| 14 #include "ash/root_window_controller.h" | 14 #include "ash/root_window_controller.h" |
| 15 #include "ash/shell.h" | 15 #include "ash/shell.h" |
| 16 #include "ash/shell_factory.h" | 16 #include "ash/shell_factory.h" |
| 17 #include "ash/shell_window_ids.h" | 17 #include "ash/shell_window_ids.h" |
| 18 #include "ash/wm/root_window_layout_manager.h" | 18 #include "ash/wm/root_window_layout_manager.h" |
| 19 #include "base/bind.h" | 19 #include "base/bind.h" |
| 20 #include "base/command_line.h" | 20 #include "base/command_line.h" |
| 21 #include "base/files/file_util.h" | 21 #include "base/files/file_util.h" |
| 22 #include "base/logging.h" | 22 #include "base/logging.h" |
| 23 #include "base/synchronization/cancellation_flag.h" | 23 #include "base/synchronization/cancellation_flag.h" |
| 24 #include "base/threading/sequenced_worker_pool.h" | 24 #include "base/threading/sequenced_worker_pool.h" |
| 25 #include "components/wallpaper/wallpaper_resizer.h" | 25 #include "components/wallpaper/wallpaper_resizer.h" |
| 26 #include "ui/aura/window.h" | 26 #include "ui/aura/window.h" |
| 27 #include "ui/aura/window_event_dispatcher.h" | 27 #include "ui/aura/window_event_dispatcher.h" |
| 28 #include "ui/compositor/layer.h" | 28 #include "ui/compositor/layer.h" |
| 29 #include "ui/display/screen.h" |
| 29 #include "ui/gfx/codec/jpeg_codec.h" | 30 #include "ui/gfx/codec/jpeg_codec.h" |
| 30 #include "ui/gfx/geometry/rect.h" | 31 #include "ui/gfx/geometry/rect.h" |
| 31 #include "ui/gfx/image/image_skia.h" | 32 #include "ui/gfx/image/image_skia.h" |
| 32 #include "ui/gfx/screen.h" | |
| 33 #include "ui/views/widget/widget.h" | 33 #include "ui/views/widget/widget.h" |
| 34 | 34 |
| 35 using wallpaper::WallpaperResizer; | 35 using wallpaper::WallpaperResizer; |
| 36 using wallpaper::WallpaperLayout; | 36 using wallpaper::WallpaperLayout; |
| 37 using wallpaper::WALLPAPER_LAYOUT_CENTER; | 37 using wallpaper::WALLPAPER_LAYOUT_CENTER; |
| 38 using wallpaper::WALLPAPER_LAYOUT_CENTER_CROPPED; | 38 using wallpaper::WALLPAPER_LAYOUT_CENTER_CROPPED; |
| 39 using wallpaper::WALLPAPER_LAYOUT_STRETCH; | 39 using wallpaper::WALLPAPER_LAYOUT_STRETCH; |
| 40 using wallpaper::WALLPAPER_LAYOUT_TILE; | 40 using wallpaper::WALLPAPER_LAYOUT_TILE; |
| 41 | 41 |
| 42 namespace ash { | 42 namespace ash { |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 UpdateWallpaper(true /* clear cache */); | 156 UpdateWallpaper(true /* clear cache */); |
| 157 } | 157 } |
| 158 | 158 |
| 159 InstallDesktopController(root_window); | 159 InstallDesktopController(root_window); |
| 160 } | 160 } |
| 161 | 161 |
| 162 // static | 162 // static |
| 163 gfx::Size DesktopBackgroundController::GetMaxDisplaySizeInNative() { | 163 gfx::Size DesktopBackgroundController::GetMaxDisplaySizeInNative() { |
| 164 int width = 0; | 164 int width = 0; |
| 165 int height = 0; | 165 int height = 0; |
| 166 std::vector<gfx::Display> displays = | 166 std::vector<display::Display> displays = |
| 167 gfx::Screen::GetScreen()->GetAllDisplays(); | 167 display::Screen::GetScreen()->GetAllDisplays(); |
| 168 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 168 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
| 169 | 169 |
| 170 for (std::vector<gfx::Display>::iterator iter = displays.begin(); | 170 for (std::vector<display::Display>::iterator iter = displays.begin(); |
| 171 iter != displays.end(); ++iter) { | 171 iter != displays.end(); ++iter) { |
| 172 // Don't use size_in_pixel because we want to use the native pixel size. | 172 // Don't use size_in_pixel because we want to use the native pixel size. |
| 173 gfx::Size size_in_pixel = | 173 gfx::Size size_in_pixel = |
| 174 display_manager->GetDisplayInfo(iter->id()).bounds_in_native().size(); | 174 display_manager->GetDisplayInfo(iter->id()).bounds_in_native().size(); |
| 175 if (iter->rotation() == gfx::Display::ROTATE_90 || | 175 if (iter->rotation() == display::Display::ROTATE_90 || |
| 176 iter->rotation() == gfx::Display::ROTATE_270) { | 176 iter->rotation() == display::Display::ROTATE_270) { |
| 177 size_in_pixel = gfx::Size(size_in_pixel.height(), size_in_pixel.width()); | 177 size_in_pixel = gfx::Size(size_in_pixel.height(), size_in_pixel.width()); |
| 178 } | 178 } |
| 179 width = std::max(size_in_pixel.width(), width); | 179 width = std::max(size_in_pixel.width(), width); |
| 180 height = std::max(size_in_pixel.height(), height); | 180 height = std::max(size_in_pixel.height(), height); |
| 181 } | 181 } |
| 182 return gfx::Size(width, height); | 182 return gfx::Size(width, height); |
| 183 } | 183 } |
| 184 | 184 |
| 185 bool DesktopBackgroundController::WallpaperIsAlreadyLoaded( | 185 bool DesktopBackgroundController::WallpaperIsAlreadyLoaded( |
| 186 const gfx::ImageSkia& image, | 186 const gfx::ImageSkia& image, |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 : kShellWindowId_DesktopBackgroundContainer; | 276 : kShellWindowId_DesktopBackgroundContainer; |
| 277 } | 277 } |
| 278 | 278 |
| 279 void DesktopBackgroundController::UpdateWallpaper(bool clear_cache) { | 279 void DesktopBackgroundController::UpdateWallpaper(bool clear_cache) { |
| 280 current_wallpaper_.reset(NULL); | 280 current_wallpaper_.reset(NULL); |
| 281 ash::Shell::GetInstance()->user_wallpaper_delegate()->UpdateWallpaper( | 281 ash::Shell::GetInstance()->user_wallpaper_delegate()->UpdateWallpaper( |
| 282 clear_cache); | 282 clear_cache); |
| 283 } | 283 } |
| 284 | 284 |
| 285 } // namespace ash | 285 } // namespace ash |
| OLD | NEW |