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/wallpaper/wallpaper_controller.h" | 5 #include "ash/wallpaper/wallpaper_controller.h" |
6 | 6 |
7 #include "ash/aura/wm_window_aura.h" | 7 #include "ash/aura/wm_window_aura.h" |
8 #include "ash/common/display/display_info.h" | |
9 #include "ash/common/shell_window_ids.h" | 8 #include "ash/common/shell_window_ids.h" |
10 #include "ash/common/wallpaper/wallpaper_delegate.h" | 9 #include "ash/common/wallpaper/wallpaper_delegate.h" |
11 #include "ash/common/wm_shell.h" | 10 #include "ash/common/wm_shell.h" |
12 #include "ash/root_window_controller.h" | 11 #include "ash/root_window_controller.h" |
13 #include "ash/shell.h" | 12 #include "ash/shell.h" |
14 #include "ash/wallpaper/wallpaper_controller_observer.h" | 13 #include "ash/wallpaper/wallpaper_controller_observer.h" |
15 #include "ash/wallpaper/wallpaper_view.h" | 14 #include "ash/wallpaper/wallpaper_view.h" |
16 #include "ash/wallpaper/wallpaper_widget_controller.h" | 15 #include "ash/wallpaper/wallpaper_widget_controller.h" |
17 #include "base/bind.h" | 16 #include "base/bind.h" |
18 #include "base/logging.h" | 17 #include "base/logging.h" |
19 #include "base/threading/sequenced_worker_pool.h" | 18 #include "base/threading/sequenced_worker_pool.h" |
20 #include "components/wallpaper/wallpaper_resizer.h" | 19 #include "components/wallpaper/wallpaper_resizer.h" |
21 #include "ui/aura/window.h" | 20 #include "ui/aura/window.h" |
| 21 #include "ui/display/manager/managed_display_info.h" |
22 #include "ui/display/screen.h" | 22 #include "ui/display/screen.h" |
23 #include "ui/views/widget/widget.h" | 23 #include "ui/views/widget/widget.h" |
24 | 24 |
25 namespace ash { | 25 namespace ash { |
26 namespace { | 26 namespace { |
27 | 27 |
28 // How long to wait reloading the wallpaper after the display size has changed. | 28 // How long to wait reloading the wallpaper after the display size has changed. |
29 const int kWallpaperReloadDelayMs = 100; | 29 const int kWallpaperReloadDelayMs = 100; |
30 | 30 |
31 } // namespace | 31 } // namespace |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 gfx::Size WallpaperController::GetMaxDisplaySizeInNative() { | 142 gfx::Size WallpaperController::GetMaxDisplaySizeInNative() { |
143 // Return an empty size for test environments where the screen is null. | 143 // Return an empty size for test environments where the screen is null. |
144 if (!display::Screen::GetScreen()) | 144 if (!display::Screen::GetScreen()) |
145 return gfx::Size(); | 145 return gfx::Size(); |
146 | 146 |
147 // Note that |shell| is null when this is called from Chrome running in Mash. | 147 // Note that |shell| is null when this is called from Chrome running in Mash. |
148 WmShell* shell = WmShell::Get(); | 148 WmShell* shell = WmShell::Get(); |
149 | 149 |
150 gfx::Size max; | 150 gfx::Size max; |
151 for (const auto& display : display::Screen::GetScreen()->GetAllDisplays()) { | 151 for (const auto& display : display::Screen::GetScreen()->GetAllDisplays()) { |
152 // Use the native size, not DisplayInfo::size_in_pixel or Display::size. | 152 // Use the native size, not ManagedDisplayInfo::size_in_pixel or |
| 153 // Display::size. |
153 // TODO(msw): Avoid using Display::size here; see http://crbug.com/613657. | 154 // TODO(msw): Avoid using Display::size here; see http://crbug.com/613657. |
154 gfx::Size size = display.size(); | 155 gfx::Size size = display.size(); |
155 if (shell) | 156 if (shell) |
156 size = shell->GetDisplayInfo(display.id()).bounds_in_native().size(); | 157 size = shell->GetDisplayInfo(display.id()).bounds_in_native().size(); |
157 if (display.rotation() == display::Display::ROTATE_90 || | 158 if (display.rotation() == display::Display::ROTATE_90 || |
158 display.rotation() == display::Display::ROTATE_270) { | 159 display.rotation() == display::Display::ROTATE_270) { |
159 size = gfx::Size(size.height(), size.width()); | 160 size = gfx::Size(size.height(), size.width()); |
160 } | 161 } |
161 max.SetToMax(size); | 162 max.SetToMax(size); |
162 } | 163 } |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 return locked ? kShellWindowId_LockScreenWallpaperContainer | 241 return locked ? kShellWindowId_LockScreenWallpaperContainer |
241 : kShellWindowId_WallpaperContainer; | 242 : kShellWindowId_WallpaperContainer; |
242 } | 243 } |
243 | 244 |
244 void WallpaperController::UpdateWallpaper(bool clear_cache) { | 245 void WallpaperController::UpdateWallpaper(bool clear_cache) { |
245 current_wallpaper_.reset(); | 246 current_wallpaper_.reset(); |
246 WmShell::Get()->wallpaper_delegate()->UpdateWallpaper(clear_cache); | 247 WmShell::Get()->wallpaper_delegate()->UpdateWallpaper(clear_cache); |
247 } | 248 } |
248 | 249 |
249 } // namespace ash | 250 } // namespace ash |
OLD | NEW |