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 "ui/wm/core/window_animations.h" | 5 #include "ui/wm/core/window_animations.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "base/logging.h" | 14 #include "base/logging.h" |
15 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
16 #include "base/stl_util.h" | 16 #include "base/stl_util.h" |
17 #include "base/time/time.h" | 17 #include "base/time/time.h" |
18 #include "ui/aura/client/aura_constants.h" | 18 #include "ui/aura/client/aura_constants.h" |
19 #include "ui/aura/window.h" | 19 #include "ui/aura/window.h" |
20 #include "ui/aura/window_delegate.h" | 20 #include "ui/aura/window_delegate.h" |
21 #include "ui/aura/window_observer.h" | 21 #include "ui/aura/window_observer.h" |
22 #include "ui/aura/window_property.h" | 22 #include "ui/aura/window_property.h" |
23 #include "ui/compositor/compositor_observer.h" | 23 #include "ui/compositor/compositor_observer.h" |
24 #include "ui/compositor/layer.h" | 24 #include "ui/compositor/layer.h" |
25 #include "ui/compositor/layer_animation_observer.h" | 25 #include "ui/compositor/layer_animation_observer.h" |
26 #include "ui/compositor/layer_animation_sequence.h" | 26 #include "ui/compositor/layer_animation_sequence.h" |
27 #include "ui/compositor/layer_animator.h" | 27 #include "ui/compositor/layer_animator.h" |
28 #include "ui/compositor/layer_tree_owner.h" | 28 #include "ui/compositor/layer_tree_owner.h" |
| 29 #include "ui/compositor/scoped_animation_duration_scale_mode.h" |
29 #include "ui/compositor/scoped_layer_animation_settings.h" | 30 #include "ui/compositor/scoped_layer_animation_settings.h" |
30 #include "ui/gfx/animation/animation.h" | 31 #include "ui/gfx/animation/animation.h" |
31 #include "ui/gfx/interpolated_transform.h" | 32 #include "ui/gfx/interpolated_transform.h" |
32 #include "ui/gfx/rect_conversions.h" | 33 #include "ui/gfx/rect_conversions.h" |
33 #include "ui/gfx/screen.h" | 34 #include "ui/gfx/screen.h" |
34 #include "ui/gfx/vector2d.h" | 35 #include "ui/gfx/vector2d.h" |
35 #include "ui/gfx/vector3d_f.h" | 36 #include "ui/gfx/vector3d_f.h" |
36 #include "ui/wm/core/window_util.h" | 37 #include "ui/wm/core/window_util.h" |
37 #include "ui/wm/core/wm_core_switches.h" | 38 #include "ui/wm/core/wm_core_switches.h" |
38 #include "ui/wm/public/animation_host.h" | 39 #include "ui/wm/public/animation_host.h" |
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
642 case WINDOW_ANIMATION_TYPE_BOUNCE: | 643 case WINDOW_ANIMATION_TYPE_BOUNCE: |
643 AnimateBounce(window); | 644 AnimateBounce(window); |
644 return true; | 645 return true; |
645 default: | 646 default: |
646 NOTREACHED(); | 647 NOTREACHED(); |
647 return false; | 648 return false; |
648 } | 649 } |
649 } | 650 } |
650 | 651 |
651 bool WindowAnimationsDisabled(aura::Window* window) { | 652 bool WindowAnimationsDisabled(aura::Window* window) { |
652 return (!gfx::Animation::ShouldRenderRichAnimation() || (window && | 653 // Individual windows can choose to skip animations. |
653 window->GetProperty(aura::client::kAnimationsDisabledKey)) || | 654 if (window && window->GetProperty(aura::client::kAnimationsDisabledKey)) |
654 CommandLine::ForCurrentProcess()->HasSwitch( | 655 return true; |
655 switches::kWindowAnimationsDisabled)); | 656 |
| 657 // Animations can be disabled globally for testing. |
| 658 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 659 switches::kWindowAnimationsDisabled)) |
| 660 return true; |
| 661 |
| 662 // Tests of animations themselves should still run even if the machine is |
| 663 // being accessed via Remote Desktop. |
| 664 if (ui::ScopedAnimationDurationScaleMode::duration_scale_mode() == |
| 665 ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION) |
| 666 return false; |
| 667 |
| 668 // Let the user decide whether or not to play the animation. |
| 669 return !gfx::Animation::ShouldRenderRichAnimation(); |
656 } | 670 } |
657 | 671 |
658 } // namespace wm | 672 } // namespace wm |
OLD | NEW |