diff options
author | karen@chromium.org <karen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-19 21:57:22 +0000 |
---|---|---|
committer | karen@chromium.org <karen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-19 21:57:22 +0000 |
commit | 081748b2e5d1925fa60d5c731d6c01ac779b87d6 (patch) | |
tree | f0cc7d0ed21bfa14c3ceb5bfc44b99189e0bf1f5 | |
parent | 2498d3dc6bfce1c0c68f2ea1dae4c10f93516900 (diff) | |
download | chromium_src-081748b2e5d1925fa60d5c731d6c01ac779b87d6.zip chromium_src-081748b2e5d1925fa60d5c731d6c01ac779b87d6.tar.gz chromium_src-081748b2e5d1925fa60d5c731d6c01ac779b87d6.tar.bz2 |
Merge 157535 - Boot transition v2.
a. Show login webUI as soon as possible (don't wait for wallpaper animation to finish).
b. Use different type of animation tween.
c. NOT increasing wallpaper animation time from 1s to 2s as it turns out that slows down login webUI even with a. (profiling is needed)
BUG=141988
Review URL: https://codereview.chromium.org/10938013
TBR=nkostylev@chromium.org
Review URL: https://codereview.chromium.org/10939043
git-svn-id: svn://svn.chromium.org/chrome/branches/1271/src@157617 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | ash/ash_switches.cc | 3 | ||||
-rw-r--r-- | ash/ash_switches.h | 1 | ||||
-rw-r--r-- | ash/wm/window_animations.cc | 19 | ||||
-rw-r--r-- | chrome/app/generated_resources.grd | 6 | ||||
-rw-r--r-- | chrome/browser/about_flags.cc | 7 | ||||
-rw-r--r-- | chrome/browser/chromeos/login/webui_login_display_host.cc | 16 | ||||
-rw-r--r-- | chrome/browser/chromeos/login/webui_login_display_host.h | 3 | ||||
-rw-r--r-- | ui/base/animation/tween.cc | 3 | ||||
-rw-r--r-- | ui/base/animation/tween.h | 1 |
9 files changed, 51 insertions, 8 deletions
diff --git a/ash/ash_switches.cc b/ash/ash_switches.cc index 8d2dca7..4d75bda 100644 --- a/ash/ash_switches.cc +++ b/ash/ash_switches.cc @@ -16,6 +16,9 @@ const char kAshDebugShortcuts[] = "ash-debug-shortcuts"; // Disables Workspace2. const char kAshDisableWorkspace2[] = "ash-disable-workspace2"; +// Disables boot animation v2, go back to v1. +const char kAshDisableBootAnimation2[] = "ash-disable-boot-animation2"; + // Enable advanced gestures (e.g. for window management). const char kAshEnableAdvancedGestures[] = "ash-enable-advanced-gestures"; diff --git a/ash/ash_switches.h b/ash/ash_switches.h index b62179f..2bdb721 100644 --- a/ash/ash_switches.h +++ b/ash/ash_switches.h @@ -18,6 +18,7 @@ namespace switches { ASH_EXPORT extern const char kAshConstrainPointerToRoot[]; ASH_EXPORT extern const char kAshDebugShortcuts[]; ASH_EXPORT extern const char kAshDisableWorkspace2[]; +ASH_EXPORT extern const char kAshDisableBootAnimation2[]; ASH_EXPORT extern const char kAshEnableAdvancedGestures[]; ASH_EXPORT extern const char kAshEnableOak[]; ASH_EXPORT extern const char kAshNotifyDisabled[]; diff --git a/ash/wm/window_animations.cc b/ash/wm/window_animations.cc index ba15530..9133b57 100644 --- a/ash/wm/window_animations.cc +++ b/ash/wm/window_animations.cc @@ -511,9 +511,16 @@ void AnimateShowHideWindowCommon_BrightnessGrayscale(aura::Window* window, window->layer()->SetVisible(true); } + int animation_duration = kBrightnessGrayscaleFadeDurationMs; + ui::Tween::Type animation_type = ui::Tween::EASE_OUT_2; + if (CommandLine::ForCurrentProcess()->HasSwitch( + ash::switches::kAshDisableBootAnimation2)) { + animation_type = ui::Tween::EASE_OUT; + } + ui::ScopedLayerAnimationSettings settings(window->layer()->GetAnimator()); settings.SetTransitionDuration( - base::TimeDelta::FromMilliseconds(kBrightnessGrayscaleFadeDurationMs)); + base::TimeDelta::FromMilliseconds(animation_duration)); if (!show) settings.AddObserver(new HidingWindowAnimationObserver(window)); @@ -525,17 +532,15 @@ void AnimateShowHideWindowCommon_BrightnessGrayscale(aura::Window* window, scoped_ptr<ui::LayerAnimationElement> brightness_element( ui::LayerAnimationElement::CreateBrightnessElement( end_value, - base::TimeDelta::FromMilliseconds( - kBrightnessGrayscaleFadeDurationMs))); - brightness_element->set_tween_type(ui::Tween::EASE_OUT); + base::TimeDelta::FromMilliseconds(animation_duration))); + brightness_element->set_tween_type(animation_type); brightness_sequence->AddElement(brightness_element.release()); scoped_ptr<ui::LayerAnimationElement> grayscale_element( ui::LayerAnimationElement::CreateGrayscaleElement( end_value, - base::TimeDelta::FromMilliseconds( - kBrightnessGrayscaleFadeDurationMs))); - grayscale_element->set_tween_type(ui::Tween::EASE_OUT); + base::TimeDelta::FromMilliseconds(animation_duration))); + grayscale_element->set_tween_type(animation_type); grayscale_sequence->AddElement(grayscale_element.release()); std::vector<ui::LayerAnimationSequence*> animations; diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index bcc3d77..b1310de 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -6324,6 +6324,12 @@ Keep your key file in a safe place. You will need it to create new versions of y <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> + <message name="IDS_FLAGS_DISABLE_BOOT_ANIMATION2" desc="Name for the flag to go back to wallpaper boot animation v1."> + Disable boot animation v2 (go back to v1). + </message> + <message name="IDS_FLAGS_DISABLE_BOOT_ANIMATION2_DESCRIPTION" desc="Description for the flag to go back to wallpaper boot animation v2."> + Disables wallpaper boot animation v2 - goes back to v1 (except for OOBE case). + </message> <message name="IDS_FLAGS_DISABLE_WORKSPACE2" desc="Description for the flag to turn off workspace2."> Disable new window stacking. </message> diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index ee0d90f..3751805 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc @@ -828,6 +828,13 @@ const Experiment kExperiments[] = { SINGLE_VALUE_TYPE(switches::kDisableBootAnimation), }, { + "disable-boot-animation2", + IDS_FLAGS_DISABLE_BOOT_ANIMATION2, + IDS_FLAGS_DISABLE_BOOT_ANIMATION2_DESCRIPTION, + kOsCrOS, + SINGLE_VALUE_TYPE(ash::switches::kAshDisableBootAnimation2), + }, + { "disable-workspace2", IDS_FLAGS_DISABLE_WORKSPACE2, IDS_FLAGS_DISABLE_WORKSPACE2_DESCRIPTION, diff --git a/chrome/browser/chromeos/login/webui_login_display_host.cc b/chrome/browser/chromeos/login/webui_login_display_host.cc index 09d2baf..e26eb8a 100644 --- a/chrome/browser/chromeos/login/webui_login_display_host.cc +++ b/chrome/browser/chromeos/login/webui_login_display_host.cc @@ -4,6 +4,7 @@ #include "chrome/browser/chromeos/login/webui_login_display_host.h" +#include "ash/ash_switches.h" #include "ash/desktop_background/desktop_background_controller.h" #include "ash/shell.h" #include "ash/shell_window_ids.h" @@ -81,12 +82,19 @@ WebUILoginDisplayHost::WebUILoginDisplayHost(const gfx::Rect& background_bounds) (is_registered || !disable_oobe_animation) && (!is_registered || !disable_boot_animation); + // For slower hardware we have boot animation disabled so + // we'll be initializing WebUI hidden, waiting for user pods to load and then + // show WebUI at once. waiting_for_user_pods_ = new_oobe_ui && !zero_delay_enabled && !waiting_for_wallpaper_load_; initialize_webui_hidden_ = kHiddenWebUIInitializationDefault && (waiting_for_user_pods_ || waiting_for_wallpaper_load_); + is_boot_animation2_enabled_ = waiting_for_wallpaper_load_ && + !CommandLine::ForCurrentProcess()->HasSwitch( + ash::switches::kAshDisableBootAnimation2); + // Prevents white flashing on OOBE (http://crbug.com/131569). aura::Env::GetInstance()->set_render_white_bg(false); @@ -110,7 +118,9 @@ WebUILoginDisplayHost::WebUILoginDisplayHost(const gfx::Rect& background_bounds) content::NotificationService::AllSources()); } - if (waiting_for_user_pods_ && initialize_webui_hidden_) { + // In boot-animation2 we want to show login WebUI as soon as possible. + if ((waiting_for_user_pods_ || is_boot_animation2_enabled_) + && initialize_webui_hidden_) { registrar_.Add(this, chrome::NOTIFICATION_LOGIN_WEBUI_VISIBLE, content::NotificationService::AllSources()); } @@ -248,6 +258,10 @@ void WebUILoginDisplayHost::Observe( if (waiting_for_user_pods_ && initialize_webui_hidden_) { waiting_for_user_pods_ = false; ShowWebUI(); + } else if (waiting_for_wallpaper_load_ && initialize_webui_hidden_) { + // Reduce time till login UI is shown - show it as soon as possible. + waiting_for_wallpaper_load_ = false; + ShowWebUI(); } registrar_.Remove(this, chrome::NOTIFICATION_LOGIN_WEBUI_VISIBLE, diff --git a/chrome/browser/chromeos/login/webui_login_display_host.h b/chrome/browser/chromeos/login/webui_login_display_host.h index aaf9660..38447d7 100644 --- a/chrome/browser/chromeos/login/webui_login_display_host.h +++ b/chrome/browser/chromeos/login/webui_login_display_host.h @@ -83,6 +83,9 @@ class WebUILoginDisplayHost : public BaseLoginDisplayHost, // Login display we are using. WebUILoginDisplay* webui_login_display_; + // True if alternate boot animation is enabled. + bool is_boot_animation2_enabled_; + // True if the login display is the current screen. bool is_showing_login_; diff --git a/ui/base/animation/tween.cc b/ui/base/animation/tween.cc index 51dd298..f3a854f 100644 --- a/ui/base/animation/tween.cc +++ b/ui/base/animation/tween.cc @@ -45,6 +45,9 @@ double Tween::CalculateValue(Tween::Type type, double state) { case EASE_OUT: return 1.0 - pow(1.0 - state, 2); + case EASE_OUT_2: + return 1.0 - pow(1.0 - state, 4); + case SMOOTH_IN_OUT: return sin(state); diff --git a/ui/base/animation/tween.h b/ui/base/animation/tween.h index 46e30e1..b8b58c7 100644 --- a/ui/base/animation/tween.h +++ b/ui/base/animation/tween.h @@ -17,6 +17,7 @@ class UI_EXPORT Tween { enum Type { LINEAR, // Linear. EASE_OUT, // Fast in, slow out (default). + EASE_OUT_2, // Variant of EASE_OUT, that starts out slower. EASE_IN, // Slow in, fast out. EASE_IN_2, // Variant of EASE_IN that starts out slower. EASE_IN_OUT, // Slow in and out, fast in the middle. |