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

Side by Side Diff: ui/wm/core/window_animations.cc

Issue 2632543003: Refactor and push window properties up to class properties. (Closed)
Patch Set: More build fixes Created 3 years, 10 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
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 "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 <memory> 10 #include <memory>
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/macros.h" 15 #include "base/macros.h"
16 #include "base/memory/ptr_util.h" 16 #include "base/memory/ptr_util.h"
17 #include "base/message_loop/message_loop.h" 17 #include "base/message_loop/message_loop.h"
18 #include "base/stl_util.h" 18 #include "base/stl_util.h"
19 #include "base/time/time.h" 19 #include "base/time/time.h"
20 #include "ui/aura/client/aura_constants.h" 20 #include "ui/aura/client/aura_constants.h"
21 #include "ui/aura/window.h" 21 #include "ui/aura/window.h"
22 #include "ui/aura/window_delegate.h" 22 #include "ui/aura/window_delegate.h"
23 #include "ui/aura/window_observer.h" 23 #include "ui/aura/window_observer.h"
24 #include "ui/aura/window_property.h" 24 #include "ui/base/class_property.h"
25 #include "ui/compositor/compositor_observer.h" 25 #include "ui/compositor/compositor_observer.h"
26 #include "ui/compositor/layer.h" 26 #include "ui/compositor/layer.h"
27 #include "ui/compositor/layer_animation_observer.h" 27 #include "ui/compositor/layer_animation_observer.h"
28 #include "ui/compositor/layer_animation_sequence.h" 28 #include "ui/compositor/layer_animation_sequence.h"
29 #include "ui/compositor/layer_animator.h" 29 #include "ui/compositor/layer_animator.h"
30 #include "ui/compositor/layer_tree_owner.h" 30 #include "ui/compositor/layer_tree_owner.h"
31 #include "ui/compositor/scoped_animation_duration_scale_mode.h" 31 #include "ui/compositor/scoped_animation_duration_scale_mode.h"
32 #include "ui/compositor/scoped_layer_animation_settings.h" 32 #include "ui/compositor/scoped_layer_animation_settings.h"
33 #include "ui/gfx/animation/animation.h" 33 #include "ui/gfx/animation/animation.h"
34 #include "ui/gfx/geometry/rect_conversions.h" 34 #include "ui/gfx/geometry/rect_conversions.h"
35 #include "ui/gfx/geometry/vector2d.h" 35 #include "ui/gfx/geometry/vector2d.h"
36 #include "ui/gfx/geometry/vector3d_f.h" 36 #include "ui/gfx/geometry/vector3d_f.h"
37 #include "ui/gfx/interpolated_transform.h" 37 #include "ui/gfx/interpolated_transform.h"
38 #include "ui/wm/core/window_util.h" 38 #include "ui/wm/core/window_util.h"
39 #include "ui/wm/core/wm_core_switches.h" 39 #include "ui/wm/core/wm_core_switches.h"
40 #include "ui/wm/public/animation_host.h" 40 #include "ui/wm/public/animation_host.h"
41 41
42 DECLARE_WINDOW_PROPERTY_TYPE(wm::WindowVisibilityAnimationType) 42 DECLARE_UI_CLASS_PROPERTY_TYPE(::wm::WindowVisibilityAnimationType)
43 DECLARE_WINDOW_PROPERTY_TYPE(wm::WindowVisibilityAnimationTransition) 43 DECLARE_UI_CLASS_PROPERTY_TYPE(::wm::WindowVisibilityAnimationTransition)
44 DECLARE_WINDOW_PROPERTY_TYPE(float) 44 DECLARE_UI_CLASS_PROPERTY_TYPE(float)
45 45
46 namespace wm { 46 namespace wm {
47 namespace { 47 namespace {
48 const float kWindowAnimation_Vertical_TranslateY = 15.f; 48 const float kWindowAnimation_Vertical_TranslateY = 15.f;
49 49
50 // A base class for hiding animation observer which has two roles: 50 // A base class for hiding animation observer which has two roles:
51 // 1) Notifies AnimationHost at the end of hiding animation. 51 // 1) Notifies AnimationHost at the end of hiding animation.
52 // 2) Detaches the window's layers for hiding animation and deletes 52 // 2) Detaches the window's layers for hiding animation and deletes
53 // them upon completion of the animation. This is necessary to a) 53 // them upon completion of the animation. This is necessary to a)
54 // ensure that the animation continues in the event of the window being 54 // ensure that the animation continues in the event of the window being
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 aura::Window* window_; 139 aura::Window* window_;
140 140
141 // The owner of detached layers. 141 // The owner of detached layers.
142 std::unique_ptr<ui::LayerTreeOwner> layer_owner_; 142 std::unique_ptr<ui::LayerTreeOwner> layer_owner_;
143 143
144 DISALLOW_COPY_AND_ASSIGN(HidingWindowAnimationObserverBase); 144 DISALLOW_COPY_AND_ASSIGN(HidingWindowAnimationObserverBase);
145 }; 145 };
146 146
147 } // namespace 147 } // namespace
148 148
149 DEFINE_WINDOW_PROPERTY_KEY(int, 149 DEFINE_UI_CLASS_PROPERTY_KEY(int,
150 kWindowVisibilityAnimationTypeKey, 150 kWindowVisibilityAnimationTypeKey,
151 WINDOW_VISIBILITY_ANIMATION_TYPE_DEFAULT); 151 WINDOW_VISIBILITY_ANIMATION_TYPE_DEFAULT);
152 DEFINE_WINDOW_PROPERTY_KEY(int, kWindowVisibilityAnimationDurationKey, 0); 152 DEFINE_UI_CLASS_PROPERTY_KEY(int, kWindowVisibilityAnimationDurationKey, 0);
153 DEFINE_WINDOW_PROPERTY_KEY(WindowVisibilityAnimationTransition, 153 DEFINE_UI_CLASS_PROPERTY_KEY(WindowVisibilityAnimationTransition,
154 kWindowVisibilityAnimationTransitionKey, 154 kWindowVisibilityAnimationTransitionKey,
155 ANIMATE_BOTH); 155 ANIMATE_BOTH);
156 DEFINE_WINDOW_PROPERTY_KEY(float, 156 DEFINE_UI_CLASS_PROPERTY_KEY(float,
157 kWindowVisibilityAnimationVerticalPositionKey, 157 kWindowVisibilityAnimationVerticalPositionKey,
158 kWindowAnimation_Vertical_TranslateY); 158 kWindowAnimation_Vertical_TranslateY);
159 159
160 // A HidingWindowAnimationObserver that deletes observer and detached 160 // A HidingWindowAnimationObserver that deletes observer and detached
161 // layers upon the completion of the implicit animation. 161 // layers upon the completion of the implicit animation.
162 class ImplicitHidingWindowAnimationObserver 162 class ImplicitHidingWindowAnimationObserver
163 : public HidingWindowAnimationObserverBase, 163 : public HidingWindowAnimationObserverBase,
164 public ui::ImplicitAnimationObserver { 164 public ui::ImplicitAnimationObserver {
165 public: 165 public:
166 ImplicitHidingWindowAnimationObserver( 166 ImplicitHidingWindowAnimationObserver(
167 aura::Window* window, 167 aura::Window* window,
168 ui::ScopedLayerAnimationSettings* settings); 168 ui::ScopedLayerAnimationSettings* settings);
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 // being accessed via Remote Desktop. 664 // being accessed via Remote Desktop.
665 if (ui::ScopedAnimationDurationScaleMode::duration_scale_mode() == 665 if (ui::ScopedAnimationDurationScaleMode::duration_scale_mode() ==
666 ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION) 666 ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION)
667 return false; 667 return false;
668 668
669 // Let the user decide whether or not to play the animation. 669 // Let the user decide whether or not to play the animation.
670 return !gfx::Animation::ShouldRenderRichAnimation(); 670 return !gfx::Animation::ShouldRenderRichAnimation();
671 } 671 }
672 672
673 } // namespace wm 673 } // namespace wm
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698