| 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/common/wallpaper/wallpaper_controller.h" | 5 #include "ash/common/wallpaper/wallpaper_controller.h" |
| 6 | 6 |
| 7 #include "ash/common/shell_delegate.h" | 7 #include "ash/common/shell_delegate.h" |
| 8 #include "ash/common/wallpaper/wallpaper_controller_observer.h" | 8 #include "ash/common/wallpaper/wallpaper_controller_observer.h" |
| 9 #include "ash/common/wallpaper/wallpaper_delegate.h" | 9 #include "ash/common/wallpaper/wallpaper_delegate.h" |
| 10 #include "ash/common/wallpaper/wallpaper_view.h" | 10 #include "ash/common/wallpaper/wallpaper_view.h" |
| 11 #include "ash/common/wallpaper/wallpaper_widget_controller.h" | 11 #include "ash/common/wallpaper/wallpaper_widget_controller.h" |
| 12 #include "ash/common/wm_root_window_controller.h" | 12 #include "ash/common/wm_root_window_controller.h" |
| 13 #include "ash/common/wm_shell.h" | 13 #include "ash/common/wm_shell.h" |
| 14 #include "ash/common/wm_window.h" | 14 #include "ash/common/wm_window.h" |
| 15 #include "ash/public/cpp/shell_window_ids.h" | 15 #include "ash/public/cpp/shell_window_ids.h" |
| 16 #include "base/bind.h" | 16 #include "base/bind.h" |
| 17 #include "base/logging.h" | 17 #include "base/logging.h" |
| 18 #include "base/task_runner.h" | 18 #include "base/task_runner.h" |
| 19 #include "components/wallpaper/wallpaper_resizer.h" | 19 #include "components/wallpaper/wallpaper_resizer.h" |
| 20 #include "content/public/common/service_names.mojom.h" |
| 20 #include "services/service_manager/public/cpp/connector.h" | 21 #include "services/service_manager/public/cpp/connector.h" |
| 21 #include "ui/display/manager/managed_display_info.h" | 22 #include "ui/display/manager/managed_display_info.h" |
| 22 #include "ui/display/screen.h" | 23 #include "ui/display/screen.h" |
| 23 #include "ui/views/widget/widget.h" | 24 #include "ui/views/widget/widget.h" |
| 24 | 25 |
| 25 namespace ash { | 26 namespace ash { |
| 26 namespace { | 27 namespace { |
| 27 | 28 |
| 28 // How long to wait reloading the wallpaper after the display size has changed. | 29 // How long to wait reloading the wallpaper after the display size has changed. |
| 29 const int kWallpaperReloadDelayMs = 100; | 30 const int kWallpaperReloadDelayMs = 100; |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 } | 191 } |
| 191 | 192 |
| 192 void WallpaperController::OpenSetWallpaperPage() { | 193 void WallpaperController::OpenSetWallpaperPage() { |
| 193 WmShell* shell = WmShell::Get(); | 194 WmShell* shell = WmShell::Get(); |
| 194 service_manager::Connector* connector = | 195 service_manager::Connector* connector = |
| 195 shell->delegate()->GetShellConnector(); | 196 shell->delegate()->GetShellConnector(); |
| 196 if (!connector || !shell->wallpaper_delegate()->CanOpenSetWallpaperPage()) | 197 if (!connector || !shell->wallpaper_delegate()->CanOpenSetWallpaperPage()) |
| 197 return; | 198 return; |
| 198 | 199 |
| 199 mojom::WallpaperManagerPtr wallpaper_manager; | 200 mojom::WallpaperManagerPtr wallpaper_manager; |
| 200 connector->ConnectToInterface("content_browser", &wallpaper_manager); | 201 connector->ConnectToInterface(content::mojom::kBrowserServiceName, |
| 202 &wallpaper_manager); |
| 201 wallpaper_manager->Open(); | 203 wallpaper_manager->Open(); |
| 202 } | 204 } |
| 203 | 205 |
| 204 void WallpaperController::SetWallpaper(const SkBitmap& wallpaper, | 206 void WallpaperController::SetWallpaper(const SkBitmap& wallpaper, |
| 205 wallpaper::WallpaperLayout layout) { | 207 wallpaper::WallpaperLayout layout) { |
| 206 if (wallpaper.isNull()) | 208 if (wallpaper.isNull()) |
| 207 return; | 209 return; |
| 208 | 210 |
| 209 SetWallpaperImage(gfx::ImageSkia::CreateFrom1xBitmap(wallpaper), layout); | 211 SetWallpaperImage(gfx::ImageSkia::CreateFrom1xBitmap(wallpaper), layout); |
| 210 } | 212 } |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 return locked ? kShellWindowId_LockScreenWallpaperContainer | 273 return locked ? kShellWindowId_LockScreenWallpaperContainer |
| 272 : kShellWindowId_WallpaperContainer; | 274 : kShellWindowId_WallpaperContainer; |
| 273 } | 275 } |
| 274 | 276 |
| 275 void WallpaperController::UpdateWallpaper(bool clear_cache) { | 277 void WallpaperController::UpdateWallpaper(bool clear_cache) { |
| 276 current_wallpaper_.reset(); | 278 current_wallpaper_.reset(); |
| 277 WmShell::Get()->wallpaper_delegate()->UpdateWallpaper(clear_cache); | 279 WmShell::Get()->wallpaper_delegate()->UpdateWallpaper(clear_cache); |
| 278 } | 280 } |
| 279 | 281 |
| 280 } // namespace ash | 282 } // namespace ash |
| OLD | NEW |