| 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 <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
| 11 #include "ash/public/cpp/shell_window_ids.h" | 11 #include "ash/public/cpp/shell_window_ids.h" |
| 12 #include "ash/root_window_controller.h" | 12 #include "ash/root_window_controller.h" |
| 13 #include "ash/rotator/screen_rotation_animator_lock.h" |
| 13 #include "ash/session/session_controller.h" | 14 #include "ash/session/session_controller.h" |
| 14 #include "ash/shell.h" | 15 #include "ash/shell.h" |
| 15 #include "ash/shell_port.h" | 16 #include "ash/shell_port.h" |
| 16 #include "ash/wallpaper/wallpaper_controller_observer.h" | 17 #include "ash/wallpaper/wallpaper_controller_observer.h" |
| 17 #include "ash/wallpaper/wallpaper_delegate.h" | 18 #include "ash/wallpaper/wallpaper_delegate.h" |
| 18 #include "ash/wallpaper/wallpaper_view.h" | 19 #include "ash/wallpaper/wallpaper_view.h" |
| 19 #include "ash/wallpaper/wallpaper_widget_controller.h" | 20 #include "ash/wallpaper/wallpaper_widget_controller.h" |
| 20 #include "ash/wm_window.h" | 21 #include "ash/wm_window.h" |
| 21 #include "base/bind.h" | 22 #include "base/bind.h" |
| 22 #include "base/command_line.h" | 23 #include "base/command_line.h" |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 << " layout=" << layout; | 147 << " layout=" << layout; |
| 147 | 148 |
| 148 if (WallpaperIsAlreadyLoaded(image, true /* compare_layouts */, layout)) { | 149 if (WallpaperIsAlreadyLoaded(image, true /* compare_layouts */, layout)) { |
| 149 VLOG(1) << "Wallpaper is already loaded"; | 150 VLOG(1) << "Wallpaper is already loaded"; |
| 150 return; | 151 return; |
| 151 } | 152 } |
| 152 | 153 |
| 153 current_wallpaper_.reset(new wallpaper::WallpaperResizer( | 154 current_wallpaper_.reset(new wallpaper::WallpaperResizer( |
| 154 image, GetMaxDisplaySizeInNative(), layout, task_runner_)); | 155 image, GetMaxDisplaySizeInNative(), layout, task_runner_)); |
| 155 current_wallpaper_->AddObserver(this); | 156 current_wallpaper_->AddObserver(this); |
| 157 if (screen_rotation_animator_lock_) |
| 158 screen_rotation_animator_lock_->lock(); |
| 156 current_wallpaper_->StartResize(); | 159 current_wallpaper_->StartResize(); |
| 157 | 160 |
| 158 for (auto& observer : observers_) | 161 for (auto& observer : observers_) |
| 159 observer.OnWallpaperDataChanged(); | 162 observer.OnWallpaperDataChanged(); |
| 160 wallpaper_mode_ = WALLPAPER_IMAGE; | 163 wallpaper_mode_ = WALLPAPER_IMAGE; |
| 161 InstallDesktopControllerForAllWindows(); | 164 InstallDesktopControllerForAllWindows(); |
| 162 } | 165 } |
| 163 | 166 |
| 164 void WallpaperController::CreateEmptyWallpaper() { | 167 void WallpaperController::CreateEmptyWallpaper() { |
| 165 SetProminentColor(kInvalidColor); | 168 SetProminentColor(kInvalidColor); |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 } | 279 } |
| 277 | 280 |
| 278 void WallpaperController::OnWallpaperResized() { | 281 void WallpaperController::OnWallpaperResized() { |
| 279 CalculateWallpaperColors(); | 282 CalculateWallpaperColors(); |
| 280 } | 283 } |
| 281 | 284 |
| 282 void WallpaperController::OnColorCalculationComplete() { | 285 void WallpaperController::OnColorCalculationComplete() { |
| 283 const SkColor color = color_calculator_->prominent_color(); | 286 const SkColor color = color_calculator_->prominent_color(); |
| 284 color_calculator_.reset(); | 287 color_calculator_.reset(); |
| 285 SetProminentColor(color); | 288 SetProminentColor(color); |
| 289 if (screen_rotation_animator_lock_) |
| 290 screen_rotation_animator_lock_->unlock(); |
| 286 } | 291 } |
| 287 | 292 |
| 288 void WallpaperController::InstallDesktopController(WmWindow* root_window) { | 293 void WallpaperController::InstallDesktopController(WmWindow* root_window) { |
| 289 WallpaperWidgetController* component = nullptr; | 294 WallpaperWidgetController* component = nullptr; |
| 290 int container_id = GetWallpaperContainerId(locked_); | 295 int container_id = GetWallpaperContainerId(locked_); |
| 291 | 296 |
| 292 switch (wallpaper_mode_) { | 297 switch (wallpaper_mode_) { |
| 293 case WALLPAPER_IMAGE: { | 298 case WALLPAPER_IMAGE: { |
| 294 component = new WallpaperWidgetController( | 299 component = new WallpaperWidgetController( |
| 295 CreateWallpaper(root_window, container_id)); | 300 CreateWallpaper(root_window, container_id)); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 | 407 |
| 403 bool WallpaperController::MoveToUnlockedContainer() { | 408 bool WallpaperController::MoveToUnlockedContainer() { |
| 404 if (!locked_) | 409 if (!locked_) |
| 405 return false; | 410 return false; |
| 406 | 411 |
| 407 locked_ = false; | 412 locked_ = false; |
| 408 return ReparentWallpaper(GetWallpaperContainerId(false)); | 413 return ReparentWallpaper(GetWallpaperContainerId(false)); |
| 409 } | 414 } |
| 410 | 415 |
| 411 } // namespace ash | 416 } // namespace ash |
| OLD | NEW |