summaryrefslogtreecommitdiffstats
path: root/ash
diff options
context:
space:
mode:
authorantrim@chromium.org <antrim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-06 20:30:50 +0000
committerantrim@chromium.org <antrim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-06 20:30:50 +0000
commitf028095c1ecacd91905d9849b7f6725b746fc9fc (patch)
treea37bef6e112d9738c99e2ceffeb0b96943daf27f /ash
parent1775a0a9533b6e796b7a733028eb2d4fb88e0cf7 (diff)
downloadchromium_src-f028095c1ecacd91905d9849b7f6725b746fc9fc.zip
chromium_src-f028095c1ecacd91905d9849b7f6725b746fc9fc.tar.gz
chromium_src-f028095c1ecacd91905d9849b7f6725b746fc9fc.tar.bz2
Added alternative lock pod animation and flag to control it.
(alternative animation is on by default). BUG=138171 Review URL: https://chromiumcodereview.appspot.com/11361066 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@166256 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r--ash/ash_switches.cc3
-rw-r--r--ash/ash_switches.h1
-rw-r--r--ash/wm/power_button_controller_unittest.cc16
-rw-r--r--ash/wm/session_state_animator.cc51
-rw-r--r--ash/wm/session_state_animator.h11
-rw-r--r--ash/wm/session_state_controller_impl.cc8
-rw-r--r--ash/wm/session_state_controller_impl2.cc43
7 files changed, 87 insertions, 46 deletions
diff --git a/ash/ash_switches.cc b/ash/ash_switches.cc
index 1b0b24b..368eb9f 100644
--- a/ash/ash_switches.cc
+++ b/ash/ash_switches.cc
@@ -55,6 +55,9 @@ const char kAshLauncherPerDisplay[] = "ash-launcher-per-display";
// If present new lock animations are enabled.
const char kAshNewLockAnimationsEnabled[] = "ash-new-lock-animations-enabled";
+// If present animations for lock screen are reversed.
+const char kAshReverseNewLockAnimations[] = "ash-reverse-new-lock-animations";
+
// Specifies the layout mode and offsets for the secondary display for
// testing. The format is "<t|r|b|l>,<offset>" where t=TOP, r=RIGHT,
// b=BOTTOM and L=LEFT. For example, 'r,-100' means the secondary display
diff --git a/ash/ash_switches.h b/ash/ash_switches.h
index 6da4d7b..a30d9fb 100644
--- a/ash/ash_switches.h
+++ b/ash/ash_switches.h
@@ -33,6 +33,7 @@ ASH_EXPORT extern const char kAshEnableOak[];
ASH_EXPORT extern const char kAshEnableTrayDragging[];
ASH_EXPORT extern const char kAshLauncherPerDisplay[];
ASH_EXPORT extern const char kAshNewLockAnimationsEnabled[];
+ASH_EXPORT extern const char kAshReverseNewLockAnimations[];
ASH_EXPORT extern const char kAshSecondaryDisplayLayout[];
ASH_EXPORT extern const char kAshTouchHud[];
ASH_EXPORT extern const char kAshWindowAnimationsDisabled[];
diff --git a/ash/wm/power_button_controller_unittest.cc b/ash/wm/power_button_controller_unittest.cc
index 6449a6e..6d81f39 100644
--- a/ash/wm/power_button_controller_unittest.cc
+++ b/ash/wm/power_button_controller_unittest.cc
@@ -124,7 +124,7 @@ TEST_F(PowerButtonControllerTest, LegacyLockAndShutDown) {
EXPECT_TRUE(
animator_api_->ContainersAreAnimated(
internal::SessionStateAnimator::LAUNCHER,
- internal::SessionStateAnimator::ANIMATION_HIDE));
+ internal::SessionStateAnimator::ANIMATION_HIDE_IMMEDIATELY));
EXPECT_TRUE(
animator_api_->ContainersAreAnimated(
internal::SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS,
@@ -132,7 +132,7 @@ TEST_F(PowerButtonControllerTest, LegacyLockAndShutDown) {
EXPECT_TRUE(
animator_api_->ContainersAreAnimated(
internal::SessionStateAnimator::LOCK_SCREEN_CONTAINERS,
- internal::SessionStateAnimator::ANIMATION_HIDE));
+ internal::SessionStateAnimator::ANIMATION_HIDE_IMMEDIATELY));
// Notify that the lock window is visible. We should make it fade in.
state_controller_->OnLockStateChanged(true);
@@ -226,7 +226,7 @@ TEST_F(PowerButtonControllerTest, ShutdownWhenNotLoggedIn) {
animator_api_->ContainersAreAnimated(
internal::SessionStateAnimator::LAUNCHER |
internal::SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS,
- internal::SessionStateAnimator::ANIMATION_HIDE));
+ internal::SessionStateAnimator::ANIMATION_HIDE_IMMEDIATELY));
EXPECT_TRUE(
animator_api_->ContainersAreAnimated(
internal::SessionStateAnimator::kAllLockScreenContainersMask,
@@ -286,7 +286,7 @@ TEST_F(PowerButtonControllerTest, LockAndUnlock) {
EXPECT_TRUE(
animator_api_->ContainersAreAnimated(
internal::SessionStateAnimator::LAUNCHER,
- internal::SessionStateAnimator::ANIMATION_HIDE));
+ internal::SessionStateAnimator::ANIMATION_HIDE_IMMEDIATELY));
EXPECT_TRUE(
animator_api_->ContainersAreAnimated(
internal::SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS,
@@ -294,7 +294,7 @@ TEST_F(PowerButtonControllerTest, LockAndUnlock) {
EXPECT_TRUE(
animator_api_->ContainersAreAnimated(
internal::SessionStateAnimator::LOCK_SCREEN_CONTAINERS,
- internal::SessionStateAnimator::ANIMATION_HIDE));
+ internal::SessionStateAnimator::ANIMATION_HIDE_IMMEDIATELY));
// Notify that the lock window is visible. We should make it fade in.
state_controller_->OnLockStateChanged(true);
@@ -519,7 +519,7 @@ TEST_F(PowerButtonControllerTest, ShutdownWithoutButton) {
EXPECT_TRUE(
animator_api_->ContainersAreAnimated(
internal::SessionStateAnimator::kAllContainersMask,
- internal::SessionStateAnimator::ANIMATION_HIDE));
+ internal::SessionStateAnimator::ANIMATION_HIDE_IMMEDIATELY));
GenerateMouseMoveEvent();
EXPECT_FALSE(cursor_visible());
}
@@ -532,7 +532,7 @@ TEST_F(PowerButtonControllerTest, RequestShutdownFromLoginScreen) {
EXPECT_TRUE(
animator_api_->ContainersAreAnimated(
internal::SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS,
- internal::SessionStateAnimator::ANIMATION_HIDE));
+ internal::SessionStateAnimator::ANIMATION_HIDE_IMMEDIATELY));
EXPECT_TRUE(
animator_api_->ContainersAreAnimated(
internal::SessionStateAnimator::kAllLockScreenContainersMask,
@@ -553,7 +553,7 @@ TEST_F(PowerButtonControllerTest, RequestShutdownFromLockScreen) {
EXPECT_TRUE(
animator_api_->ContainersAreAnimated(
internal::SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS,
- internal::SessionStateAnimator::ANIMATION_HIDE));
+ internal::SessionStateAnimator::ANIMATION_HIDE_IMMEDIATELY));
EXPECT_TRUE(
animator_api_->ContainersAreAnimated(
internal::SessionStateAnimator::kAllLockScreenContainersMask,
diff --git a/ash/wm/session_state_animator.cc b/ash/wm/session_state_animator.cc
index fcc78e5..b66384b 100644
--- a/ash/wm/session_state_animator.cc
+++ b/ash/wm/session_state_animator.cc
@@ -148,7 +148,8 @@ void FadeInWindow(aura::Window* window,
}
// Makes |window| fully transparent instantaneously.
-void HideWindow(aura::Window* window, ui::LayerAnimationObserver* observer) {
+void HideWindowImmediately(aura::Window* window,
+ ui::LayerAnimationObserver* observer) {
window->layer()->SetOpacity(0.0);
if (observer)
observer->OnLayerAnimationEnded(NULL);
@@ -163,11 +164,12 @@ void RestoreWindow(aura::Window* window, ui::LayerAnimationObserver* observer) {
observer->OnLayerAnimationEnded(NULL);
}
-void RaiseWindow(aura::Window* window,
- base::TimeDelta length,
- ui::LayerAnimationObserver* observer) {
+void HideWindow(aura::Window* window,
+ base::TimeDelta length,
+ WorkspaceAnimationDirection direction,
+ ui::LayerAnimationObserver* observer) {
WorkspaceAnimationDetails details;
- details.direction = WORKSPACE_ANIMATE_UP;
+ details.direction = direction;
details.animate = true;
details.animate_scale = true;
details.animate_opacity = true;
@@ -186,11 +188,12 @@ void RaiseWindow(aura::Window* window,
window->layer()->GetAnimator()->ScheduleAnimation(sequence);
}
-void LowerWindow(aura::Window* window,
- base::TimeDelta length,
- ui::LayerAnimationObserver* observer) {
+void ShowWindow(aura::Window* window,
+ base::TimeDelta length,
+ WorkspaceAnimationDirection direction,
+ ui::LayerAnimationObserver* observer) {
WorkspaceAnimationDetails details;
- details.direction = WORKSPACE_ANIMATE_DOWN;
+ details.direction = direction;
details.animate = true;
details.animate_scale = true;
details.animate_opacity = true;
@@ -272,7 +275,7 @@ bool SessionStateAnimator::TestApi::ContainersAreAnimated(
if (layer->GetTargetOpacity() < 0.9999)
return false;
break;
- case ANIMATION_HIDE:
+ case ANIMATION_HIDE_IMMEDIATELY:
if (layer->GetTargetOpacity() > 0.0001)
return false;
break;
@@ -401,20 +404,34 @@ void SessionStateAnimator::RunAnimationForWindow(
case ANIMATION_FADE_IN:
FadeInWindow(window, observer);
break;
- case ANIMATION_HIDE:
- HideWindow(window, observer);
+ case ANIMATION_HIDE_IMMEDIATELY:
+ HideWindowImmediately(window, observer);
break;
case ANIMATION_RESTORE:
RestoreWindow(window, observer);
break;
- case ANIMATION_RAISE:
- RaiseWindow(window,
+ case ANIMATION_LIFT:
+ HideWindow(window,
base::TimeDelta::FromMilliseconds(kSlowCloseAnimMs),
+ WORKSPACE_ANIMATE_UP,
observer);
break;
- case ANIMATION_LOWER:
- LowerWindow(window,
+ case ANIMATION_DROP:
+ ShowWindow(window,
base::TimeDelta::FromMilliseconds(kSlowCloseAnimMs),
+ WORKSPACE_ANIMATE_DOWN,
+ observer);
+ break;
+ case ANIMATION_RAISE_TO_SCREEN:
+ ShowWindow(window,
+ base::TimeDelta::FromMilliseconds(kSlowCloseAnimMs),
+ WORKSPACE_ANIMATE_UP,
+ observer);
+ break;
+ case ANIMATION_LOWER_BELOW_SCREEN:
+ HideWindow(window,
+ base::TimeDelta::FromMilliseconds(kSlowCloseAnimMs),
+ WORKSPACE_ANIMATE_DOWN,
observer);
break;
case ANIMATION_PARTIAL_FADE_IN:
@@ -443,7 +460,7 @@ void SessionStateAnimator::CreateForeground() {
aura::Window* window = Shell::GetContainer(
Shell::GetPrimaryRootWindow(),
internal::kShellWindowId_PowerButtonAnimationContainer);
- HideWindow(window, NULL);
+ HideWindowImmediately(window, NULL);
foreground_.reset(
new ColoredWindowController(window, "SessionStateAnimatorForeground"));
foreground_->SetColor(SK_ColorWHITE);
diff --git a/ash/wm/session_state_animator.h b/ash/wm/session_state_animator.h
index e332301..0c6013e 100644
--- a/ash/wm/session_state_animator.h
+++ b/ash/wm/session_state_animator.h
@@ -34,10 +34,15 @@ class ASH_EXPORT SessionStateAnimator {
ANIMATION_UNDO_PARTIAL_CLOSE,
ANIMATION_FULL_CLOSE,
ANIMATION_FADE_IN,
- ANIMATION_HIDE,
+ ANIMATION_HIDE_IMMEDIATELY,
ANIMATION_RESTORE,
- ANIMATION_RAISE,
- ANIMATION_LOWER,
+ // Animations that raise/lower windows to/from area "in front" of the
+ // screen.
+ ANIMATION_LIFT,
+ ANIMATION_DROP,
+ // Animations that raise/lower windows from/to area "behind" of the screen.
+ ANIMATION_RAISE_TO_SCREEN,
+ ANIMATION_LOWER_BELOW_SCREEN,
ANIMATION_PARTIAL_FADE_IN,
ANIMATION_UNDO_PARTIAL_FADE_IN,
ANIMATION_FULL_FADE_IN,
diff --git a/ash/wm/session_state_controller_impl.cc b/ash/wm/session_state_controller_impl.cc
index c615a6f..15d04a1 100644
--- a/ash/wm/session_state_controller_impl.cc
+++ b/ash/wm/session_state_controller_impl.cc
@@ -55,7 +55,7 @@ void SessionStateControllerImpl::OnAppTerminating() {
shell->cursor_manager()->ShowCursor(false);
animator_->StartAnimation(
internal::SessionStateAnimator::kAllContainersMask,
- internal::SessionStateAnimator::ANIMATION_HIDE);
+ internal::SessionStateAnimator::ANIMATION_HIDE_IMMEDIATELY);
}
}
@@ -91,7 +91,7 @@ void SessionStateControllerImpl::OnStartingLock() {
animator_->StartAnimation(
internal::SessionStateAnimator::LAUNCHER,
- internal::SessionStateAnimator::ANIMATION_HIDE);
+ internal::SessionStateAnimator::ANIMATION_HIDE_IMMEDIATELY);
animator_->StartAnimation(
internal::SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS,
@@ -100,7 +100,7 @@ void SessionStateControllerImpl::OnStartingLock() {
// Hide the screen locker containers so we can make them fade in later.
animator_->StartAnimation(
internal::SessionStateAnimator::LOCK_SCREEN_CONTAINERS,
- internal::SessionStateAnimator::ANIMATION_HIDE);
+ internal::SessionStateAnimator::ANIMATION_HIDE_IMMEDIATELY);
}
void SessionStateControllerImpl::StartLockAnimationAndLockImmediately() {
@@ -212,7 +212,7 @@ void SessionStateControllerImpl::RequestShutdownImpl() {
animator_->StartAnimation(
internal::SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS |
internal::SessionStateAnimator::LAUNCHER,
- internal::SessionStateAnimator::ANIMATION_HIDE);
+ internal::SessionStateAnimator::ANIMATION_HIDE_IMMEDIATELY);
animator_->StartAnimation(
internal::SessionStateAnimator::kAllLockScreenContainersMask,
internal::SessionStateAnimator::ANIMATION_FULL_CLOSE);
diff --git a/ash/wm/session_state_controller_impl2.cc b/ash/wm/session_state_controller_impl2.cc
index 3e0def0..e08675b 100644
--- a/ash/wm/session_state_controller_impl2.cc
+++ b/ash/wm/session_state_controller_impl2.cc
@@ -69,9 +69,16 @@ void SessionStateControllerImpl2::OnLockStateChanged(bool locked) {
system_is_locked_ = locked;
if (locked) {
- animator_->StartAnimation(
- internal::SessionStateAnimator::LOCK_SCREEN_CONTAINERS,
- internal::SessionStateAnimator::ANIMATION_LOWER);
+ if (CommandLine::ForCurrentProcess()->
+ HasSwitch(ash::switches::kAshReverseNewLockAnimations)) {
+ animator_->StartAnimation(
+ internal::SessionStateAnimator::LOCK_SCREEN_CONTAINERS,
+ internal::SessionStateAnimator::ANIMATION_DROP);
+ } else {
+ animator_->StartAnimation(
+ internal::SessionStateAnimator::LOCK_SCREEN_CONTAINERS,
+ internal::SessionStateAnimator::ANIMATION_RAISE_TO_SCREEN);
+ }
lock_timer_.Stop();
lock_fail_timer_.Stop();
@@ -83,7 +90,7 @@ void SessionStateControllerImpl2::OnLockStateChanged(bool locked) {
animator_->StartAnimation(
internal::SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS |
internal::SessionStateAnimator::LAUNCHER,
- internal::SessionStateAnimator::ANIMATION_LOWER);
+ internal::SessionStateAnimator::ANIMATION_DROP);
}
}
@@ -94,19 +101,19 @@ void SessionStateControllerImpl2::OnStartingLock() {
animator_->StartAnimation(
internal::SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS |
internal::SessionStateAnimator::LAUNCHER,
- internal::SessionStateAnimator::ANIMATION_RAISE);
+ internal::SessionStateAnimator::ANIMATION_LIFT);
// Hide the screen locker containers so we can raise them later.
animator_->StartAnimation(
internal::SessionStateAnimator::LOCK_SCREEN_CONTAINERS,
- internal::SessionStateAnimator::ANIMATION_HIDE);
+ internal::SessionStateAnimator::ANIMATION_HIDE_IMMEDIATELY);
}
void SessionStateControllerImpl2::StartLockAnimationAndLockImmediately() {
animator_->StartAnimation(
internal::SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS |
internal::SessionStateAnimator::LAUNCHER,
- internal::SessionStateAnimator::ANIMATION_RAISE);
+ internal::SessionStateAnimator::ANIMATION_LIFT);
OnLockTimeout();
}
@@ -116,7 +123,7 @@ void SessionStateControllerImpl2::StartLockAnimation(bool shutdown_after_lock) {
animator_->StartAnimation(
internal::SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS |
internal::SessionStateAnimator::LAUNCHER,
- internal::SessionStateAnimator::ANIMATION_RAISE);
+ internal::SessionStateAnimator::ANIMATION_LIFT);
StartLockTimer();
}
@@ -155,7 +162,7 @@ void SessionStateControllerImpl2::CancelLockAnimation() {
animator_->StartAnimation(
internal::SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS |
internal::SessionStateAnimator::LAUNCHER,
- internal::SessionStateAnimator::ANIMATION_LOWER);
+ internal::SessionStateAnimator::ANIMATION_DROP);
lock_timer_.Stop();
}
@@ -240,7 +247,7 @@ void SessionStateControllerImpl2::OnLockFailTimeout() {
animator_->StartAnimation(
internal::SessionStateAnimator::LAUNCHER |
internal::SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS,
- internal::SessionStateAnimator::ANIMATION_LOWER);
+ internal::SessionStateAnimator::ANIMATION_DROP);
}
void SessionStateControllerImpl2::StartLockToShutdownTimer() {
@@ -295,10 +302,18 @@ void SessionStateControllerImpl2::OnRealShutdownTimeout() {
void SessionStateControllerImpl2::OnLockScreenHide(
base::Callback<void(void)>& callback) {
- animator_->StartAnimationWithCallback(
- internal::SessionStateAnimator::LOCK_SCREEN_CONTAINERS,
- internal::SessionStateAnimator::ANIMATION_RAISE,
- callback);
+ if (CommandLine::ForCurrentProcess()->
+ HasSwitch(ash::switches::kAshReverseNewLockAnimations)) {
+ animator_->StartAnimationWithCallback(
+ internal::SessionStateAnimator::LOCK_SCREEN_CONTAINERS,
+ internal::SessionStateAnimator::ANIMATION_LIFT,
+ callback);
+ } else {
+ animator_->StartAnimationWithCallback(
+ internal::SessionStateAnimator::LOCK_SCREEN_CONTAINERS,
+ internal::SessionStateAnimator::ANIMATION_LOWER_BELOW_SCREEN,
+ callback);
+ }
}
} // namespace ash