Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(584)

Side by Side Diff: chrome/browser/chromeos/background/ash_user_wallpaper_delegate.cc

Issue 10834081: Enable wallpaper boot animation for boot into sign in too. Add flag to disable it. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: merge Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/about_flags.cc ('k') | chrome/browser/chromeos/chrome_browser_main_chromeos.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/wallpaper_manager.h" 15 #include "chrome/browser/chromeos/login/wallpaper_manager.h"
16 #include "chrome/browser/chromeos/login/wizard_controller.h" 16 #include "chrome/browser/chromeos/login/wizard_controller.h"
17 #include "chrome/browser/profiles/profile_manager.h" 17 #include "chrome/browser/profiles/profile_manager.h"
18 #include "chrome/browser/ui/browser.h" 18 #include "chrome/browser/ui/browser.h"
19 #include "chrome/browser/ui/browser_finder.h" 19 #include "chrome/browser/ui/browser_finder.h"
20 #include "chrome/browser/ui/chrome_pages.h" 20 #include "chrome/browser/ui/chrome_pages.h"
21 #include "chrome/common/chrome_notification_types.h" 21 #include "chrome/common/chrome_notification_types.h"
22 #include "chrome/common/chrome_switches.h" 22 #include "chrome/common/chrome_switches.h"
23 #include "content/public/browser/notification_service.h" 23 #include "content/public/browser/notification_service.h"
24 24
25 namespace chromeos { 25 namespace chromeos {
26 26
27 namespace { 27 namespace {
28 28
29 class UserWallpaperDelegate: public ash::UserWallpaperDelegate { 29 bool IsNormalWallpaperChange() {
30 if (chromeos::UserManager::Get()->IsUserLoggedIn() ||
31 !CommandLine::ForCurrentProcess()->HasSwitch(switches::kFirstBoot) ||
32 CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableNewOobe) ||
33 WizardController::IsZeroDelayEnabled() ||
34 !CommandLine::ForCurrentProcess()->HasSwitch(switches::kLoginManager)) {
35 return true;
36 }
37
38 return false;
39 }
40
41 class UserWallpaperDelegate : public ash::UserWallpaperDelegate {
30 public: 42 public:
31 UserWallpaperDelegate() { 43 UserWallpaperDelegate() : boot_animation_finished_(false) {
32 } 44 }
33 45
34 virtual ~UserWallpaperDelegate() { 46 virtual ~UserWallpaperDelegate() {
35 } 47 }
36 48
37 virtual ash::WindowVisibilityAnimationType GetAnimationType() OVERRIDE { 49 virtual ash::WindowVisibilityAnimationType GetAnimationType() OVERRIDE {
38 if (CommandLine::ForCurrentProcess()->HasSwitch( 50 if (IsNormalWallpaperChange() || boot_animation_finished_)
39 switches::kDisableNewOobe) ||
40 WizardController::IsZeroDelayEnabled()) {
41 return ash::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE; 51 return ash::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE;
42 }
43 52
53 // It is a first boot case now. If kDisableBootAnimation flag
54 // is passed, it only disables any transition after OOBE.
44 bool is_registered = WizardController::IsDeviceRegistered(); 55 bool is_registered = WizardController::IsDeviceRegistered();
45 // TODO(nkostylev): Figure out whether this would affect autotests as well. 56 bool disable_boot_animation = CommandLine::ForCurrentProcess()->
46 if (is_registered) 57 HasSwitch(switches::kDisableBootAnimation);
58 if (is_registered && disable_boot_animation)
47 return ash::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE; 59 return ash::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE;
48 else 60
49 return ash::WINDOW_VISIBILITY_ANIMATION_TYPE_BRIGHTNESS_GRAYSCALE; 61 return ash::WINDOW_VISIBILITY_ANIMATION_TYPE_BRIGHTNESS_GRAYSCALE;
50 } 62 }
51 63
52 virtual void InitializeWallpaper() OVERRIDE { 64 virtual void InitializeWallpaper() OVERRIDE {
53 chromeos::WallpaperManager::Get()->InitializeWallpaper(); 65 chromeos::WallpaperManager::Get()->InitializeWallpaper();
54 } 66 }
55 67
56 virtual void OpenSetWallpaperPage() OVERRIDE { 68 virtual void OpenSetWallpaperPage() OVERRIDE {
57 wallpaper_manager_util::OpenWallpaperManager(); 69 wallpaper_manager_util::OpenWallpaperManager();
58 } 70 }
59 71
60 virtual bool CanOpenSetWallpaperPage() OVERRIDE { 72 virtual bool CanOpenSetWallpaperPage() OVERRIDE {
61 return !chromeos::UserManager::Get()->IsLoggedInAsGuest(); 73 return !chromeos::UserManager::Get()->IsLoggedInAsGuest();
62 } 74 }
63 75
64 virtual void OnWallpaperAnimationFinished() OVERRIDE { 76 virtual void OnWallpaperAnimationFinished() OVERRIDE {
65 content::NotificationService::current()->Notify( 77 content::NotificationService::current()->Notify(
66 chrome::NOTIFICATION_WALLPAPER_ANIMATION_FINISHED, 78 chrome::NOTIFICATION_WALLPAPER_ANIMATION_FINISHED,
67 content::NotificationService::AllSources(), 79 content::NotificationService::AllSources(),
68 content::NotificationService::NoDetails()); 80 content::NotificationService::NoDetails());
69 } 81 }
70 82
83 virtual void OnWallpaperBootAnimationFinished() OVERRIDE {
84 // Make sure that boot animation type is used only once.
85 boot_animation_finished_ = true;
86 }
87
71 private: 88 private:
89 bool boot_animation_finished_;
90
72 DISALLOW_COPY_AND_ASSIGN(UserWallpaperDelegate); 91 DISALLOW_COPY_AND_ASSIGN(UserWallpaperDelegate);
73 }; 92 };
74 93
75 } // namespace 94 } // namespace
76 95
77 ash::UserWallpaperDelegate* CreateUserWallpaperDelegate() { 96 ash::UserWallpaperDelegate* CreateUserWallpaperDelegate() {
78 return new chromeos::UserWallpaperDelegate(); 97 return new chromeos::UserWallpaperDelegate();
79 } 98 }
80 99
81 } // namespace chromeos 100 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/about_flags.cc ('k') | chrome/browser/chromeos/chrome_browser_main_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698