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 class DetachAndRecreateLayersAnimationObserver; |
| 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 upon deletion of this object. |
| 87 // The returned object deletes itself when the animations are done. | 89 // Layers are owned by the animation observer that is added to the |
| 88 VIEWS_EXPORT ui::ImplicitAnimationObserver* CreateHidingWindowAnimationObserver( | 90 // detached layer's animator, and will be deleted when the animation |
| 89 aura::Window* window); | 91 // is completed. This is intended to be a return value of |
| 92 // DetachAndRecreateLayersForHidingAnimation() and not to be created by | |
| 93 // a client code. | |
| 94 class LayerDetacherForHidingAnimation { | |
| 95 public: | |
| 96 LayerDetacherForHidingAnimation( | |
| 97 aura::Window* window, | |
| 98 ui::ScopedLayerAnimationSettings* settings); | |
| 99 ~LayerDetacherForHidingAnimation(); | |
| 100 | |
| 101 private: | |
| 102 DetachAndRecreateLayersAnimationObserver* observer_; | |
| 103 | |
| 104 DISALLOW_COPY_AND_ASSIGN(LayerDetacherForHidingAnimation); | |
| 105 }; | |
| 106 | |
| 107 // This is used to make sure the hiding animation is visible even if | |
| 108 // the activation changes. | |
| 109 // This should be called before applying animatinos to |settings| | |
|
sky
2014/03/11 19:16:23
animatinos->animations
| |
| 110 // as this installs an animation observer and the returned object should | |
| 111 // have the same scope as |settings|. | |
| 112 VIEWS_EXPORT scoped_ptr<LayerDetacherForHidingAnimation> | |
| 113 DetachAndRecreateLayersForHidingAnimation( | |
| 114 aura::Window* window, | |
| 115 ui::ScopedLayerAnimationSettings* settings) WARN_UNUSED_RESULT; | |
| 116 | |
| 117 // This installs a window observer that takes ownership of the layers | |
| 118 // associated with a winddow. This is used to make sure that the | |
|
sky
2014/03/11 19:16:23
winddow->window
| |
| 119 // hiding animation can continue after the window has been destroyed. | |
| 120 // this will install an animation observer. | |
|
sky
2014/03/11 19:16:23
this->THis
| |
| 121 // This should be called before applying animatinos to |settings| as | |
| 122 // this installs an animation observer. | |
| 123 VIEWS_EXPORT void DetachLayersForHidingAnimationWhenDestroyed( | |
| 124 aura::Window* window, | |
| 125 ui::ScopedLayerAnimationSettings* settings); | |
| 90 | 126 |
| 91 // Returns false if the |window| didn't animate. | 127 // Returns false if the |window| didn't animate. |
| 92 VIEWS_EXPORT bool AnimateOnChildWindowVisibilityChanged(aura::Window* window, | 128 VIEWS_EXPORT bool AnimateOnChildWindowVisibilityChanged(aura::Window* window, |
| 93 bool visible); | 129 bool visible); |
| 94 VIEWS_EXPORT bool AnimateWindow(aura::Window* window, WindowAnimationType type); | 130 VIEWS_EXPORT bool AnimateWindow(aura::Window* window, WindowAnimationType type); |
| 95 | 131 |
| 96 // Returns true if window animations are disabled for |window|. Window | 132 // Returns true if window animations are disabled for |window|. Window |
| 97 // animations are enabled by default. If |window| is NULL, this just checks | 133 // animations are enabled by default. If |window| is NULL, this just checks |
| 98 // if the global flag disabling window animations is present. | 134 // if the global flag disabling window animations is present. |
| 99 VIEWS_EXPORT bool WindowAnimationsDisabled(aura::Window* window); | 135 VIEWS_EXPORT bool WindowAnimationsDisabled(aura::Window* window); |
| 100 | 136 |
| 101 } // namespace corewm | 137 } // namespace corewm |
| 102 } // namespace views | 138 } // namespace views |
| 103 | 139 |
| 104 #endif // UI_VIEWS_COREWM_WINDOW_ANIMATIONS_H_ | 140 #endif // UI_VIEWS_COREWM_WINDOW_ANIMATIONS_H_ |
| OLD | NEW |