| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_TRANSIENT_WINDOW_MANAGER_H_ | 5 #ifndef UI_WM_CORE_TRANSIENT_WINDOW_MANAGER_H_ |
| 6 #define UI_WM_CORE_TRANSIENT_WINDOW_MANAGER_H_ | 6 #define UI_WM_CORE_TRANSIENT_WINDOW_MANAGER_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 // transient children are always ordered above the transient parent. | 25 // transient children are always ordered above the transient parent. |
| 26 // . If a transient parent is hidden, it hides all transient children. | 26 // . If a transient parent is hidden, it hides all transient children. |
| 27 // For show operation, please refer to |set_parent_controls_visibility(bool)|. | 27 // For show operation, please refer to |set_parent_controls_visibility(bool)|. |
| 28 // Transient windows are typically used for popups and menus. | 28 // Transient windows are typically used for popups and menus. |
| 29 // TODO(sky): when we nuke TransientWindowClient rename this to | 29 // TODO(sky): when we nuke TransientWindowClient rename this to |
| 30 // TransientWindowController. | 30 // TransientWindowController. |
| 31 class WM_EXPORT TransientWindowManager : public aura::WindowObserver { | 31 class WM_EXPORT TransientWindowManager : public aura::WindowObserver { |
| 32 public: | 32 public: |
| 33 typedef std::vector<aura::Window*> Windows; | 33 typedef std::vector<aura::Window*> Windows; |
| 34 | 34 |
| 35 virtual ~TransientWindowManager(); | 35 ~TransientWindowManager() override; |
| 36 | 36 |
| 37 // Returns the TransientWindowManager for |window|. This never returns NULL. | 37 // Returns the TransientWindowManager for |window|. This never returns NULL. |
| 38 static TransientWindowManager* Get(aura::Window* window); | 38 static TransientWindowManager* Get(aura::Window* window); |
| 39 | 39 |
| 40 // Returns the TransientWindowManager for |window| only if it already exists. | 40 // Returns the TransientWindowManager for |window| only if it already exists. |
| 41 // WARNING: this may return NULL. | 41 // WARNING: this may return NULL. |
| 42 static const TransientWindowManager* Get(const aura::Window* window); | 42 static const TransientWindowManager* Get(const aura::Window* window); |
| 43 | 43 |
| 44 void AddObserver(TransientWindowObserver* observer); | 44 void AddObserver(TransientWindowObserver* observer); |
| 45 void RemoveObserver(TransientWindowObserver* observer); | 45 void RemoveObserver(TransientWindowObserver* observer); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 73 | 73 |
| 74 // Stacks transient descendants of this window that are its siblings just | 74 // Stacks transient descendants of this window that are its siblings just |
| 75 // above it. | 75 // above it. |
| 76 void RestackTransientDescendants(); | 76 void RestackTransientDescendants(); |
| 77 | 77 |
| 78 // Update the window's visibility following the transient parent's | 78 // Update the window's visibility following the transient parent's |
| 79 // visibility. See |set_parent_controls_visibility(bool)| for more details. | 79 // visibility. See |set_parent_controls_visibility(bool)| for more details. |
| 80 void UpdateTransientChildVisibility(bool visible); | 80 void UpdateTransientChildVisibility(bool visible); |
| 81 | 81 |
| 82 // WindowObserver: | 82 // WindowObserver: |
| 83 virtual void OnWindowParentChanged(aura::Window* window, | 83 void OnWindowParentChanged(aura::Window* window, |
| 84 aura::Window* parent) override; | 84 aura::Window* parent) override; |
| 85 virtual void OnWindowVisibilityChanging(aura::Window* window, | 85 void OnWindowVisibilityChanging(aura::Window* window, bool visible) override; |
| 86 bool visible) override; | 86 void OnWindowVisibilityChanged(aura::Window* window, bool visible) override; |
| 87 virtual void OnWindowVisibilityChanged(aura::Window* window, | 87 void OnWindowStackingChanged(aura::Window* window) override; |
| 88 bool visible) override; | 88 void OnWindowDestroying(aura::Window* window) override; |
| 89 virtual void OnWindowStackingChanged(aura::Window* window) override; | |
| 90 virtual void OnWindowDestroying(aura::Window* window) override; | |
| 91 | 89 |
| 92 aura::Window* window_; | 90 aura::Window* window_; |
| 93 aura::Window* transient_parent_; | 91 aura::Window* transient_parent_; |
| 94 Windows transient_children_; | 92 Windows transient_children_; |
| 95 | 93 |
| 96 // If non-null we're actively restacking transient as the result of a | 94 // If non-null we're actively restacking transient as the result of a |
| 97 // transient ancestor changing. | 95 // transient ancestor changing. |
| 98 aura::Window* stacking_target_; | 96 aura::Window* stacking_target_; |
| 99 | 97 |
| 100 bool parent_controls_visibility_; | 98 bool parent_controls_visibility_; |
| 101 bool show_on_parent_visible_; | 99 bool show_on_parent_visible_; |
| 102 bool ignore_visibility_changed_event_; | 100 bool ignore_visibility_changed_event_; |
| 103 | 101 |
| 104 ObserverList<TransientWindowObserver> observers_; | 102 ObserverList<TransientWindowObserver> observers_; |
| 105 | 103 |
| 106 DISALLOW_COPY_AND_ASSIGN(TransientWindowManager); | 104 DISALLOW_COPY_AND_ASSIGN(TransientWindowManager); |
| 107 }; | 105 }; |
| 108 | 106 |
| 109 } // namespace wm | 107 } // namespace wm |
| 110 | 108 |
| 111 #endif // UI_WM_CORE_TRANSIENT_WINDOW_MANAGER_H_ | 109 #endif // UI_WM_CORE_TRANSIENT_WINDOW_MANAGER_H_ |
| OLD | NEW |