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 {
// Notifies delegate that wallpaper animation has finished.
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
......
......@@ -137,6 +137,9 @@ class DummyUserWallpaperDelegate : public UserWallpaperDelegate {
virtual void OnWallpaperAnimationFinished() OVERRIDE {
}
virtual void OnWallpaperBootAnimationFinished() OVERRIDE {
}
private:
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
<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.
</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>
<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[] = {
kOsCrOS,
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
{
"enable-views-textfield",
......
......@@ -26,27 +26,39 @@ namespace chromeos {
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:
UserWallpaperDelegate() {
UserWallpaperDelegate() : boot_animation_finished_(false) {
}
virtual ~UserWallpaperDelegate() {
}
virtual ash::WindowVisibilityAnimationType GetAnimationType() OVERRIDE {
if (CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDisableNewOobe) ||
WizardController::IsZeroDelayEnabled()) {
if (IsNormalWallpaperChange() || boot_animation_finished_)
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();
// TODO(nkostylev): Figure out whether this would affect autotests as well.
if (is_registered)
bool disable_boot_animation = CommandLine::ForCurrentProcess()->
HasSwitch(switches::kDisableBootAnimation);
if (is_registered && disable_boot_animation)
return ash::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE;
else
return ash::WINDOW_VISIBILITY_ANIMATION_TYPE_BRIGHTNESS_GRAYSCALE;
return ash::WINDOW_VISIBILITY_ANIMATION_TYPE_BRIGHTNESS_GRAYSCALE;
}
virtual void InitializeWallpaper() OVERRIDE {
......@@ -68,7 +80,14 @@ class UserWallpaperDelegate: public ash::UserWallpaperDelegate {
content::NotificationService::NoDetails());
}
virtual void OnWallpaperBootAnimationFinished() OVERRIDE {
// Make sure that boot animation type is used only once.
boot_animation_finished_ = true;
}
private:
bool boot_animation_finished_;
DISALLOW_COPY_AND_ASSIGN(UserWallpaperDelegate);
};
......
......@@ -35,6 +35,7 @@
#include "chrome/browser/chromeos/login/screen_locker.h"
#include "chrome/browser/chromeos/login/user_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/net/cros_network_change_notifier_factory.h"
#include "chrome/browser/chromeos/net/network_change_notifier_chromeos.h"
......@@ -419,6 +420,12 @@ void ChromeBrowserMainPartsChromeos::PostProfileInit() {
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.
// Thus only show login manager in normal (non-testing) mode.
if (!parameters().ui_task)
......
......@@ -198,13 +198,18 @@ void WallpaperManager::InitializeWallpaper() {
if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestType))
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 (!CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDisableNewOobe)) {
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.
if (!disable_new_oobe) {
if (!WizardController::IsDeviceRegistered()) {
ash::Shell::GetInstance()->desktop_background_controller()->
SetDefaultWallpaper(kDefaultOOBEWallpaperIndex, false);
} else {
......@@ -214,8 +219,20 @@ void WallpaperManager::InitializeWallpaper() {
DCHECK(result) << "Unable to fetch setting "
<< kAccountsPrefShowUserNamesOnSignIn;
if (!show_users) {
// Boot into sign in form, preload default wallpaper.
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 @@
#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_window_ids.h"
#include "ash/wm/window_animations.h"
......@@ -61,7 +62,9 @@ WebUILoginDisplayHost::WebUILoginDisplayHost(const gfx::Rect& background_bounds)
bool zero_delay_enabled = WizardController::IsZeroDelayEnabled();
if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableNewOobe) &&
!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 {
waiting_for_wallpaper_load_ = false;
}
......@@ -173,6 +176,8 @@ void WebUILoginDisplayHost::Observe(
BaseLoginDisplayHost::Observe(type, source, details);
if (chrome::NOTIFICATION_WALLPAPER_ANIMATION_FINISHED == type) {
is_wallpaper_loaded_ = true;
ash::Shell::GetInstance()->user_wallpaper_delegate()->
OnWallpaperBootAnimationFinished();
if (waiting_for_wallpaper_load_)
StartPostponedWebUI();
registrar_.Remove(this,
......
......@@ -88,7 +88,7 @@ class WizardController : public ScreenObserver {
// Returns initial locale from local settings.
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();
// If true zero delays have been enabled (for browser tests).
......
......@@ -47,7 +47,6 @@
#include "chrome/browser/chromeos/login/message_bubble.h"
#include "chrome/browser/chromeos/login/user.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/status/data_promo_notification.h"
#include "chrome/browser/chromeos/status/network_menu.h"
......@@ -256,14 +255,8 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate,
// Overridden from ash::SystemTrayDelegate:
virtual bool GetTrayVisibilityOnStartup() OVERRIDE {
// If we're either logged in (doesn't matter in KioskMode or not),
// or not in KioskMode at all, return true.
// 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);
// In case of OOBE / sign in screen tray will be shown later.
return UserManager::Get()->IsUserLoggedIn();
}
virtual const string16 GetUserDisplayName() const OVERRIDE {
......
......@@ -361,6 +361,13 @@ cr.define('cr.ui.login', function() {
isLockScreen: function() {
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() {
* @type {number}
* @const
*/
var WALLPAPER_BOAT_LOAD_DELAY_MS = 500;
var WALLPAPER_BOOT_LOAD_DELAY_MS = 500;
/**
* Oauth token status. These must match UserManager::OAuthTokenStatus.
......@@ -679,8 +679,10 @@ cr.define('login', function() {
// Boot transition. Delay wallpaper load to remove jank
// happening when wallpaper load is competing for resources with
// login WebUI.
this.loadWallpaperTimeout_ = window.setTimeout(
this.loadWallpaper_.bind(this), WALLPAPER_BOAT_LOAD_DELAY_MS);
if (Oobe.getInstance().shouldLoadWallpaperOnBoot()) {
this.loadWallpaperTimeout_ = window.setTimeout(
this.loadWallpaper_.bind(this), WALLPAPER_BOOT_LOAD_DELAY_MS);
}
this.firstShown_ = false;
}
}
......
......@@ -243,6 +243,15 @@ void OobeUI::GetLocalizedStrings(base::DictionaryValue* localized_strings) {
else
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.
if (BaseLoginDisplayHost::default_host())
localized_strings->SetString("screenType", "login");
......
......@@ -1344,6 +1344,9 @@ const char kTabletUI[] = "tablet-ui";
#endif
#if defined(OS_CHROMEOS)
// Disables wallpaper boot animation (except of OOBE case).
const char kDisableBootAnimation[] = "disable-boot-animation";
// Disables gdata content provider.
const char kDisableGData[] = "disable-gdata";
......@@ -1388,6 +1391,9 @@ const char kEnableUnsupportedBluetoothDevices[] =
// Enables the experimental wallpaper picker 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
const char kKioskModeScreensaverPath[] = "kiosk-mode-screensaver-path";
......
......@@ -365,6 +365,7 @@ extern const char kTabletUI[];
#if defined(OS_CHROMEOS)
// Keep switches in alphabetical order.
extern const char kDisableBootAnimation[];
extern const char kDisableGData[];
extern const char kDisableHtml5Camera[];
extern const char kDisableNewOobe[];
......@@ -378,6 +379,7 @@ extern const char kEnableONCPolicy[];
extern const char kEnableStaticIPConfig[];
extern const char kEnableUnsupportedBluetoothDevices[];
extern const char kExperimentalWallpaperUI[];
extern const char kFirstBoot[];
extern const char kKioskModeScreensaverPath[];
extern const char kLoginManager[];
// 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