| 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 "chrome/browser/chromeos/background/ash_user_wallpaper_delegate.h" | 5 #include "chrome/browser/chromeos/background/ash_user_wallpaper_delegate.h" |
| 6 | 6 |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/desktop_background/user_wallpaper_delegate.h" | 8 #include "ash/desktop_background/user_wallpaper_delegate.h" |
| 9 #include "ash/wm/window_animations.h" | 9 #include "ash/wm/window_animations.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 WizardController::IsZeroDelayEnabled() || | 33 WizardController::IsZeroDelayEnabled() || |
| 34 !CommandLine::ForCurrentProcess()->HasSwitch(switches::kLoginManager)) { | 34 !CommandLine::ForCurrentProcess()->HasSwitch(switches::kLoginManager)) { |
| 35 return true; | 35 return true; |
| 36 } | 36 } |
| 37 | 37 |
| 38 return false; | 38 return false; |
| 39 } | 39 } |
| 40 | 40 |
| 41 class UserWallpaperDelegate : public ash::UserWallpaperDelegate { | 41 class UserWallpaperDelegate : public ash::UserWallpaperDelegate { |
| 42 public: | 42 public: |
| 43 UserWallpaperDelegate() : boot_animation_finished_(false) { | 43 UserWallpaperDelegate() |
| 44 : boot_animation_finished_(false), |
| 45 animation_duration_override_in_ms_(0) { |
| 44 } | 46 } |
| 45 | 47 |
| 46 virtual ~UserWallpaperDelegate() { | 48 virtual ~UserWallpaperDelegate() { |
| 47 } | 49 } |
| 48 | 50 |
| 49 virtual int GetAnimationType() OVERRIDE { | 51 virtual int GetAnimationType() OVERRIDE { |
| 50 return ShouldShowInitialAnimation() ? | 52 return ShouldShowInitialAnimation() ? |
| 51 ash::WINDOW_VISIBILITY_ANIMATION_TYPE_BRIGHTNESS_GRAYSCALE : | 53 ash::WINDOW_VISIBILITY_ANIMATION_TYPE_BRIGHTNESS_GRAYSCALE : |
| 52 static_cast<int>(views::corewm::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE); | 54 static_cast<int>(views::corewm::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE); |
| 53 } | 55 } |
| 54 | 56 |
| 57 virtual int GetAnimationDurationOverride() OVERRIDE { |
| 58 return animation_duration_override_in_ms_; |
| 59 } |
| 60 |
| 61 virtual void SetAnimationDurationOverride( |
| 62 int animation_duration_in_ms) OVERRIDE { |
| 63 animation_duration_override_in_ms_ = animation_duration_in_ms; |
| 64 } |
| 65 |
| 55 virtual bool ShouldShowInitialAnimation() OVERRIDE { | 66 virtual bool ShouldShowInitialAnimation() OVERRIDE { |
| 56 if (IsNormalWallpaperChange() || boot_animation_finished_) | 67 if (IsNormalWallpaperChange() || boot_animation_finished_) |
| 57 return false; | 68 return false; |
| 58 | 69 |
| 59 // It is a first boot case now. If kDisableBootAnimation flag | 70 // It is a first boot case now. If kDisableBootAnimation flag |
| 60 // is passed, it only disables any transition after OOBE. | 71 // is passed, it only disables any transition after OOBE. |
| 61 // |kDisableOobeAnimation| disables OOBE animation for slow hardware. | 72 // |kDisableOobeAnimation| disables OOBE animation for slow hardware. |
| 62 bool is_registered = StartupUtils::IsDeviceRegistered(); | 73 bool is_registered = StartupUtils::IsDeviceRegistered(); |
| 63 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 74 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 64 bool disable_boot_animation = command_line-> | 75 bool disable_boot_animation = command_line-> |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 } | 107 } |
| 97 | 108 |
| 98 virtual void OnWallpaperBootAnimationFinished() OVERRIDE { | 109 virtual void OnWallpaperBootAnimationFinished() OVERRIDE { |
| 99 // Make sure that boot animation type is used only once. | 110 // Make sure that boot animation type is used only once. |
| 100 boot_animation_finished_ = true; | 111 boot_animation_finished_ = true; |
| 101 } | 112 } |
| 102 | 113 |
| 103 private: | 114 private: |
| 104 bool boot_animation_finished_; | 115 bool boot_animation_finished_; |
| 105 | 116 |
| 117 // The animation duration to show a new wallpaper if an animation is required. |
| 118 int animation_duration_override_in_ms_; |
| 119 |
| 106 DISALLOW_COPY_AND_ASSIGN(UserWallpaperDelegate); | 120 DISALLOW_COPY_AND_ASSIGN(UserWallpaperDelegate); |
| 107 }; | 121 }; |
| 108 | 122 |
| 109 } // namespace | 123 } // namespace |
| 110 | 124 |
| 111 ash::UserWallpaperDelegate* CreateUserWallpaperDelegate() { | 125 ash::UserWallpaperDelegate* CreateUserWallpaperDelegate() { |
| 112 return new chromeos::UserWallpaperDelegate(); | 126 return new chromeos::UserWallpaperDelegate(); |
| 113 } | 127 } |
| 114 | 128 |
| 115 } // namespace chromeos | 129 } // namespace chromeos |
| OLD | NEW |