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

Unified Diff: ash/wm/session_state_animator.cc

Issue 11453012: Fix black background when locking with fullscreen window: (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Add fix for shutdown cut-off timing Created 8 years 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 side-by-side diff with in-line comments
Download patch
Index: ash/wm/session_state_animator.cc
diff --git a/ash/wm/session_state_animator.cc b/ash/wm/session_state_animator.cc
index 6f55b90a6b5f965c84df2702587cad6fe5f375b1..99d924c8288fc57182232a7bd93068a5fa90ecf9 100644
--- a/ash/wm/session_state_animator.cc
+++ b/ash/wm/session_state_animator.cc
@@ -120,15 +120,16 @@ void StartPartialFadeAnimation(aura::Window* window,
sequence->AddObserver(observer);
}
-// Fades |window| in to full opacity over |duration|.
-void FadeInWindow(aura::Window* window,
- base::TimeDelta duration,
- ui::LayerAnimationObserver* observer) {
+// Fades |window| in to |opacity| over |duration|.
+void StartOpacityAnimationForWindow(aura::Window* window,
+ float opacity,
+ base::TimeDelta duration,
+ ui::LayerAnimationObserver* observer) {
ui::LayerAnimator* animator = window->layer()->GetAnimator();
animator->set_preemption_strategy(
ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
ui::LayerAnimationSequence* sequence = new ui::LayerAnimationSequence(
- ui::LayerAnimationElement::CreateOpacityElement(1.0, duration));
+ ui::LayerAnimationElement::CreateOpacityElement(opacity, duration));
animator->StartAnimation(sequence);
if (observer)
sequence->AddObserver(observer);
@@ -188,19 +189,15 @@ void HideWindow(aura::Window* window,
}
}
-void ShowWindow(aura::Window* window,
- base::TimeDelta duration,
- bool above,
- ui::LayerAnimationObserver* observer) {
+void TransformWindowToBaseState(aura::Window* window,
+ base::TimeDelta duration,
+ ui::LayerAnimationObserver* observer) {
ui::Layer* layer = window->layer();
ui::ScopedLayerAnimationSettings settings(layer->GetAnimator());
- // Set initial state of animation
- settings.SetTransitionDuration(base::TimeDelta());
- SetTransformForScaleAnimation(layer,
- above ? LAYER_SCALE_ANIMATION_ABOVE : LAYER_SCALE_ANIMATION_BELOW);
-
// Animate to target values.
+ settings.SetPreemptionStrategy(
+ ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
settings.SetTransitionDuration(duration);
settings.SetTweenType(ui::Tween::EASE_OUT);
@@ -223,6 +220,23 @@ void ShowWindow(aura::Window* window,
}
}
+void ShowWindow(aura::Window* window,
+ base::TimeDelta duration,
+ bool above,
+ ui::LayerAnimationObserver* observer) {
+ ui::Layer* layer = window->layer();
+ ui::ScopedLayerAnimationSettings settings(layer->GetAnimator());
+
+ // Set initial state of animation
+ settings.SetPreemptionStrategy(
+ ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
+ settings.SetTransitionDuration(base::TimeDelta());
+ SetTransformForScaleAnimation(layer,
+ above ? LAYER_SCALE_ANIMATION_ABOVE : LAYER_SCALE_ANIMATION_BELOW);
+
+ TransformWindowToBaseState(window, duration, observer);
+}
+
// Starts grayscale/brightness animation for |window| over |duration|. Target
// value for both grayscale and brightness are specified by |target|.
void StartGrayscaleBrightnessAnimationForWindow(
@@ -299,6 +313,10 @@ bool IsLayerAnimated(ui::Layer* layer,
if (layer->GetTargetOpacity() < 0.9999)
return false;
break;
+ case SessionStateAnimator::ANIMATION_FADE_OUT:
+ if (layer->GetTargetOpacity() > 0.0001)
+ return false;
+ break;
case SessionStateAnimator::ANIMATION_HIDE_IMMEDIATELY:
if (layer->GetTargetOpacity() > 0.0001)
return false;
@@ -318,6 +336,7 @@ bool IsLayerAnimated(ui::Layer* layer,
return false;
break;
case SessionStateAnimator::ANIMATION_DROP:
+ case SessionStateAnimator::ANIMATION_UNDO_LIFT:
//ToDo(antim) : check other effects
if (layer->GetTargetOpacity() < 0.9999)
return false;
@@ -458,11 +477,6 @@ void SessionStateAnimator::GetContainers(int container_mask,
root_window,
internal::kShellWindowId_LockScreenRelatedContainersContainer));
}
- if (container_mask & LOCK_SCREEN_SYSTEM_FOREGROUND) {
- containers->push_back(Shell::GetContainer(
- root_window,
- internal::kShellWindowId_PowerButtonAnimationContainer));
- }
}
void SessionStateAnimator::StartAnimation(int container_mask,
@@ -492,6 +506,19 @@ void SessionStateAnimator::StartAnimationWithCallback(
}
}
+void SessionStateAnimator::StartAnimationWithObserver(
+ int container_mask,
+ AnimationType type,
+ AnimationSpeed speed,
+ ui::LayerAnimationObserver* observer) {
+ aura::Window::Windows containers;
+ GetContainers(container_mask, &containers);
+ for (aura::Window::Windows::const_iterator it = containers.begin();
+ it != containers.end(); ++it) {
+ RunAnimationForWindow(*it, type, speed, observer);
+ }
+}
+
void SessionStateAnimator::StartGlobalAnimation(AnimationType type,
AnimationSpeed speed) {
aura::RootWindow* root_window = Shell::GetPrimaryRootWindow();
@@ -516,7 +543,10 @@ void SessionStateAnimator::RunAnimationForWindow(
StartFastCloseAnimationForWindow(window, duration, observer);
break;
case ANIMATION_FADE_IN:
- FadeInWindow(window, duration, observer);
+ StartOpacityAnimationForWindow(window, 1.0, duration, observer);
+ break;
+ case ANIMATION_FADE_OUT:
+ StartOpacityAnimationForWindow(window, 0.0, duration, observer);
break;
case ANIMATION_HIDE_IMMEDIATELY:
DCHECK_EQ(speed, ANIMATION_SPEED_IMMEDIATE);
@@ -532,6 +562,9 @@ void SessionStateAnimator::RunAnimationForWindow(
case ANIMATION_DROP:
ShowWindow(window, duration, true, observer);
break;
+ case ANIMATION_UNDO_LIFT:
+ TransformWindowToBaseState(window, duration, observer);
+ break;
case ANIMATION_RAISE_TO_SCREEN:
ShowWindow(window, duration, false, observer);
break;

Powered by Google App Engine
This is Rietveld 408576698