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

Side by Side Diff: ash/wm/session_state_animator.cc

Issue 23531053: ui/base/animation -> ui/gfx/animation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge 2 trunk Created 7 years, 3 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/wm/panels/panel_frame_view.cc ('k') | ash/wm/system_gesture_event_filter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/wm/session_state_animator.h" 5 #include "ash/wm/session_state_animator.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/shell_window_ids.h" 8 #include "ash/shell_window_ids.h"
9 #include "ash/wm/window_animations.h" 9 #include "ash/wm/window_animations.h"
10 #include "ui/aura/client/aura_constants.h" 10 #include "ui/aura/client/aura_constants.h"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 base::TimeDelta duration, 156 base::TimeDelta duration,
157 bool above, 157 bool above,
158 ui::LayerAnimationObserver* observer) { 158 ui::LayerAnimationObserver* observer) {
159 ui::Layer* layer = window->layer(); 159 ui::Layer* layer = window->layer();
160 ui::ScopedLayerAnimationSettings settings(layer->GetAnimator()); 160 ui::ScopedLayerAnimationSettings settings(layer->GetAnimator());
161 161
162 settings.SetPreemptionStrategy( 162 settings.SetPreemptionStrategy(
163 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); 163 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
164 settings.SetTransitionDuration(duration); 164 settings.SetTransitionDuration(duration);
165 165
166 settings.SetTweenType(ui::Tween::EASE_OUT); 166 settings.SetTweenType(gfx::Tween::EASE_OUT);
167 SetTransformForScaleAnimation(layer, 167 SetTransformForScaleAnimation(layer,
168 above ? LAYER_SCALE_ANIMATION_ABOVE : LAYER_SCALE_ANIMATION_BELOW); 168 above ? LAYER_SCALE_ANIMATION_ABOVE : LAYER_SCALE_ANIMATION_BELOW);
169 169
170 settings.SetTweenType(ui::Tween::EASE_IN_OUT); 170 settings.SetTweenType(gfx::Tween::EASE_IN_OUT);
171 layer->SetOpacity(0.0f); 171 layer->SetOpacity(0.0f);
172 172
173 // After the animation completes snap the transform back to the identity, 173 // After the animation completes snap the transform back to the identity,
174 // otherwise any one that asks for screen bounds gets a slightly scaled 174 // otherwise any one that asks for screen bounds gets a slightly scaled
175 // version. 175 // version.
176 settings.SetPreemptionStrategy(ui::LayerAnimator::ENQUEUE_NEW_ANIMATION); 176 settings.SetPreemptionStrategy(ui::LayerAnimator::ENQUEUE_NEW_ANIMATION);
177 settings.SetTransitionDuration(base::TimeDelta()); 177 settings.SetTransitionDuration(base::TimeDelta());
178 layer->SetTransform(gfx::Transform()); 178 layer->SetTransform(gfx::Transform());
179 179
180 // A bit of a dirty trick: we need to catch the end of the animation we don't 180 // A bit of a dirty trick: we need to catch the end of the animation we don't
(...skipping 15 matching lines...) Expand all
196 base::TimeDelta duration, 196 base::TimeDelta duration,
197 ui::LayerAnimationObserver* observer) { 197 ui::LayerAnimationObserver* observer) {
198 ui::Layer* layer = window->layer(); 198 ui::Layer* layer = window->layer();
199 ui::ScopedLayerAnimationSettings settings(layer->GetAnimator()); 199 ui::ScopedLayerAnimationSettings settings(layer->GetAnimator());
200 200
201 // Animate to target values. 201 // Animate to target values.
202 settings.SetPreemptionStrategy( 202 settings.SetPreemptionStrategy(
203 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); 203 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
204 settings.SetTransitionDuration(duration); 204 settings.SetTransitionDuration(duration);
205 205
206 settings.SetTweenType(ui::Tween::EASE_OUT); 206 settings.SetTweenType(gfx::Tween::EASE_OUT);
207 layer->SetTransform(gfx::Transform()); 207 layer->SetTransform(gfx::Transform());
208 208
209 settings.SetTweenType(ui::Tween::EASE_IN_OUT); 209 settings.SetTweenType(gfx::Tween::EASE_IN_OUT);
210 layer->SetOpacity(1.0f); 210 layer->SetOpacity(1.0f);
211 211
212 // A bit of a dirty trick: we need to catch the end of the animation we don't 212 // A bit of a dirty trick: we need to catch the end of the animation we don't
213 // control. So we use two facts we know: which animator will be used and the 213 // control. So we use two facts we know: which animator will be used and the
214 // target opacity to add "Do nothing" animation sequence. 214 // target opacity to add "Do nothing" animation sequence.
215 // Unfortunately, we can not just use empty LayerAnimationSequence, because 215 // Unfortunately, we can not just use empty LayerAnimationSequence, because
216 // it does not call NotifyEnded(). 216 // it does not call NotifyEnded().
217 if (observer) { 217 if (observer) {
218 ui::LayerAnimationSequence* sequence = new ui::LayerAnimationSequence( 218 ui::LayerAnimationSequence* sequence = new ui::LayerAnimationSequence(
219 ui::LayerAnimationElement::CreateOpacityElement( 219 ui::LayerAnimationElement::CreateOpacityElement(
(...skipping 19 matching lines...) Expand all
239 239
240 TransformWindowToBaseState(window, duration, observer); 240 TransformWindowToBaseState(window, duration, observer);
241 } 241 }
242 242
243 // Starts grayscale/brightness animation for |window| over |duration|. Target 243 // Starts grayscale/brightness animation for |window| over |duration|. Target
244 // value for both grayscale and brightness are specified by |target|. 244 // value for both grayscale and brightness are specified by |target|.
245 void StartGrayscaleBrightnessAnimationForWindow( 245 void StartGrayscaleBrightnessAnimationForWindow(
246 aura::Window* window, 246 aura::Window* window,
247 float target, 247 float target,
248 base::TimeDelta duration, 248 base::TimeDelta duration,
249 ui::Tween::Type tween_type, 249 gfx::Tween::Type tween_type,
250 ui::LayerAnimationObserver* observer) { 250 ui::LayerAnimationObserver* observer) {
251 ui::LayerAnimator* animator = window->layer()->GetAnimator(); 251 ui::LayerAnimator* animator = window->layer()->GetAnimator();
252 252
253 scoped_ptr<ui::LayerAnimationSequence> brightness_sequence( 253 scoped_ptr<ui::LayerAnimationSequence> brightness_sequence(
254 new ui::LayerAnimationSequence()); 254 new ui::LayerAnimationSequence());
255 scoped_ptr<ui::LayerAnimationSequence> grayscale_sequence( 255 scoped_ptr<ui::LayerAnimationSequence> grayscale_sequence(
256 new ui::LayerAnimationSequence()); 256 new ui::LayerAnimationSequence());
257 257
258 scoped_ptr<ui::LayerAnimationElement> brightness_element( 258 scoped_ptr<ui::LayerAnimationElement> brightness_element(
259 ui::LayerAnimationElement::CreateBrightnessElement( 259 ui::LayerAnimationElement::CreateBrightnessElement(
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 window, kPartialFadeRatio, duration, observer); 597 window, kPartialFadeRatio, duration, observer);
598 break; 598 break;
599 case ANIMATION_UNDO_PARTIAL_FADE_IN: 599 case ANIMATION_UNDO_PARTIAL_FADE_IN:
600 StartPartialFadeAnimation(window, 0.0, duration, observer); 600 StartPartialFadeAnimation(window, 0.0, duration, observer);
601 break; 601 break;
602 case ANIMATION_FULL_FADE_IN: 602 case ANIMATION_FULL_FADE_IN:
603 StartPartialFadeAnimation(window, 1.0, duration, observer); 603 StartPartialFadeAnimation(window, 1.0, duration, observer);
604 break; 604 break;
605 case ANIMATION_GRAYSCALE_BRIGHTNESS: 605 case ANIMATION_GRAYSCALE_BRIGHTNESS:
606 StartGrayscaleBrightnessAnimationForWindow( 606 StartGrayscaleBrightnessAnimationForWindow(
607 window, 1.0, duration, ui::Tween::EASE_IN, observer); 607 window, 1.0, duration, gfx::Tween::EASE_IN, observer);
608 break; 608 break;
609 case ANIMATION_UNDO_GRAYSCALE_BRIGHTNESS: 609 case ANIMATION_UNDO_GRAYSCALE_BRIGHTNESS:
610 StartGrayscaleBrightnessAnimationForWindow( 610 StartGrayscaleBrightnessAnimationForWindow(
611 window, 0.0, duration, ui::Tween::EASE_IN_OUT, observer); 611 window, 0.0, duration, gfx::Tween::EASE_IN_OUT, observer);
612 break; 612 break;
613 } 613 }
614 } 614 }
615 615
616 void SessionStateAnimator::CreateForeground() { 616 void SessionStateAnimator::CreateForeground() {
617 if (foreground_) 617 if (foreground_)
618 return; 618 return;
619 aura::Window* window = Shell::GetContainer( 619 aura::Window* window = Shell::GetContainer(
620 Shell::GetPrimaryRootWindow(), 620 Shell::GetPrimaryRootWindow(),
621 internal::kShellWindowId_PowerButtonAnimationContainer); 621 internal::kShellWindowId_PowerButtonAnimationContainer);
622 HideWindowImmediately(window, NULL); 622 HideWindowImmediately(window, NULL);
623 foreground_.reset( 623 foreground_.reset(
624 new ColoredWindowController(window, "SessionStateAnimatorForeground")); 624 new ColoredWindowController(window, "SessionStateAnimatorForeground"));
625 foreground_->SetColor(SK_ColorWHITE); 625 foreground_->SetColor(SK_ColorWHITE);
626 foreground_->GetWidget()->Show(); 626 foreground_->GetWidget()->Show();
627 } 627 }
628 628
629 void SessionStateAnimator::DropForeground() { 629 void SessionStateAnimator::DropForeground() {
630 foreground_.reset(); 630 foreground_.reset();
631 } 631 }
632 632
633 } // namespace internal 633 } // namespace internal
634 } // namespace ash 634 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/panels/panel_frame_view.cc ('k') | ash/wm/system_gesture_event_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698