Roll src/third_party/skia d32087a:1052f51
[chromium-blink-merge.git] / ui / wm / core / visibility_controller.h
blobc6f52585f366a89fd610ba7f0f29059bc103a6d0
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.
5 #ifndef UI_WM_CORE_VISIBILITY_CONTROLLER_H_
6 #define UI_WM_CORE_VISIBILITY_CONTROLLER_H_
8 #include "base/compiler_specific.h"
9 #include "base/logging.h"
10 #include "ui/aura/client/visibility_client.h"
11 #include "ui/wm/wm_export.h"
13 namespace wm {
15 class WM_EXPORT VisibilityController
16 : public aura::client::VisibilityClient {
17 public:
18 VisibilityController();
19 ~VisibilityController() override;
21 protected:
22 // Subclasses override if they want to call a different implementation of
23 // this function.
24 // TODO(beng): potentially replace by an actual window animator class in
25 // window_animations.h.
26 virtual bool CallAnimateOnChildWindowVisibilityChanged(aura::Window* window,
27 bool visible);
29 private:
30 // Overridden from aura::client::VisibilityClient:
31 void UpdateLayerVisibility(aura::Window* window, bool visible) override;
33 DISALLOW_COPY_AND_ASSIGN(VisibilityController);
36 // Suspends the animations for visibility changes during the lifetime of an
37 // instance of this class.
39 // Example:
41 // void ViewName::UnanimatedAction() {
42 // SuspendChildWindowVisibilityAnimations suspend(parent);
43 // // Perform unanimated action here.
44 // // ...
45 // // When the method finishes, visibility animations will return to their
46 // // previous state.
47 // }
49 class WM_EXPORT SuspendChildWindowVisibilityAnimations {
50 public:
51 // Suspend visibility animations of child windows.
52 explicit SuspendChildWindowVisibilityAnimations(aura::Window* window);
54 // Restore visibility animations to their original state.
55 ~SuspendChildWindowVisibilityAnimations();
57 private:
58 // The window to manage.
59 aura::Window* window_;
61 // Whether the visibility animations on child windows were originally enabled.
62 const bool original_enabled_;
64 DISALLOW_COPY_AND_ASSIGN(SuspendChildWindowVisibilityAnimations);
67 // Tells |window| to animate visibility changes to its children.
68 void WM_EXPORT SetChildWindowVisibilityChangesAnimated(
69 aura::Window* window);
71 } // namespace wm
73 #endif // UI_WM_CORE_VISIBILITY_CONTROLLER_H_