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/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/wm_shell.h" | 9 #include "ash/common/wm_shell.h" |
11 #include "ash/desktop_background/desktop_background_controller_observer.h" | 10 #include "ash/desktop_background/desktop_background_controller_observer.h" |
12 #include "ash/desktop_background/desktop_background_view.h" | 11 #include "ash/desktop_background/desktop_background_view.h" |
13 #include "ash/desktop_background/desktop_background_widget_controller.h" | 12 #include "ash/desktop_background/desktop_background_widget_controller.h" |
14 #include "ash/desktop_background/user_wallpaper_delegate.h" | 13 #include "ash/desktop_background/user_wallpaper_delegate.h" |
15 #include "ash/root_window_controller.h" | 14 #include "ash/root_window_controller.h" |
16 #include "ash/shell.h" | 15 #include "ash/shell.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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 gfx::Size DesktopBackgroundController::GetMaxDisplaySizeInNative() { | 147 gfx::Size DesktopBackgroundController::GetMaxDisplaySizeInNative() { |
148 // Return an empty size for test environments where the screen is null. | 148 // Return an empty size for test environments where the screen is null. |
149 if (!display::Screen::GetScreen()) | 149 if (!display::Screen::GetScreen()) |
150 return gfx::Size(); | 150 return gfx::Size(); |
151 | 151 |
152 // Note that |shell| is null when this is called from Chrome running in Mash. | 152 // Note that |shell| is null when this is called from Chrome running in Mash. |
153 WmShell* shell = WmShell::Get(); | 153 WmShell* shell = WmShell::Get(); |
154 | 154 |
155 gfx::Size max; | 155 gfx::Size max; |
156 for (const auto& display : display::Screen::GetScreen()->GetAllDisplays()) { | 156 for (const auto& display : display::Screen::GetScreen()->GetAllDisplays()) { |
157 // Use the native size, not DisplayInfo::size_in_pixel or Display::size. | 157 // Use the native size, not ManagedDisplayInfo::size_in_pixel or |
| 158 // Display::size. |
158 // TODO(msw): Avoid using Display::size here; see http://crbug.com/613657. | 159 // TODO(msw): Avoid using Display::size here; see http://crbug.com/613657. |
159 gfx::Size size = display.size(); | 160 gfx::Size size = display.size(); |
160 if (shell) | 161 if (shell) |
161 size = shell->GetDisplayInfo(display.id()).bounds_in_native().size(); | 162 size = shell->GetDisplayInfo(display.id()).bounds_in_native().size(); |
162 if (display.rotation() == display::Display::ROTATE_90 || | 163 if (display.rotation() == display::Display::ROTATE_90 || |
163 display.rotation() == display::Display::ROTATE_270) { | 164 display.rotation() == display::Display::ROTATE_270) { |
164 size = gfx::Size(size.height(), size.width()); | 165 size = gfx::Size(size.height(), size.width()); |
165 } | 166 } |
166 max.SetToMax(size); | 167 max.SetToMax(size); |
167 } | 168 } |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 return locked ? kShellWindowId_LockScreenBackgroundContainer | 250 return locked ? kShellWindowId_LockScreenBackgroundContainer |
250 : kShellWindowId_DesktopBackgroundContainer; | 251 : kShellWindowId_DesktopBackgroundContainer; |
251 } | 252 } |
252 | 253 |
253 void DesktopBackgroundController::UpdateWallpaper(bool clear_cache) { | 254 void DesktopBackgroundController::UpdateWallpaper(bool clear_cache) { |
254 current_wallpaper_.reset(); | 255 current_wallpaper_.reset(); |
255 Shell::GetInstance()->user_wallpaper_delegate()->UpdateWallpaper(clear_cache); | 256 Shell::GetInstance()->user_wallpaper_delegate()->UpdateWallpaper(clear_cache); |
256 } | 257 } |
257 | 258 |
258 } // namespace ash | 259 } // namespace ash |
OLD | NEW |