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

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

Issue 11783032: ash: Fix abort-shutdown animation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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 | « no previous file | ash/wm/session_state_controller_impl2.cc » ('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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 ui::LayerAnimationObserver* observer) { 250 ui::LayerAnimationObserver* observer) {
250 ui::LayerAnimator* animator = window->layer()->GetAnimator(); 251 ui::LayerAnimator* animator = window->layer()->GetAnimator();
251 252
252 scoped_ptr<ui::LayerAnimationSequence> brightness_sequence( 253 scoped_ptr<ui::LayerAnimationSequence> brightness_sequence(
253 new ui::LayerAnimationSequence()); 254 new ui::LayerAnimationSequence());
254 scoped_ptr<ui::LayerAnimationSequence> grayscale_sequence( 255 scoped_ptr<ui::LayerAnimationSequence> grayscale_sequence(
255 new ui::LayerAnimationSequence()); 256 new ui::LayerAnimationSequence());
256 257
257 scoped_ptr<ui::LayerAnimationElement> brightness_element( 258 scoped_ptr<ui::LayerAnimationElement> brightness_element(
258 ui::LayerAnimationElement::CreateBrightnessElement( 259 ui::LayerAnimationElement::CreateBrightnessElement(
259 target, duration)); 260 target, duration));
260 brightness_element->set_tween_type(ui::Tween::EASE_IN); 261 brightness_element->set_tween_type(tween_type);
261 brightness_sequence->AddElement(brightness_element.release()); 262 brightness_sequence->AddElement(brightness_element.release());
262 263
263 scoped_ptr<ui::LayerAnimationElement> grayscale_element( 264 scoped_ptr<ui::LayerAnimationElement> grayscale_element(
264 ui::LayerAnimationElement::CreateGrayscaleElement( 265 ui::LayerAnimationElement::CreateGrayscaleElement(
265 target, duration)); 266 target, duration));
266 grayscale_element->set_tween_type(ui::Tween::EASE_IN); 267 grayscale_element->set_tween_type(tween_type);
267 grayscale_sequence->AddElement(grayscale_element.release()); 268 grayscale_sequence->AddElement(grayscale_element.release());
268 269
269 std::vector<ui::LayerAnimationSequence*> animations; 270 std::vector<ui::LayerAnimationSequence*> animations;
270 animations.push_back(brightness_sequence.release()); 271 animations.push_back(brightness_sequence.release());
271 animations.push_back(grayscale_sequence.release()); 272 animations.push_back(grayscale_sequence.release());
272 273
273 if (observer) 274 if (observer)
274 animations[0]->AddObserver(observer); 275 animations[0]->AddObserver(observer);
275 276
276 animator->set_preemption_strategy( 277 animator->set_preemption_strategy(
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 return base::TimeDelta::FromMilliseconds(400); 433 return base::TimeDelta::FromMilliseconds(400);
433 case ANIMATION_SPEED_REVERT: 434 case ANIMATION_SPEED_REVERT:
434 return base::TimeDelta::FromMilliseconds(150); 435 return base::TimeDelta::FromMilliseconds(150);
435 case ANIMATION_SPEED_FAST: 436 case ANIMATION_SPEED_FAST:
436 return base::TimeDelta::FromMilliseconds(150); 437 return base::TimeDelta::FromMilliseconds(150);
437 case ANIMATION_SPEED_SHOW_LOCK_SCREEN: 438 case ANIMATION_SPEED_SHOW_LOCK_SCREEN:
438 return base::TimeDelta::FromMilliseconds(200); 439 return base::TimeDelta::FromMilliseconds(200);
439 case ANIMATION_SPEED_MOVE_WINDOWS: 440 case ANIMATION_SPEED_MOVE_WINDOWS:
440 return base::TimeDelta::FromMilliseconds(350); 441 return base::TimeDelta::FromMilliseconds(350);
441 case ANIMATION_SPEED_UNDO_MOVE_WINDOWS: 442 case ANIMATION_SPEED_UNDO_MOVE_WINDOWS:
442 return base::TimeDelta::FromMilliseconds(500); 443 return base::TimeDelta::FromMilliseconds(350);
443 case ANIMATION_SPEED_SHUTDOWN: 444 case ANIMATION_SPEED_SHUTDOWN:
444 return base::TimeDelta::FromMilliseconds(1000); 445 return base::TimeDelta::FromMilliseconds(1000);
445 case ANIMATION_SPEED_REVERT_SHUTDOWN: 446 case ANIMATION_SPEED_REVERT_SHUTDOWN:
446 return base::TimeDelta::FromMilliseconds(1500); 447 return base::TimeDelta::FromMilliseconds(500);
447 } 448 }
448 // Satisfy compilers that do not understand that we will return from switch 449 // Satisfy compilers that do not understand that we will return from switch
449 // above anyway. 450 // above anyway.
450 DCHECK(false) << "Unhandled animation speed " << speed; 451 DCHECK(false) << "Unhandled animation speed " << speed;
451 return base::TimeDelta(); 452 return base::TimeDelta();
452 } 453 }
453 454
454 // Fills |containers| with the containers described by |container_mask|. 455 // Fills |containers| with the containers described by |container_mask|.
455 void SessionStateAnimator::GetContainers(int container_mask, 456 void SessionStateAnimator::GetContainers(int container_mask,
456 aura::Window::Windows* containers) { 457 aura::Window::Windows* containers) {
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 window, kPartialFadeRatio, duration, observer); 597 window, kPartialFadeRatio, duration, observer);
597 break; 598 break;
598 case ANIMATION_UNDO_PARTIAL_FADE_IN: 599 case ANIMATION_UNDO_PARTIAL_FADE_IN:
599 StartPartialFadeAnimation(window, 0.0, duration, observer); 600 StartPartialFadeAnimation(window, 0.0, duration, observer);
600 break; 601 break;
601 case ANIMATION_FULL_FADE_IN: 602 case ANIMATION_FULL_FADE_IN:
602 StartPartialFadeAnimation(window, 1.0, duration, observer); 603 StartPartialFadeAnimation(window, 1.0, duration, observer);
603 break; 604 break;
604 case ANIMATION_GRAYSCALE_BRIGHTNESS: 605 case ANIMATION_GRAYSCALE_BRIGHTNESS:
605 StartGrayscaleBrightnessAnimationForWindow( 606 StartGrayscaleBrightnessAnimationForWindow(
606 window, 1.0, duration, observer); 607 window, 1.0, duration, ui::Tween::EASE_IN, observer);
607 break; 608 break;
608 case ANIMATION_UNDO_GRAYSCALE_BRIGHTNESS: 609 case ANIMATION_UNDO_GRAYSCALE_BRIGHTNESS:
609 StartGrayscaleBrightnessAnimationForWindow( 610 StartGrayscaleBrightnessAnimationForWindow(
610 window, 0.0, duration, observer); 611 window, 0.0, duration, ui::Tween::EASE_IN_OUT, observer);
611 break; 612 break;
612 } 613 }
613 } 614 }
614 615
615 void SessionStateAnimator::CreateForeground() { 616 void SessionStateAnimator::CreateForeground() {
616 if (foreground_.get()) 617 if (foreground_.get())
617 return; 618 return;
618 aura::Window* window = Shell::GetContainer( 619 aura::Window* window = Shell::GetContainer(
619 Shell::GetPrimaryRootWindow(), 620 Shell::GetPrimaryRootWindow(),
620 internal::kShellWindowId_PowerButtonAnimationContainer); 621 internal::kShellWindowId_PowerButtonAnimationContainer);
621 HideWindowImmediately(window, NULL); 622 HideWindowImmediately(window, NULL);
622 foreground_.reset( 623 foreground_.reset(
623 new ColoredWindowController(window, "SessionStateAnimatorForeground")); 624 new ColoredWindowController(window, "SessionStateAnimatorForeground"));
624 foreground_->SetColor(SK_ColorWHITE); 625 foreground_->SetColor(SK_ColorWHITE);
625 foreground_->GetWidget()->Show(); 626 foreground_->GetWidget()->Show();
626 } 627 }
627 628
628 void SessionStateAnimator::DropForeground() { 629 void SessionStateAnimator::DropForeground() {
629 foreground_.reset(); 630 foreground_.reset();
630 } 631 }
631 632
632 } // namespace internal 633 } // namespace internal
633 } // namespace ash 634 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/wm/session_state_controller_impl2.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698