| 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_WM_CORE_WINDOW_ANIMATIONS_H_ | 5 #ifndef UI_WM_CORE_WINDOW_ANIMATIONS_H_ |
| 6 #define UI_WM_CORE_WINDOW_ANIMATIONS_H_ | 6 #define UI_WM_CORE_WINDOW_ANIMATIONS_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ui/compositor/scoped_layer_animation_settings.h" |
| 10 #include "ui/wm/core/wm_core_export.h" | 11 #include "ui/wm/core/wm_core_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; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 aura::Window* window, | 75 aura::Window* window, |
| 75 const base::TimeDelta& duration); | 76 const base::TimeDelta& duration); |
| 76 | 77 |
| 77 WM_CORE_EXPORT base::TimeDelta GetWindowVisibilityAnimationDuration( | 78 WM_CORE_EXPORT base::TimeDelta GetWindowVisibilityAnimationDuration( |
| 78 const aura::Window& window); | 79 const aura::Window& window); |
| 79 | 80 |
| 80 WM_CORE_EXPORT void SetWindowVisibilityAnimationVerticalPosition( | 81 WM_CORE_EXPORT void SetWindowVisibilityAnimationVerticalPosition( |
| 81 aura::Window* window, | 82 aura::Window* window, |
| 82 float position); | 83 float position); |
| 83 | 84 |
| 84 // Creates an ImplicitAnimationObserver that takes ownership of the layers | 85 // A wrapper of ui::ScopedLayerAnimationSettings for hiding animations. |
| 85 // associated with a Window so that the animation can continue after the Window | 86 // Use this to ensure that the animation is visible even after |
| 86 // has been destroyed. | 87 // the window is deleted, instead of directly using |
| 87 // The returned object deletes itself when the animations are done. | 88 // ui::ScopedLayerAnimationSettings. |
| 88 WM_CORE_EXPORT ui::ImplicitAnimationObserver* | 89 class WM_CORE_EXPORT ScopedHidingAnimationSettings { |
| 89 CreateHidingWindowAnimationObserver(aura::Window* window); | 90 public: |
| 91 explicit ScopedHidingAnimationSettings(aura::Window* window); |
| 92 ~ScopedHidingAnimationSettings(); |
| 93 |
| 94 // Returns the wrapped ScopedLayeAnimationSettings instance. |
| 95 ui::ScopedLayerAnimationSettings* layer_animation_settings() { |
| 96 return &layer_animation_settings_; |
| 97 } |
| 98 |
| 99 // When set to true, this recreates layers for the window and and puts |
| 100 // the original (and animating) layers on top of |window_| and |
| 101 // its transient children so that these layers stay above new |
| 102 // focused window. This is typically used when closing a focusable |
| 103 // toplevel window. |
| 104 // Note that this is effective only if |window| has focus when |
| 105 // applying the animation. |
| 106 void set_ensure_visible_after_focus_lost( |
| 107 bool ensure_visible_after_focus_loste) { |
| 108 ensure_visibility_after_focus_lost_ = ensure_visible_after_focus_lost; |
| 109 } |
| 110 |
| 111 private: |
| 112 aura::Window* window_; |
| 113 bool ensure_visibility_after_focus_lost_; |
| 114 ui::ScopedLayerAnimationSettings layer_animation_settings_; |
| 115 |
| 116 DISALLOW_COPY_AND_ASSIGN(ScopedHidingAnimationSettings); |
| 117 }; |
| 90 | 118 |
| 91 // Returns false if the |window| didn't animate. | 119 // Returns false if the |window| didn't animate. |
| 92 WM_CORE_EXPORT bool AnimateOnChildWindowVisibilityChanged(aura::Window* window, | 120 WM_CORE_EXPORT bool AnimateOnChildWindowVisibilityChanged(aura::Window* window, |
| 93 bool visible); | 121 bool visible); |
| 94 WM_CORE_EXPORT bool AnimateWindow(aura::Window* window, | 122 WM_CORE_EXPORT bool AnimateWindow(aura::Window* window, |
| 95 WindowAnimationType type); | 123 WindowAnimationType type); |
| 96 | 124 |
| 97 // Returns true if window animations are disabled for |window|. Window | 125 // Returns true if window animations are disabled for |window|. Window |
| 98 // 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 |
| 99 // if the global flag disabling window animations is present. | 127 // if the global flag disabling window animations is present. |
| 100 WM_CORE_EXPORT bool WindowAnimationsDisabled(aura::Window* window); | 128 WM_CORE_EXPORT bool WindowAnimationsDisabled(aura::Window* window); |
| 101 | 129 |
| 102 } // namespace corewm | 130 } // namespace corewm |
| 103 } // namespace views | 131 } // namespace views |
| 104 | 132 |
| 105 #endif // UI_WM_CORE_WINDOW_ANIMATIONS_H_ | 133 #endif // UI_WM_CORE_WINDOW_ANIMATIONS_H_ |
| OLD | NEW |