Chromium Code Reviews| 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/desktop_background_controller.h" | 8 #include "ash/desktop_background/desktop_background_controller.h" |
| 9 #include "ash/desktop_background/desktop_background_resources.h" | 9 #include "ash/desktop_background/desktop_background_resources.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 "chrome/browser/chromeos/extensions/wallpaper_manager_util.h" | 13 #include "chrome/browser/chromeos/extensions/wallpaper_manager_util.h" |
| 14 #include "chrome/browser/chromeos/login/user_manager.h" | 14 #include "chrome/browser/chromeos/login/user_manager.h" |
| 15 #include "chrome/browser/chromeos/login/wizard_controller.h" | 15 #include "chrome/browser/chromeos/login/wizard_controller.h" |
| 16 #include "chrome/browser/profiles/profile_manager.h" | 16 #include "chrome/browser/profiles/profile_manager.h" |
| 17 #include "chrome/browser/ui/browser.h" | 17 #include "chrome/browser/ui/browser.h" |
| 18 #include "chrome/browser/ui/browser_finder.h" | 18 #include "chrome/browser/ui/browser_finder.h" |
| 19 #include "chrome/browser/ui/chrome_pages.h" | 19 #include "chrome/browser/ui/chrome_pages.h" |
| 20 #include "chrome/common/chrome_notification_types.h" | 20 #include "chrome/common/chrome_notification_types.h" |
| 21 #include "chrome/common/chrome_switches.h" | 21 #include "chrome/common/chrome_switches.h" |
| 22 #include "content/public/browser/notification_service.h" | 22 #include "content/public/browser/notification_service.h" |
| 23 | 23 |
| 24 namespace chromeos { | 24 namespace chromeos { |
| 25 | 25 |
| 26 namespace { | 26 namespace { |
| 27 | 27 |
| 28 class UserWallpaperDelegate: public ash::UserWallpaperDelegate { | 28 class UserWallpaperDelegate: public ash::UserWallpaperDelegate { |
|
Ivan Korotkov
2012/07/31 22:20:26
space before :
Nikita (slow)
2012/08/01 02:09:06
Done.
| |
| 29 public: | 29 public: |
| 30 UserWallpaperDelegate() { | 30 UserWallpaperDelegate() : boot_animation_finished_(false) { |
| 31 } | 31 } |
| 32 | 32 |
| 33 virtual ~UserWallpaperDelegate() { | 33 virtual ~UserWallpaperDelegate() { |
| 34 } | 34 } |
| 35 | 35 |
| 36 virtual ash::WindowVisibilityAnimationType GetAnimationType() OVERRIDE { | 36 virtual ash::WindowVisibilityAnimationType GetAnimationType() OVERRIDE { |
| 37 if (CommandLine::ForCurrentProcess()->HasSwitch( | 37 if (chromeos::UserManager::Get()->IsUserLoggedIn() || |
| 38 boot_animation_finished_ || | |
| 39 CommandLine::ForCurrentProcess()->HasSwitch( | |
| 38 switches::kDisableNewOobe) || | 40 switches::kDisableNewOobe) || |
| 39 WizardController::IsZeroDelayEnabled()) { | 41 WizardController::IsZeroDelayEnabled()) { |
| 40 return ash::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE; | 42 return ash::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE; |
| 41 } | 43 } |
| 42 | 44 |
| 43 bool is_registered = WizardController::IsDeviceRegistered(); | 45 bool is_registered = WizardController::IsDeviceRegistered(); |
| 44 // TODO(nkostylev): Figure out whether this would affect autotests as well. | 46 // TODO(nkostylev): Figure out whether this would affect autotests as well. |
| 45 if (is_registered) | 47 bool disable_boot_animation = |
|
Ivan Korotkov
2012/07/31 22:20:26
Do you need a separate variable?
Nikita (slow)
2012/08/01 02:09:06
I think it is a bit more readable this way.
| |
| 48 CommandLine::ForCurrentProcess()-> | |
| 49 HasSwitch(switches::kDisableBootAnimation); | |
| 50 if (is_registered && disable_boot_animation) | |
| 46 return ash::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE; | 51 return ash::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE; |
| 47 else | 52 else |
| 48 return ash::WINDOW_VISIBILITY_ANIMATION_TYPE_BRIGHTNESS_GRAYSCALE; | 53 return ash::WINDOW_VISIBILITY_ANIMATION_TYPE_BRIGHTNESS_GRAYSCALE; |
| 49 } | 54 } |
| 50 | 55 |
| 51 virtual void InitializeWallpaper() OVERRIDE { | 56 virtual void InitializeWallpaper() OVERRIDE { |
| 52 chromeos::UserManager::Get()->InitializeWallpaper(); | 57 chromeos::UserManager::Get()->InitializeWallpaper(); |
| 53 } | 58 } |
| 54 | 59 |
| 55 virtual void OpenSetWallpaperPage() OVERRIDE { | 60 virtual void OpenSetWallpaperPage() OVERRIDE { |
| 56 wallpaper_manager_util::OpenWallpaperManager(); | 61 wallpaper_manager_util::OpenWallpaperManager(); |
| 57 } | 62 } |
| 58 | 63 |
| 59 virtual bool CanOpenSetWallpaperPage() OVERRIDE { | 64 virtual bool CanOpenSetWallpaperPage() OVERRIDE { |
| 60 return !chromeos::UserManager::Get()->IsLoggedInAsGuest(); | 65 return !chromeos::UserManager::Get()->IsLoggedInAsGuest(); |
| 61 } | 66 } |
| 62 | 67 |
| 63 virtual void OnWallpaperAnimationFinished() OVERRIDE { | 68 virtual void OnWallpaperAnimationFinished() OVERRIDE { |
| 64 content::NotificationService::current()->Notify( | 69 content::NotificationService::current()->Notify( |
| 65 chrome::NOTIFICATION_WALLPAPER_ANIMATION_FINISHED, | 70 chrome::NOTIFICATION_WALLPAPER_ANIMATION_FINISHED, |
| 66 content::NotificationService::AllSources(), | 71 content::NotificationService::AllSources(), |
| 67 content::NotificationService::NoDetails()); | 72 content::NotificationService::NoDetails()); |
| 68 } | 73 } |
| 69 | 74 |
| 75 virtual void OnWallpaperBootAnimationFinished() OVERRIDE { | |
| 76 // Setting this variable would make sure that boot animation type | |
|
Ivan Korotkov
2012/07/31 22:20:26
// Make sure that...
Nikita (slow)
2012/08/01 02:09:06
Done.
| |
| 77 // is used only once. | |
| 78 boot_animation_finished_ = true; | |
| 79 } | |
| 80 | |
| 70 private: | 81 private: |
| 82 bool boot_animation_finished_; | |
| 83 | |
| 71 DISALLOW_COPY_AND_ASSIGN(UserWallpaperDelegate); | 84 DISALLOW_COPY_AND_ASSIGN(UserWallpaperDelegate); |
| 72 }; | 85 }; |
| 73 | 86 |
| 74 } // namespace | 87 } // namespace |
| 75 | 88 |
| 76 ash::UserWallpaperDelegate* CreateUserWallpaperDelegate() { | 89 ash::UserWallpaperDelegate* CreateUserWallpaperDelegate() { |
| 77 return new chromeos::UserWallpaperDelegate(); | 90 return new chromeos::UserWallpaperDelegate(); |
| 78 } | 91 } |
| 79 | 92 |
| 80 } // namespace chromeos | 93 } // namespace chromeos |
| OLD | NEW |