Enable wallpaper boot animation for boot into sign in too. Add flag to disable it.

BUG=133279

Review URL: https://chromiumcodereview.appspot.com/10834081

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@150005 0039d316-1c4b-4281-b951-d872f2087c98
parent 47b7d4b3
...@@ -40,6 +40,9 @@ class UserWallpaperDelegate { ...@@ -40,6 +40,9 @@ class UserWallpaperDelegate {
// Notifies delegate that wallpaper animation has finished. // Notifies delegate that wallpaper animation has finished.
virtual void OnWallpaperAnimationFinished() = 0; virtual void OnWallpaperAnimationFinished() = 0;
// Notifies delegate that wallpaper boot animation has finished.
virtual void OnWallpaperBootAnimationFinished() = 0;
}; };
// Loads selected desktop wallpaper from file system asynchronously and updates // Loads selected desktop wallpaper from file system asynchronously and updates
......
...@@ -137,6 +137,9 @@ class DummyUserWallpaperDelegate : public UserWallpaperDelegate { ...@@ -137,6 +137,9 @@ class DummyUserWallpaperDelegate : public UserWallpaperDelegate {
virtual void OnWallpaperAnimationFinished() OVERRIDE { virtual void OnWallpaperAnimationFinished() OVERRIDE {
} }
virtual void OnWallpaperBootAnimationFinished() OVERRIDE {
}
private: private:
DISALLOW_COPY_AND_ASSIGN(DummyUserWallpaperDelegate); DISALLOW_COPY_AND_ASSIGN(DummyUserWallpaperDelegate);
}; };
......
...@@ -5946,6 +5946,12 @@ Keep your key file in a safe place. You will need it to create new versions of y ...@@ -5946,6 +5946,12 @@ Keep your key file in a safe place. You will need it to create new versions of y
<message name="IDS_FLAGS_DISABLE_NEW_OOBE_DESCRIPTION" desc="Description for the flag to disable new design for OOBE / sign in flows."> <message name="IDS_FLAGS_DISABLE_NEW_OOBE_DESCRIPTION" desc="Description for the flag to disable new design for OOBE / sign in flows.">
Disables new design for OOBE / sign in flows. Disables new design for OOBE / sign in flows.
</message> </message>
<message name="IDS_FLAGS_DISABLE_BOOT_ANIMATION" desc="Name for the flag to disable wallpaper boot animation (except for OOBE).">
Disable boot animation.
</message>
<message name="IDS_FLAGS_DISABLE_BOOT_ANIMATION_DESCRIPTION" desc="Description for the flag to disable wallpaper boot animation (except for OOBE).">
Disables wallpaper boot animation (except for OOBE case).
</message>
</if> </if>
<message name="IDS_FLAGS_OLD_CHECKBOX_STYLE" desc="Name of the flag to turn off the new checkbox style."> <message name="IDS_FLAGS_OLD_CHECKBOX_STYLE" desc="Name of the flag to turn off the new checkbox style.">
......
...@@ -824,6 +824,13 @@ const Experiment kExperiments[] = { ...@@ -824,6 +824,13 @@ const Experiment kExperiments[] = {
kOsCrOS, kOsCrOS,
SINGLE_VALUE_TYPE(switches::kDisableNewOobe), SINGLE_VALUE_TYPE(switches::kDisableNewOobe),
}, },
{
"disable-boot-animation",
IDS_FLAGS_DISABLE_BOOT_ANIMATION,
IDS_FLAGS_DISABLE_BOOT_ANIMATION_DESCRIPTION,
kOsCrOS,
SINGLE_VALUE_TYPE(switches::kDisableBootAnimation),
},
#endif #endif
{ {
"enable-views-textfield", "enable-views-textfield",
......
...@@ -26,26 +26,38 @@ namespace chromeos { ...@@ -26,26 +26,38 @@ namespace chromeos {
namespace { namespace {
class UserWallpaperDelegate: public ash::UserWallpaperDelegate { bool IsNormalWallpaperChange() {
if (chromeos::UserManager::Get()->IsUserLoggedIn() ||
!CommandLine::ForCurrentProcess()->HasSwitch(switches::kFirstBoot) ||
CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableNewOobe) ||
WizardController::IsZeroDelayEnabled() ||
!CommandLine::ForCurrentProcess()->HasSwitch(switches::kLoginManager)) {
return true;
}
return false;
}
class UserWallpaperDelegate : public ash::UserWallpaperDelegate {
public: public:
UserWallpaperDelegate() { UserWallpaperDelegate() : boot_animation_finished_(false) {
} }
virtual ~UserWallpaperDelegate() { virtual ~UserWallpaperDelegate() {
} }
virtual ash::WindowVisibilityAnimationType GetAnimationType() OVERRIDE { virtual ash::WindowVisibilityAnimationType GetAnimationType() OVERRIDE {
if (CommandLine::ForCurrentProcess()->HasSwitch( if (IsNormalWallpaperChange() || boot_animation_finished_)
switches::kDisableNewOobe) ||
WizardController::IsZeroDelayEnabled()) {
return ash::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE; return ash::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE;
}
// It is a first boot case now. If kDisableBootAnimation flag
// is passed, it only disables any transition after OOBE.
bool is_registered = WizardController::IsDeviceRegistered(); bool is_registered = WizardController::IsDeviceRegistered();
// TODO(nkostylev): Figure out whether this would affect autotests as well. bool disable_boot_animation = CommandLine::ForCurrentProcess()->
if (is_registered) HasSwitch(switches::kDisableBootAnimation);
if (is_registered && disable_boot_animation)
return ash::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE; return ash::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE;
else
return ash::WINDOW_VISIBILITY_ANIMATION_TYPE_BRIGHTNESS_GRAYSCALE; return ash::WINDOW_VISIBILITY_ANIMATION_TYPE_BRIGHTNESS_GRAYSCALE;
} }
...@@ -68,7 +80,14 @@ class UserWallpaperDelegate: public ash::UserWallpaperDelegate { ...@@ -68,7 +80,14 @@ class UserWallpaperDelegate: public ash::UserWallpaperDelegate {
content::NotificationService::NoDetails()); content::NotificationService::NoDetails());
} }
virtual void OnWallpaperBootAnimationFinished() OVERRIDE {
// Make sure that boot animation type is used only once.
boot_animation_finished_ = true;
}
private: private:
bool boot_animation_finished_;
DISALLOW_COPY_AND_ASSIGN(UserWallpaperDelegate); DISALLOW_COPY_AND_ASSIGN(UserWallpaperDelegate);
}; };
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include "chrome/browser/chromeos/login/screen_locker.h" #include "chrome/browser/chromeos/login/screen_locker.h"
#include "chrome/browser/chromeos/login/user_manager.h" #include "chrome/browser/chromeos/login/user_manager.h"
#include "chrome/browser/chromeos/login/wallpaper_manager.h" #include "chrome/browser/chromeos/login/wallpaper_manager.h"
#include "chrome/browser/chromeos/login/wizard_controller.h"
#include "chrome/browser/chromeos/low_memory_observer.h" #include "chrome/browser/chromeos/low_memory_observer.h"
#include "chrome/browser/chromeos/net/cros_network_change_notifier_factory.h" #include "chrome/browser/chromeos/net/cros_network_change_notifier_factory.h"
#include "chrome/browser/chromeos/net/network_change_notifier_chromeos.h" #include "chrome/browser/chromeos/net/network_change_notifier_chromeos.h"
...@@ -419,6 +420,12 @@ void ChromeBrowserMainPartsChromeos::PostProfileInit() { ...@@ -419,6 +420,12 @@ void ChromeBrowserMainPartsChromeos::PostProfileInit() {
chromeos::CrosLibrary::Get()->GetNetworkLibrary())); chromeos::CrosLibrary::Get()->GetNetworkLibrary()));
} }
// Make sure that wallpaper boot transition and other delays in OOBE
// are disabled for tests by default.
// Individual tests may enable them if they want.
if (parsed_command_line().HasSwitch(switches::kTestType))
chromeos::WizardController::SetZeroDelays();
// Tests should be able to tune login manager before showing it. // Tests should be able to tune login manager before showing it.
// Thus only show login manager in normal (non-testing) mode. // Thus only show login manager in normal (non-testing) mode.
if (!parameters().ui_task) if (!parameters().ui_task)
......
...@@ -198,13 +198,18 @@ void WallpaperManager::InitializeWallpaper() { ...@@ -198,13 +198,18 @@ void WallpaperManager::InitializeWallpaper() {
if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestType)) if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestType))
WizardController::SetZeroDelays(); WizardController::SetZeroDelays();
// Zero delays is also set in autotests.
if (WizardController::IsZeroDelayEnabled())
return;
bool disable_new_oobe = CommandLine::ForCurrentProcess()->
HasSwitch(switches::kDisableNewOobe);
bool disable_boot_animation = CommandLine::ForCurrentProcess()->
HasSwitch(switches::kDisableBootAnimation);
if (!user_manager->IsUserLoggedIn()) { if (!user_manager->IsUserLoggedIn()) {
if (!CommandLine::ForCurrentProcess()->HasSwitch( if (!disable_new_oobe) {
switches::kDisableNewOobe)) { if (!WizardController::IsDeviceRegistered()) {
if (!WizardController::IsDeviceRegistered() &&
!WizardController::IsZeroDelayEnabled()) {
// TODO(nkostylev): Add switch to disable wallpaper transition on OOBE.
// Should be used on test images so that they are not slowed down.
ash::Shell::GetInstance()->desktop_background_controller()-> ash::Shell::GetInstance()->desktop_background_controller()->
SetDefaultWallpaper(kDefaultOOBEWallpaperIndex, false); SetDefaultWallpaper(kDefaultOOBEWallpaperIndex, false);
} else { } else {
...@@ -214,8 +219,20 @@ void WallpaperManager::InitializeWallpaper() { ...@@ -214,8 +219,20 @@ void WallpaperManager::InitializeWallpaper() {
DCHECK(result) << "Unable to fetch setting " DCHECK(result) << "Unable to fetch setting "
<< kAccountsPrefShowUserNamesOnSignIn; << kAccountsPrefShowUserNamesOnSignIn;
if (!show_users) { if (!show_users) {
// Boot into sign in form, preload default wallpaper.
ash::Shell::GetInstance()->desktop_background_controller()-> ash::Shell::GetInstance()->desktop_background_controller()->
SetDefaultWallpaper(ash::GetSolidColorIndex(), false); SetDefaultWallpaper(kDefaultOOBEWallpaperIndex, false);
} else if (!disable_boot_animation) {
// Normal boot, load user wallpaper.
// If normal boot animation is disabled wallpaper would be set
// asynchronously once user pods are loaded.
const chromeos::UserList& users = user_manager->GetUsers();
if (!users.empty()) {
SetUserWallpaper(users[0]->email());
} else {
ash::Shell::GetInstance()->desktop_background_controller()->
SetDefaultWallpaper(kDefaultOOBEWallpaperIndex, false);
}
} }
} }
} }
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "chrome/browser/chromeos/login/webui_login_display_host.h" #include "chrome/browser/chromeos/login/webui_login_display_host.h"
#include "ash/desktop_background/desktop_background_controller.h"
#include "ash/shell.h" #include "ash/shell.h"
#include "ash/shell_window_ids.h" #include "ash/shell_window_ids.h"
#include "ash/wm/window_animations.h" #include "ash/wm/window_animations.h"
...@@ -61,7 +62,9 @@ WebUILoginDisplayHost::WebUILoginDisplayHost(const gfx::Rect& background_bounds) ...@@ -61,7 +62,9 @@ WebUILoginDisplayHost::WebUILoginDisplayHost(const gfx::Rect& background_bounds)
bool zero_delay_enabled = WizardController::IsZeroDelayEnabled(); bool zero_delay_enabled = WizardController::IsZeroDelayEnabled();
if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableNewOobe) && if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableNewOobe) &&
!zero_delay_enabled) { !zero_delay_enabled) {
waiting_for_wallpaper_load_ = !is_registered; bool disable_boot_animation = CommandLine::ForCurrentProcess()->
HasSwitch(switches::kDisableBootAnimation);
waiting_for_wallpaper_load_ = !is_registered || !disable_boot_animation;
} else { } else {
waiting_for_wallpaper_load_ = false; waiting_for_wallpaper_load_ = false;
} }
...@@ -173,6 +176,8 @@ void WebUILoginDisplayHost::Observe( ...@@ -173,6 +176,8 @@ void WebUILoginDisplayHost::Observe(
BaseLoginDisplayHost::Observe(type, source, details); BaseLoginDisplayHost::Observe(type, source, details);
if (chrome::NOTIFICATION_WALLPAPER_ANIMATION_FINISHED == type) { if (chrome::NOTIFICATION_WALLPAPER_ANIMATION_FINISHED == type) {
is_wallpaper_loaded_ = true; is_wallpaper_loaded_ = true;
ash::Shell::GetInstance()->user_wallpaper_delegate()->
OnWallpaperBootAnimationFinished();
if (waiting_for_wallpaper_load_) if (waiting_for_wallpaper_load_)
StartPostponedWebUI(); StartPostponedWebUI();
registrar_.Remove(this, registrar_.Remove(this,
......
...@@ -88,7 +88,7 @@ class WizardController : public ScreenObserver { ...@@ -88,7 +88,7 @@ class WizardController : public ScreenObserver {
// Returns initial locale from local settings. // Returns initial locale from local settings.
static std::string GetInitialLocale(); static std::string GetInitialLocale();
// Sets delays to zero. MUST be used only for browser tests. // Sets delays to zero. MUST be used only for tests.
static void SetZeroDelays(); static void SetZeroDelays();
// If true zero delays have been enabled (for browser tests). // If true zero delays have been enabled (for browser tests).
......
...@@ -47,7 +47,6 @@ ...@@ -47,7 +47,6 @@
#include "chrome/browser/chromeos/login/message_bubble.h" #include "chrome/browser/chromeos/login/message_bubble.h"
#include "chrome/browser/chromeos/login/user.h" #include "chrome/browser/chromeos/login/user.h"
#include "chrome/browser/chromeos/login/user_manager.h" #include "chrome/browser/chromeos/login/user_manager.h"
#include "chrome/browser/chromeos/login/wizard_controller.h"
#include "chrome/browser/chromeos/mobile_config.h" #include "chrome/browser/chromeos/mobile_config.h"
#include "chrome/browser/chromeos/status/data_promo_notification.h" #include "chrome/browser/chromeos/status/data_promo_notification.h"
#include "chrome/browser/chromeos/status/network_menu.h" #include "chrome/browser/chromeos/status/network_menu.h"
...@@ -256,14 +255,8 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate, ...@@ -256,14 +255,8 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate,
// Overridden from ash::SystemTrayDelegate: // Overridden from ash::SystemTrayDelegate:
virtual bool GetTrayVisibilityOnStartup() OVERRIDE { virtual bool GetTrayVisibilityOnStartup() OVERRIDE {
// If we're either logged in (doesn't matter in KioskMode or not), // In case of OOBE / sign in screen tray will be shown later.
// or not in KioskMode at all, return true. return UserManager::Get()->IsUserLoggedIn();
// If not registered i.e. OOBE is still active, start with tray hidden,
// it will be enabled if needed by OOBE flow.
bool is_registered = chromeos::WizardController::IsDeviceRegistered();
return UserManager::Get()->IsUserLoggedIn() ||
(!chromeos::KioskModeSettings::Get()->IsKioskModeEnabled() &&
is_registered);
} }
virtual const string16 GetUserDisplayName() const OVERRIDE { virtual const string16 GetUserDisplayName() const OVERRIDE {
......
...@@ -361,6 +361,13 @@ cr.define('cr.ui.login', function() { ...@@ -361,6 +361,13 @@ cr.define('cr.ui.login', function() {
isLockScreen: function() { isLockScreen: function() {
return document.documentElement.getAttribute('screen') == 'lock'; return document.documentElement.getAttribute('screen') == 'lock';
}, },
/**
* Returns true if sign in UI should trigger wallpaper load on boot.
*/
shouldLoadWallpaperOnBoot: function() {
return localStrings.getString('bootIntoWallpaper') == 'on';
},
}; };
/** /**
......
...@@ -33,7 +33,7 @@ cr.define('login', function() { ...@@ -33,7 +33,7 @@ cr.define('login', function() {
* @type {number} * @type {number}
* @const * @const
*/ */
var WALLPAPER_BOAT_LOAD_DELAY_MS = 500; var WALLPAPER_BOOT_LOAD_DELAY_MS = 500;
/** /**
* Oauth token status. These must match UserManager::OAuthTokenStatus. * Oauth token status. These must match UserManager::OAuthTokenStatus.
...@@ -679,8 +679,10 @@ cr.define('login', function() { ...@@ -679,8 +679,10 @@ cr.define('login', function() {
// Boot transition. Delay wallpaper load to remove jank // Boot transition. Delay wallpaper load to remove jank
// happening when wallpaper load is competing for resources with // happening when wallpaper load is competing for resources with
// login WebUI. // login WebUI.
if (Oobe.getInstance().shouldLoadWallpaperOnBoot()) {
this.loadWallpaperTimeout_ = window.setTimeout( this.loadWallpaperTimeout_ = window.setTimeout(
this.loadWallpaper_.bind(this), WALLPAPER_BOAT_LOAD_DELAY_MS); this.loadWallpaper_.bind(this), WALLPAPER_BOOT_LOAD_DELAY_MS);
}
this.firstShown_ = false; this.firstShown_ = false;
} }
} }
......
...@@ -243,6 +243,15 @@ void OobeUI::GetLocalizedStrings(base::DictionaryValue* localized_strings) { ...@@ -243,6 +243,15 @@ void OobeUI::GetLocalizedStrings(base::DictionaryValue* localized_strings) {
else else
localized_strings->SetString("oobeType", "old"); localized_strings->SetString("oobeType", "old");
// If we're not doing boot animation then WebUI should trigger
// wallpaper load on boot.
if (CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDisableBootAnimation)) {
localized_strings->SetString("bootIntoWallpaper", "on");
} else {
localized_strings->SetString("bootIntoWallpaper", "off");
}
// OobeUI is used for OOBE/login and lock screen. // OobeUI is used for OOBE/login and lock screen.
if (BaseLoginDisplayHost::default_host()) if (BaseLoginDisplayHost::default_host())
localized_strings->SetString("screenType", "login"); localized_strings->SetString("screenType", "login");
......
...@@ -1344,6 +1344,9 @@ const char kTabletUI[] = "tablet-ui"; ...@@ -1344,6 +1344,9 @@ const char kTabletUI[] = "tablet-ui";
#endif #endif
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
// Disables wallpaper boot animation (except of OOBE case).
const char kDisableBootAnimation[] = "disable-boot-animation";
// Disables gdata content provider. // Disables gdata content provider.
const char kDisableGData[] = "disable-gdata"; const char kDisableGData[] = "disable-gdata";
...@@ -1388,6 +1391,9 @@ const char kEnableUnsupportedBluetoothDevices[] = ...@@ -1388,6 +1391,9 @@ const char kEnableUnsupportedBluetoothDevices[] =
// Enables the experimental wallpaper picker UI. // Enables the experimental wallpaper picker UI.
const char kExperimentalWallpaperUI[] = "experimental-wallpaper-ui"; const char kExperimentalWallpaperUI[] = "experimental-wallpaper-ui";
// Passed to Chrome on first boot. Not passed on restart after sign out.
const char kFirstBoot[] = "first-boot";
// Path for the screensaver used in Kiosk mode // Path for the screensaver used in Kiosk mode
const char kKioskModeScreensaverPath[] = "kiosk-mode-screensaver-path"; const char kKioskModeScreensaverPath[] = "kiosk-mode-screensaver-path";
......
...@@ -365,6 +365,7 @@ extern const char kTabletUI[]; ...@@ -365,6 +365,7 @@ extern const char kTabletUI[];
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
// Keep switches in alphabetical order. // Keep switches in alphabetical order.
extern const char kDisableBootAnimation[];
extern const char kDisableGData[]; extern const char kDisableGData[];
extern const char kDisableHtml5Camera[]; extern const char kDisableHtml5Camera[];
extern const char kDisableNewOobe[]; extern const char kDisableNewOobe[];
...@@ -378,6 +379,7 @@ extern const char kEnableONCPolicy[]; ...@@ -378,6 +379,7 @@ extern const char kEnableONCPolicy[];
extern const char kEnableStaticIPConfig[]; extern const char kEnableStaticIPConfig[];
extern const char kEnableUnsupportedBluetoothDevices[]; extern const char kEnableUnsupportedBluetoothDevices[];
extern const char kExperimentalWallpaperUI[]; extern const char kExperimentalWallpaperUI[];
extern const char kFirstBoot[];
extern const char kKioskModeScreensaverPath[]; extern const char kKioskModeScreensaverPath[];
extern const char kLoginManager[]; extern const char kLoginManager[];
// TODO(avayvod): Remove this flag when it's unnecessary for testing // TODO(avayvod): Remove this flag when it's unnecessary for testing
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment