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 { |
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() || |
Ben Goodger (Google)
2012/08/02 15:38:39
It's becoming hard to discern the intent of this f
Nikita (slow)
2012/08/02 17:58:57
Done.
| |
38 boot_animation_finished_ || | |
39 CommandLine::ForCurrentProcess()->HasSwitch( | |
38 switches::kDisableNewOobe) || | 40 switches::kDisableNewOobe) || |
39 WizardController::IsZeroDelayEnabled()) { | 41 WizardController::IsZeroDelayEnabled() || |
42 !CommandLine::ForCurrentProcess()->HasSwitch( | |
43 switches::kLoginManager)) { | |
40 return ash::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE; | 44 return ash::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE; |
41 } | 45 } |
42 | 46 |
43 bool is_registered = WizardController::IsDeviceRegistered(); | 47 bool is_registered = WizardController::IsDeviceRegistered(); |
44 // TODO(nkostylev): Figure out whether this would affect autotests as well. | 48 bool disable_boot_animation = |
45 if (is_registered) | 49 CommandLine::ForCurrentProcess()-> |
50 HasSwitch(switches::kDisableBootAnimation); | |
51 if (is_registered && disable_boot_animation) | |
46 return ash::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE; | 52 return ash::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE; |
47 else | 53 else |
48 return ash::WINDOW_VISIBILITY_ANIMATION_TYPE_BRIGHTNESS_GRAYSCALE; | 54 return ash::WINDOW_VISIBILITY_ANIMATION_TYPE_BRIGHTNESS_GRAYSCALE; |
Ben Goodger (Google)
2012/08/02 15:38:39
no else after return.
Nikita (slow)
2012/08/02 17:58:57
Done.
| |
49 } | 55 } |
50 | 56 |
51 virtual void InitializeWallpaper() OVERRIDE { | 57 virtual void InitializeWallpaper() OVERRIDE { |
52 chromeos::UserManager::Get()->InitializeWallpaper(); | 58 chromeos::UserManager::Get()->InitializeWallpaper(); |
53 } | 59 } |
54 | 60 |
55 virtual void OpenSetWallpaperPage() OVERRIDE { | 61 virtual void OpenSetWallpaperPage() OVERRIDE { |
56 wallpaper_manager_util::OpenWallpaperManager(); | 62 wallpaper_manager_util::OpenWallpaperManager(); |
57 } | 63 } |
58 | 64 |
59 virtual bool CanOpenSetWallpaperPage() OVERRIDE { | 65 virtual bool CanOpenSetWallpaperPage() OVERRIDE { |
60 return !chromeos::UserManager::Get()->IsLoggedInAsGuest(); | 66 return !chromeos::UserManager::Get()->IsLoggedInAsGuest(); |
61 } | 67 } |
62 | 68 |
63 virtual void OnWallpaperAnimationFinished() OVERRIDE { | 69 virtual void OnWallpaperAnimationFinished() OVERRIDE { |
64 content::NotificationService::current()->Notify( | 70 content::NotificationService::current()->Notify( |
65 chrome::NOTIFICATION_WALLPAPER_ANIMATION_FINISHED, | 71 chrome::NOTIFICATION_WALLPAPER_ANIMATION_FINISHED, |
66 content::NotificationService::AllSources(), | 72 content::NotificationService::AllSources(), |
67 content::NotificationService::NoDetails()); | 73 content::NotificationService::NoDetails()); |
68 } | 74 } |
69 | 75 |
76 virtual void OnWallpaperBootAnimationFinished() OVERRIDE { | |
77 // Make sure that boot animation type 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 |