| 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 ASH_WM_VISIBILITY_CONTROLLER_H_ | 5 #ifndef UI_VIEWS_COREWM_VISIBILITY_CONTROLLER_H_ |
| 6 #define ASH_WM_VISIBILITY_CONTROLLER_H_ | 6 #define UI_VIEWS_COREWM_VISIBILITY_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include "ash/ash_export.h" | |
| 9 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 10 #include "base/logging.h" | 9 #include "base/logging.h" |
| 11 #include "ui/aura/client/visibility_client.h" | 10 #include "ui/aura/client/visibility_client.h" |
| 11 #include "ui/views/views_export.h" |
| 12 | 12 |
| 13 namespace ash { | 13 namespace views { |
| 14 namespace internal { | 14 namespace corewm { |
| 15 | 15 |
| 16 class ASH_EXPORT VisibilityController : public aura::client::VisibilityClient { | 16 class VIEWS_EXPORT VisibilityController |
| 17 : public aura::client::VisibilityClient { |
| 17 public: | 18 public: |
| 18 VisibilityController(); | 19 VisibilityController(); |
| 19 virtual ~VisibilityController(); | 20 virtual ~VisibilityController(); |
| 20 | 21 |
| 22 protected: |
| 23 // Subclasses override if they want to call a different implementation of |
| 24 // this function. |
| 25 // TODO(beng): potentially replace by an actual window animator class in |
| 26 // window_animations.h. |
| 27 virtual bool CallAnimateOnChildWindowVisibilityChanged(aura::Window* window, |
| 28 bool visible); |
| 29 |
| 30 private: |
| 21 // Overridden from aura::client::VisibilityClient: | 31 // Overridden from aura::client::VisibilityClient: |
| 22 virtual void UpdateLayerVisibility(aura::Window* window, | 32 virtual void UpdateLayerVisibility(aura::Window* window, |
| 23 bool visible) OVERRIDE; | 33 bool visible) OVERRIDE; |
| 24 | 34 |
| 25 private: | |
| 26 DISALLOW_COPY_AND_ASSIGN(VisibilityController); | 35 DISALLOW_COPY_AND_ASSIGN(VisibilityController); |
| 27 }; | 36 }; |
| 28 | 37 |
| 29 } // namespace internal | |
| 30 | |
| 31 // Suspends the animations for visibility changes during the lifetime of an | 38 // Suspends the animations for visibility changes during the lifetime of an |
| 32 // instance of this class. | 39 // instance of this class. |
| 33 // | 40 // |
| 34 // Example: | 41 // Example: |
| 35 // | 42 // |
| 36 // void ViewName::UnanimatedAction() { | 43 // void ViewName::UnanimatedAction() { |
| 37 // SuspendChildWindowVisibilityAnimations suspend(parent); | 44 // SuspendChildWindowVisibilityAnimations suspend(parent); |
| 38 // // Perform unanimated action here. | 45 // // Perform unanimated action here. |
| 39 // // ... | 46 // // ... |
| 40 // // When the method finishes, visibility animations will return to their | 47 // // When the method finishes, visibility animations will return to their |
| 41 // // previous state. | 48 // // previous state. |
| 42 // } | 49 // } |
| 43 // | 50 // |
| 44 class ASH_EXPORT SuspendChildWindowVisibilityAnimations { | 51 class VIEWS_EXPORT SuspendChildWindowVisibilityAnimations { |
| 45 public: | 52 public: |
| 46 // Suspend visibility animations of child windows. | 53 // Suspend visibility animations of child windows. |
| 47 explicit SuspendChildWindowVisibilityAnimations(aura::Window* window); | 54 explicit SuspendChildWindowVisibilityAnimations(aura::Window* window); |
| 48 | 55 |
| 49 // Restore visibility animations to their original state. | 56 // Restore visibility animations to their original state. |
| 50 ~SuspendChildWindowVisibilityAnimations(); | 57 ~SuspendChildWindowVisibilityAnimations(); |
| 51 | 58 |
| 52 private: | 59 private: |
| 53 // The window to manage. | 60 // The window to manage. |
| 54 aura::Window* window_; | 61 aura::Window* window_; |
| 55 | 62 |
| 56 // Whether the visibility animations on child windows were originally enabled. | 63 // Whether the visibility animations on child windows were originally enabled. |
| 57 const bool original_enabled_; | 64 const bool original_enabled_; |
| 58 | 65 |
| 59 DISALLOW_COPY_AND_ASSIGN(SuspendChildWindowVisibilityAnimations); | 66 DISALLOW_COPY_AND_ASSIGN(SuspendChildWindowVisibilityAnimations); |
| 60 }; | 67 }; |
| 61 | 68 |
| 62 // Tells |window| to animate visibility changes to its children. | 69 // Tells |window| to animate visibility changes to its children. |
| 63 void ASH_EXPORT SetChildWindowVisibilityChangesAnimated(aura::Window* window); | 70 void VIEWS_EXPORT SetChildWindowVisibilityChangesAnimated(aura::Window* window); |
| 64 | 71 |
| 65 } // namespace ash | 72 } // namespace corewm |
| 73 } // namespace views |
| 66 | 74 |
| 67 #endif // ASH_WM_VISIBILITY_CONTROLLER_H_ | 75 #endif // UI_VIEWS_COREWM_VISIBILITY_CONTROLLER_H_ |
| OLD | NEW |