OLD | NEW |
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_impl.h" | 5 #include "ash/wm/session_state_animator_impl.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/shell_window_ids.h" | 10 #include "ash/shell_window_ids.h" |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 public: | 294 public: |
295 explicit CallbackAnimationObserver(base::Closure callback) | 295 explicit CallbackAnimationObserver(base::Closure callback) |
296 : callback_(callback) { | 296 : callback_(callback) { |
297 } | 297 } |
298 virtual ~CallbackAnimationObserver() { | 298 virtual ~CallbackAnimationObserver() { |
299 } | 299 } |
300 | 300 |
301 private: | 301 private: |
302 // Overridden from ui::LayerAnimationObserver: | 302 // Overridden from ui::LayerAnimationObserver: |
303 virtual void OnLayerAnimationEnded(ui::LayerAnimationSequence* seq) | 303 virtual void OnLayerAnimationEnded(ui::LayerAnimationSequence* seq) |
304 OVERRIDE { | 304 override { |
305 // Drop foreground once animation is over. | 305 // Drop foreground once animation is over. |
306 callback_.Run(); | 306 callback_.Run(); |
307 delete this; | 307 delete this; |
308 } | 308 } |
309 | 309 |
310 virtual void OnLayerAnimationAborted(ui::LayerAnimationSequence* seq) | 310 virtual void OnLayerAnimationAborted(ui::LayerAnimationSequence* seq) |
311 OVERRIDE { | 311 override { |
312 // Drop foreground once animation is over. | 312 // Drop foreground once animation is over. |
313 callback_.Run(); | 313 callback_.Run(); |
314 delete this; | 314 delete this; |
315 } | 315 } |
316 | 316 |
317 virtual void OnLayerAnimationScheduled(ui::LayerAnimationSequence* seq) | 317 virtual void OnLayerAnimationScheduled(ui::LayerAnimationSequence* seq) |
318 OVERRIDE {} | 318 override {} |
319 | 319 |
320 base::Closure callback_; | 320 base::Closure callback_; |
321 | 321 |
322 DISALLOW_COPY_AND_ASSIGN(CallbackAnimationObserver); | 322 DISALLOW_COPY_AND_ASSIGN(CallbackAnimationObserver); |
323 }; | 323 }; |
324 | 324 |
325 | 325 |
326 bool IsLayerAnimated(ui::Layer* layer, | 326 bool IsLayerAnimated(ui::Layer* layer, |
327 SessionStateAnimator::AnimationType type) { | 327 SessionStateAnimator::AnimationType type) { |
328 switch (type) { | 328 switch (type) { |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 : SessionStateAnimator::AnimationSequence(callback), | 414 : SessionStateAnimator::AnimationSequence(callback), |
415 animator_(animator), | 415 animator_(animator), |
416 sequences_attached_(0), | 416 sequences_attached_(0), |
417 sequences_completed_(0) { | 417 sequences_completed_(0) { |
418 } | 418 } |
419 | 419 |
420 // SessionStateAnimator::AnimationSequence: | 420 // SessionStateAnimator::AnimationSequence: |
421 virtual void StartAnimation( | 421 virtual void StartAnimation( |
422 int container_mask, | 422 int container_mask, |
423 SessionStateAnimator::AnimationType type, | 423 SessionStateAnimator::AnimationType type, |
424 SessionStateAnimator::AnimationSpeed speed) OVERRIDE { | 424 SessionStateAnimator::AnimationSpeed speed) override { |
425 animator_->StartAnimationInSequence(container_mask, type, speed, this); | 425 animator_->StartAnimationInSequence(container_mask, type, speed, this); |
426 } | 426 } |
427 | 427 |
428 private: | 428 private: |
429 virtual ~AnimationSequence() {} | 429 virtual ~AnimationSequence() {} |
430 | 430 |
431 // ui::LayerAnimationObserver: | 431 // ui::LayerAnimationObserver: |
432 virtual void OnLayerAnimationEnded( | 432 virtual void OnLayerAnimationEnded( |
433 ui::LayerAnimationSequence* sequence) OVERRIDE { | 433 ui::LayerAnimationSequence* sequence) override { |
434 sequences_completed_++; | 434 sequences_completed_++; |
435 if (sequences_completed_ == sequences_attached_) | 435 if (sequences_completed_ == sequences_attached_) |
436 OnAnimationCompleted(); | 436 OnAnimationCompleted(); |
437 } | 437 } |
438 | 438 |
439 virtual void OnLayerAnimationAborted( | 439 virtual void OnLayerAnimationAborted( |
440 ui::LayerAnimationSequence* sequence) OVERRIDE { | 440 ui::LayerAnimationSequence* sequence) override { |
441 sequences_completed_++; | 441 sequences_completed_++; |
442 if (sequences_completed_ == sequences_attached_) | 442 if (sequences_completed_ == sequences_attached_) |
443 OnAnimationAborted(); | 443 OnAnimationAborted(); |
444 } | 444 } |
445 | 445 |
446 virtual void OnLayerAnimationScheduled( | 446 virtual void OnLayerAnimationScheduled( |
447 ui::LayerAnimationSequence* sequence) OVERRIDE {} | 447 ui::LayerAnimationSequence* sequence) override {} |
448 | 448 |
449 virtual void OnAttachedToSequence( | 449 virtual void OnAttachedToSequence( |
450 ui::LayerAnimationSequence* sequence) OVERRIDE { | 450 ui::LayerAnimationSequence* sequence) override { |
451 LayerAnimationObserver::OnAttachedToSequence(sequence); | 451 LayerAnimationObserver::OnAttachedToSequence(sequence); |
452 sequences_attached_++; | 452 sequences_attached_++; |
453 } | 453 } |
454 | 454 |
455 SessionStateAnimatorImpl* animator_; // not owned | 455 SessionStateAnimatorImpl* animator_; // not owned |
456 | 456 |
457 // Number of sequences this observer was attached to. | 457 // Number of sequences this observer was attached to. |
458 int sequences_attached_; | 458 int sequences_attached_; |
459 | 459 |
460 // Number of sequences either ended or aborted. | 460 // Number of sequences either ended or aborted. |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
660 window, 1.0, duration, gfx::Tween::EASE_IN, observer); | 660 window, 1.0, duration, gfx::Tween::EASE_IN, observer); |
661 break; | 661 break; |
662 case ANIMATION_UNDO_GRAYSCALE_BRIGHTNESS: | 662 case ANIMATION_UNDO_GRAYSCALE_BRIGHTNESS: |
663 StartGrayscaleBrightnessAnimationForWindow( | 663 StartGrayscaleBrightnessAnimationForWindow( |
664 window, 0.0, duration, gfx::Tween::EASE_IN_OUT, observer); | 664 window, 0.0, duration, gfx::Tween::EASE_IN_OUT, observer); |
665 break; | 665 break; |
666 } | 666 } |
667 } | 667 } |
668 | 668 |
669 } // namespace ash | 669 } // namespace ash |
OLD | NEW |