Chromium Code Reviews| 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 #ifndef UI_VIEWS_COREWM_WINDOW_ANIMATIONS_H_ | 5 #ifndef UI_VIEWS_COREWM_WINDOW_ANIMATIONS_H_ |
| 6 #define UI_VIEWS_COREWM_WINDOW_ANIMATIONS_H_ | 6 #define UI_VIEWS_COREWM_WINDOW_ANIMATIONS_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | |
| 10 #include "ui/views/views_export.h" | 11 #include "ui/views/views_export.h" |
| 11 | 12 |
| 12 namespace aura { | 13 namespace aura { |
| 13 class Window; | 14 class Window; |
| 14 } | 15 } |
| 15 namespace base { | 16 namespace base { |
| 16 class TimeDelta; | 17 class TimeDelta; |
| 17 } | 18 } |
| 18 namespace gfx { | 19 namespace gfx { |
| 19 class Rect; | 20 class Rect; |
| 20 } | 21 } |
| 21 namespace ui { | 22 namespace ui { |
| 22 class ImplicitAnimationObserver; | 23 class ImplicitAnimationObserver; |
| 23 class Layer; | 24 class Layer; |
| 24 class LayerAnimationSequence; | 25 class LayerAnimationSequence; |
| 26 class ScopedLayerAnimationSettings; | |
| 25 } | 27 } |
| 26 | 28 |
| 27 namespace views { | 29 namespace views { |
| 28 namespace corewm { | 30 namespace corewm { |
| 29 | 31 |
| 30 // A variety of canned animations for window transitions. | 32 // A variety of canned animations for window transitions. |
| 31 enum WindowVisibilityAnimationType { | 33 enum WindowVisibilityAnimationType { |
| 32 WINDOW_VISIBILITY_ANIMATION_TYPE_DEFAULT = 0, // Default. Lets the system | 34 WINDOW_VISIBILITY_ANIMATION_TYPE_DEFAULT = 0, // Default. Lets the system |
| 33 // decide based on window | 35 // decide based on window |
| 34 // type. | 36 // type. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 74 aura::Window* window, | 76 aura::Window* window, |
| 75 const base::TimeDelta& duration); | 77 const base::TimeDelta& duration); |
| 76 | 78 |
| 77 VIEWS_EXPORT base::TimeDelta GetWindowVisibilityAnimationDuration( | 79 VIEWS_EXPORT base::TimeDelta GetWindowVisibilityAnimationDuration( |
| 78 const aura::Window& window); | 80 const aura::Window& window); |
| 79 | 81 |
| 80 VIEWS_EXPORT void SetWindowVisibilityAnimationVerticalPosition( | 82 VIEWS_EXPORT void SetWindowVisibilityAnimationVerticalPosition( |
| 81 aura::Window* window, | 83 aura::Window* window, |
| 82 float position); | 84 float position); |
| 83 | 85 |
| 84 // Creates an ImplicitAnimationObserver that takes ownership of the layers | 86 // A scoped object which detaches the current layers which will animate, and |
| 85 // associated with a Window so that the animation can continue after the Window | 87 // recreates new layers for the window upon deletion of this object. |
| 86 // has been destroyed. | 88 // Layers are owned by the animation observer that is added to the |
| 87 // The returned object deletes itself when the animations are done. | 89 // deteached layer's animator, and will be deleted when the animation |
|
sky
2014/03/11 16:10:53
deteached->detached
oshima
2014/03/11 17:45:20
Done.
| |
| 88 VIEWS_EXPORT ui::ImplicitAnimationObserver* CreateHidingWindowAnimationObserver( | 90 // is completed. |
| 89 aura::Window* window); | 91 class LayerDetacherForHidingAnimation { |
|
sky
2014/03/11 16:10:53
Why bother with this effectively pure virtual clas
oshima
2014/03/11 17:45:20
It also requires the constructor which a user don'
| |
| 92 public: | |
| 93 LayerDetacherForHidingAnimation() {} | |
| 94 virtual ~LayerDetacherForHidingAnimation() {} | |
| 95 | |
| 96 private: | |
| 97 DISALLOW_COPY_AND_ASSIGN(LayerDetacherForHidingAnimation); | |
| 98 }; | |
| 99 | |
| 100 // This is used to make sure the hiding animation is visible even if | |
|
sky
2014/03/11 16:10:53
These two functions are nearly the same and it isn
oshima
2014/03/11 17:45:20
That's not correct. The former is to make sure the
sky
2014/03/11 19:16:23
My main concern with what you have here (and in th
| |
| 101 // the activation changes. | |
| 102 // This should be called before applying animatinos to |settings| | |
|
sky
2014/03/11 16:10:53
animatinos->animations
oshima
2014/03/11 17:45:20
Done.
| |
| 103 // as this installs an animation observer and the returned object should | |
| 104 // have the same scope as |settings|. | |
| 105 VIEWS_EXPORT scoped_ptr<LayerDetacherForHidingAnimation> | |
| 106 DetachAndRecreateLayersForHidingAnimation( | |
| 107 aura::Window* window, | |
| 108 ui::ScopedLayerAnimationSettings* settings) WARN_UNUSED_RESULT; | |
| 109 | |
| 110 // This installs a window observer that takes ownership of the layers | |
| 111 // associated with a winddow. This is used to make sure that the | |
|
sky
2014/03/11 16:10:53
winddow->window
oshima
2014/03/11 17:45:20
Done.
| |
| 112 // hiding animation can continue after the window has been destroyed. | |
| 113 // this will install an animation observer. | |
| 114 // This should be called before applying animatinos to |settings| as | |
| 115 // this installs an animation observer. | |
| 116 VIEWS_EXPORT void DetachLayersForHidingAnimationWhenDestroyed( | |
| 117 aura::Window* window, | |
| 118 ui::ScopedLayerAnimationSettings* settings); | |
| 90 | 119 |
| 91 // Returns false if the |window| didn't animate. | 120 // Returns false if the |window| didn't animate. |
| 92 VIEWS_EXPORT bool AnimateOnChildWindowVisibilityChanged(aura::Window* window, | 121 VIEWS_EXPORT bool AnimateOnChildWindowVisibilityChanged(aura::Window* window, |
| 93 bool visible); | 122 bool visible); |
| 94 VIEWS_EXPORT bool AnimateWindow(aura::Window* window, WindowAnimationType type); | 123 VIEWS_EXPORT bool AnimateWindow(aura::Window* window, WindowAnimationType type); |
| 95 | 124 |
| 96 // Returns true if window animations are disabled for |window|. Window | 125 // Returns true if window animations are disabled for |window|. Window |
| 97 // animations are enabled by default. If |window| is NULL, this just checks | 126 // animations are enabled by default. If |window| is NULL, this just checks |
| 98 // if the global flag disabling window animations is present. | 127 // if the global flag disabling window animations is present. |
| 99 VIEWS_EXPORT bool WindowAnimationsDisabled(aura::Window* window); | 128 VIEWS_EXPORT bool WindowAnimationsDisabled(aura::Window* window); |
| 100 | 129 |
| 101 } // namespace corewm | 130 } // namespace corewm |
| 102 } // namespace views | 131 } // namespace views |
| 103 | 132 |
| 104 #endif // UI_VIEWS_COREWM_WINDOW_ANIMATIONS_H_ | 133 #endif // UI_VIEWS_COREWM_WINDOW_ANIMATIONS_H_ |
| OLD | NEW |