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