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" |
(...skipping 11 matching lines...) Expand all Loading... |
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/gfx/codec/jpeg_codec.h" | 29 #include "ui/gfx/codec/jpeg_codec.h" |
30 #include "ui/gfx/geometry/rect.h" | 30 #include "ui/gfx/geometry/rect.h" |
31 #include "ui/gfx/image/image_skia.h" | 31 #include "ui/gfx/image/image_skia.h" |
| 32 #include "ui/gfx/screen.h" |
32 #include "ui/views/widget/widget.h" | 33 #include "ui/views/widget/widget.h" |
33 | 34 |
34 using wallpaper::WallpaperResizer; | 35 using wallpaper::WallpaperResizer; |
35 using wallpaper::WallpaperLayout; | 36 using wallpaper::WallpaperLayout; |
36 using wallpaper::WALLPAPER_LAYOUT_CENTER; | 37 using wallpaper::WALLPAPER_LAYOUT_CENTER; |
37 using wallpaper::WALLPAPER_LAYOUT_CENTER_CROPPED; | 38 using wallpaper::WALLPAPER_LAYOUT_CENTER_CROPPED; |
38 using wallpaper::WALLPAPER_LAYOUT_STRETCH; | 39 using wallpaper::WALLPAPER_LAYOUT_STRETCH; |
39 using wallpaper::WALLPAPER_LAYOUT_TILE; | 40 using wallpaper::WALLPAPER_LAYOUT_TILE; |
40 | 41 |
41 namespace ash { | 42 namespace ash { |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 UpdateWallpaper(true /* clear cache */); | 156 UpdateWallpaper(true /* clear cache */); |
156 } | 157 } |
157 | 158 |
158 InstallDesktopController(root_window); | 159 InstallDesktopController(root_window); |
159 } | 160 } |
160 | 161 |
161 // static | 162 // static |
162 gfx::Size DesktopBackgroundController::GetMaxDisplaySizeInNative() { | 163 gfx::Size DesktopBackgroundController::GetMaxDisplaySizeInNative() { |
163 int width = 0; | 164 int width = 0; |
164 int height = 0; | 165 int height = 0; |
165 std::vector<gfx::Display> displays = Shell::GetScreen()->GetAllDisplays(); | 166 std::vector<gfx::Display> displays = |
| 167 gfx::Screen::GetScreen()->GetAllDisplays(); |
166 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 168 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
167 | 169 |
168 for (std::vector<gfx::Display>::iterator iter = displays.begin(); | 170 for (std::vector<gfx::Display>::iterator iter = displays.begin(); |
169 iter != displays.end(); ++iter) { | 171 iter != displays.end(); ++iter) { |
170 // 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. |
171 gfx::Size size_in_pixel = | 173 gfx::Size size_in_pixel = |
172 display_manager->GetDisplayInfo(iter->id()).bounds_in_native().size(); | 174 display_manager->GetDisplayInfo(iter->id()).bounds_in_native().size(); |
173 if (iter->rotation() == gfx::Display::ROTATE_90 || | 175 if (iter->rotation() == gfx::Display::ROTATE_90 || |
174 iter->rotation() == gfx::Display::ROTATE_270) { | 176 iter->rotation() == gfx::Display::ROTATE_270) { |
175 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()); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 : kShellWindowId_DesktopBackgroundContainer; | 276 : kShellWindowId_DesktopBackgroundContainer; |
275 } | 277 } |
276 | 278 |
277 void DesktopBackgroundController::UpdateWallpaper(bool clear_cache) { | 279 void DesktopBackgroundController::UpdateWallpaper(bool clear_cache) { |
278 current_wallpaper_.reset(NULL); | 280 current_wallpaper_.reset(NULL); |
279 ash::Shell::GetInstance()->user_wallpaper_delegate()->UpdateWallpaper( | 281 ash::Shell::GetInstance()->user_wallpaper_delegate()->UpdateWallpaper( |
280 clear_cache); | 282 clear_cache); |
281 } | 283 } |
282 | 284 |
283 } // namespace ash | 285 } // namespace ash |
OLD | NEW |