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 |
| 85 // associated with a Window so that the animation can continue after the Window | 87 // A scoped object which detaches the current layers which will animate and |
| 86 // has been destroyed. | 88 // recreates new layers for the window. Layers are owned by the animation |
| 87 // The returned object deletes itself when the animations are done. | 89 // observer that is added to the deteached layer's animator, and will be deleted |
| 88 VIEWS_EXPORT ui::ImplicitAnimationObserver* CreateHidingWindowAnimationObserver( | 90 // when the animation is completed. |
| 89 aura::Window* window); | 91 class LayerDetacherForHidingAnimation { |
| 92 public: | |
| 93 LayerDetacherForHidingAnimation() {} | |
| 94 virtual ~LayerDetacherForHidingAnimation() {} | |
| 95 | |
| 96 private: | |
| 97 DISALLOW_COPY_AND_ASSIGN(LayerDetacherForHidingAnimation); | |
| 98 }; | |
| 99 | |
| 100 // This has to be called before applying animations to |settings| because | |
|
sky
2014/03/10 13:30:40
Is there anyway to this has been called before app
oshima
2014/03/10 17:48:24
Not sure if I understood your question correctly.
| |
| 101 // this will install animation observer. | |
|
sky
2014/03/10 13:30:40
an animation observer
oshima
2014/03/10 17:48:24
Done.
| |
| 102 VIEWS_EXPORT scoped_ptr<LayerDetacherForHidingAnimation> | |
| 103 DetachAndRecreateLayersForHidingAnimation( | |
| 104 aura::Window* window, | |
| 105 ui::ScopedLayerAnimationSettings* settings); | |
| 106 | |
| 107 // This installs a window observer that takes ownership of the layers | |
| 108 // associated with a |winddow| so that the hiding animation can continue | |
|
sky
2014/03/10 13:30:40
'a |winddow|' -> "window"
oshima
2014/03/10 17:48:24
Done.
| |
| 109 // after the window has been destroyed. | |
| 110 VIEWS_EXPORT void DetachLayersForHidingAnimationWhenDestroyed( | |
| 111 aura::Window* window, | |
| 112 ui::ScopedLayerAnimationSettings* settings); | |
| 90 | 113 |
| 91 // Returns false if the |window| didn't animate. | 114 // Returns false if the |window| didn't animate. |
| 92 VIEWS_EXPORT bool AnimateOnChildWindowVisibilityChanged(aura::Window* window, | 115 VIEWS_EXPORT bool AnimateOnChildWindowVisibilityChanged(aura::Window* window, |
| 93 bool visible); | 116 bool visible); |
| 94 VIEWS_EXPORT bool AnimateWindow(aura::Window* window, WindowAnimationType type); | 117 VIEWS_EXPORT bool AnimateWindow(aura::Window* window, WindowAnimationType type); |
| 95 | 118 |
| 96 // Returns true if window animations are disabled for |window|. Window | 119 // Returns true if window animations are disabled for |window|. Window |
| 97 // animations are enabled by default. If |window| is NULL, this just checks | 120 // animations are enabled by default. If |window| is NULL, this just checks |
| 98 // if the global flag disabling window animations is present. | 121 // if the global flag disabling window animations is present. |
| 99 VIEWS_EXPORT bool WindowAnimationsDisabled(aura::Window* window); | 122 VIEWS_EXPORT bool WindowAnimationsDisabled(aura::Window* window); |
| 100 | 123 |
| 101 } // namespace corewm | 124 } // namespace corewm |
| 102 } // namespace views | 125 } // namespace views |
| 103 | 126 |
| 104 #endif // UI_VIEWS_COREWM_WINDOW_ANIMATIONS_H_ | 127 #endif // UI_VIEWS_COREWM_WINDOW_ANIMATIONS_H_ |
| OLD | NEW |