| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "chrome/browser/chromeos/background/ash_user_wallpaper_delegate.h" | 5 #include "chrome/browser/chromeos/background/ash_wallpaper_delegate.h" |
| 6 | 6 |
| 7 #include "ash/common/wallpaper/wallpaper_delegate.h" |
| 7 #include "ash/common/wm/window_animation_types.h" | 8 #include "ash/common/wm/window_animation_types.h" |
| 8 #include "ash/desktop_background/user_wallpaper_delegate.h" | |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/wm/window_animations.h" | 10 #include "ash/wm/window_animations.h" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "chrome/browser/chrome_notification_types.h" | 14 #include "chrome/browser/chrome_notification_types.h" |
| 15 #include "chrome/browser/chromeos/extensions/wallpaper_manager_util.h" | 15 #include "chrome/browser/chromeos/extensions/wallpaper_manager_util.h" |
| 16 #include "chrome/browser/chromeos/login/startup_utils.h" | 16 #include "chrome/browser/chromeos/login/startup_utils.h" |
| 17 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" | 17 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" |
| 18 #include "chrome/browser/chromeos/login/wizard_controller.h" | 18 #include "chrome/browser/chromeos/login/wizard_controller.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 32 switches::kFirstExecAfterBoot) || | 32 switches::kFirstExecAfterBoot) || |
| 33 WizardController::IsZeroDelayEnabled() || | 33 WizardController::IsZeroDelayEnabled() || |
| 34 !base::CommandLine::ForCurrentProcess()->HasSwitch( | 34 !base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 35 switches::kLoginManager)) { | 35 switches::kLoginManager)) { |
| 36 return true; | 36 return true; |
| 37 } | 37 } |
| 38 | 38 |
| 39 return false; | 39 return false; |
| 40 } | 40 } |
| 41 | 41 |
| 42 class UserWallpaperDelegate : public ash::UserWallpaperDelegate { | 42 class WallpaperDelegate : public ash::WallpaperDelegate { |
| 43 public: | 43 public: |
| 44 UserWallpaperDelegate() | 44 WallpaperDelegate() |
| 45 : boot_animation_finished_(false), | 45 : boot_animation_finished_(false), |
| 46 animation_duration_override_in_ms_(0) { | 46 animation_duration_override_in_ms_(0) {} |
| 47 } | |
| 48 | 47 |
| 49 ~UserWallpaperDelegate() override {} | 48 ~WallpaperDelegate() override {} |
| 50 | 49 |
| 51 int GetAnimationType() override { | 50 int GetAnimationType() override { |
| 52 return ShouldShowInitialAnimation() | 51 return ShouldShowInitialAnimation() |
| 53 ? ash::wm::WINDOW_VISIBILITY_ANIMATION_TYPE_BRIGHTNESS_GRAYSCALE | 52 ? ash::wm::WINDOW_VISIBILITY_ANIMATION_TYPE_BRIGHTNESS_GRAYSCALE |
| 54 : static_cast<int>(::wm::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE); | 53 : static_cast<int>(::wm::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE); |
| 55 } | 54 } |
| 56 | 55 |
| 57 int GetAnimationDurationOverride() override { | 56 int GetAnimationDurationOverride() override { |
| 58 return animation_duration_override_in_ms_; | 57 return animation_duration_override_in_ms_; |
| 59 } | 58 } |
| 60 | 59 |
| 61 void SetAnimationDurationOverride(int animation_duration_in_ms) override { | 60 void SetAnimationDurationOverride(int animation_duration_in_ms) override { |
| 62 animation_duration_override_in_ms_ = animation_duration_in_ms; | 61 animation_duration_override_in_ms_ = animation_duration_in_ms; |
| 63 } | 62 } |
| 64 | 63 |
| 65 bool ShouldShowInitialAnimation() override { | 64 bool ShouldShowInitialAnimation() override { |
| 66 if (IsNormalWallpaperChange() || boot_animation_finished_) | 65 if (IsNormalWallpaperChange() || boot_animation_finished_) |
| 67 return false; | 66 return false; |
| 68 | 67 |
| 69 // It is a first boot case now. If kDisableBootAnimation flag | 68 // It is a first boot case now. If kDisableBootAnimation flag |
| 70 // is passed, it only disables any transition after OOBE. | 69 // is passed, it only disables any transition after OOBE. |
| 71 bool is_registered = StartupUtils::IsDeviceRegistered(); | 70 bool is_registered = StartupUtils::IsDeviceRegistered(); |
| 72 const base::CommandLine* command_line = | 71 const base::CommandLine* command_line = |
| 73 base::CommandLine::ForCurrentProcess(); | 72 base::CommandLine::ForCurrentProcess(); |
| 74 bool disable_boot_animation = command_line-> | 73 bool disable_boot_animation = |
| 75 HasSwitch(switches::kDisableBootAnimation); | 74 command_line->HasSwitch(switches::kDisableBootAnimation); |
| 76 if (is_registered && disable_boot_animation) | 75 if (is_registered && disable_boot_animation) |
| 77 return false; | 76 return false; |
| 78 | 77 |
| 79 return true; | 78 return true; |
| 80 } | 79 } |
| 81 | 80 |
| 82 void UpdateWallpaper(bool clear_cache) override { | 81 void UpdateWallpaper(bool clear_cache) override { |
| 83 chromeos::WallpaperManager::Get()->UpdateWallpaper(clear_cache); | 82 chromeos::WallpaperManager::Get()->UpdateWallpaper(clear_cache); |
| 84 } | 83 } |
| 85 | 84 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 // Make sure that boot animation type is used only once. | 127 // Make sure that boot animation type is used only once. |
| 129 boot_animation_finished_ = true; | 128 boot_animation_finished_ = true; |
| 130 } | 129 } |
| 131 | 130 |
| 132 private: | 131 private: |
| 133 bool boot_animation_finished_; | 132 bool boot_animation_finished_; |
| 134 | 133 |
| 135 // The animation duration to show a new wallpaper if an animation is required. | 134 // The animation duration to show a new wallpaper if an animation is required. |
| 136 int animation_duration_override_in_ms_; | 135 int animation_duration_override_in_ms_; |
| 137 | 136 |
| 138 DISALLOW_COPY_AND_ASSIGN(UserWallpaperDelegate); | 137 DISALLOW_COPY_AND_ASSIGN(WallpaperDelegate); |
| 139 }; | 138 }; |
| 140 | 139 |
| 141 } // namespace | 140 } // namespace |
| 142 | 141 |
| 143 ash::UserWallpaperDelegate* CreateUserWallpaperDelegate() { | 142 ash::WallpaperDelegate* CreateWallpaperDelegate() { |
| 144 return new chromeos::UserWallpaperDelegate(); | 143 return new chromeos::WallpaperDelegate(); |
| 145 } | 144 } |
| 146 | 145 |
| 147 } // namespace chromeos | 146 } // namespace chromeos |
| OLD | NEW |