OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_SCREEN_PINNING_CONTROLLER_H_ | 5 #ifndef ASH_WM_SCREEN_PINNING_CONTROLLER_H_ |
6 #define ASH_WM_SCREEN_PINNING_CONTROLLER_H_ | 6 #define ASH_WM_SCREEN_PINNING_CONTROLLER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "ash/display/window_tree_host_manager.h" | 11 #include "ash/display/window_tree_host_manager.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 | 13 |
| 14 namespace aura { |
| 15 class Window; |
| 16 } |
| 17 |
14 namespace ash { | 18 namespace ash { |
15 | 19 |
16 class WindowDimmer; | 20 class WindowDimmer; |
17 class WindowTreeHostManager; | 21 class WindowTreeHostManager; |
18 class WmWindow; | 22 class WmWindow; |
19 | 23 |
20 template <typename UserData> | 24 template <typename UserData> |
21 class WmWindowUserData; | 25 class WindowUserData; |
22 | 26 |
23 // Handles pinned state. | 27 // Handles pinned state. |
24 class ScreenPinningController : public WindowTreeHostManager::Observer { | 28 class ScreenPinningController : public WindowTreeHostManager::Observer { |
25 public: | 29 public: |
26 explicit ScreenPinningController( | 30 explicit ScreenPinningController( |
27 WindowTreeHostManager* window_tree_host_manager); | 31 WindowTreeHostManager* window_tree_host_manager); |
28 ~ScreenPinningController() override; | 32 ~ScreenPinningController() override; |
29 | 33 |
30 // Sets a pinned window. It is not allowed to call this when there already | 34 // Sets a pinned window. It is not allowed to call this when there already |
31 // is a pinned window. | 35 // is a pinned window. |
(...skipping 29 matching lines...) Expand all Loading... |
61 private: | 65 private: |
62 class PinnedContainerWindowObserver; | 66 class PinnedContainerWindowObserver; |
63 class PinnedContainerChildWindowObserver; | 67 class PinnedContainerChildWindowObserver; |
64 class SystemModalContainerWindowObserver; | 68 class SystemModalContainerWindowObserver; |
65 class SystemModalContainerChildWindowObserver; | 69 class SystemModalContainerChildWindowObserver; |
66 | 70 |
67 // Keeps the pinned window on top of the siblings. | 71 // Keeps the pinned window on top of the siblings. |
68 void KeepPinnedWindowOnTop(); | 72 void KeepPinnedWindowOnTop(); |
69 | 73 |
70 // Keeps the dim window at bottom of the container. | 74 // Keeps the dim window at bottom of the container. |
71 void KeepDimWindowAtBottom(WmWindow* container); | 75 void KeepDimWindowAtBottom(aura::Window* container); |
72 | 76 |
73 // Creates a WindowDimmer for |container| and places it in |window_dimmers_|. | 77 // Creates a WindowDimmer for |container| and places it in |window_dimmers_|. |
74 // Returns the window from WindowDimmer. | 78 // Returns the window from WindowDimmer. |
75 WmWindow* CreateWindowDimmer(WmWindow* container); | 79 WmWindow* CreateWindowDimmer(WmWindow* container); |
76 | 80 |
77 // WindowTreeHostManager::Observer: | 81 // WindowTreeHostManager::Observer: |
78 void OnDisplayConfigurationChanged() override; | 82 void OnDisplayConfigurationChanged() override; |
79 | 83 |
80 // Pinned window should be on top in the parent window. | 84 // Pinned window should be on top in the parent window. |
81 WmWindow* pinned_window_ = nullptr; | 85 WmWindow* pinned_window_ = nullptr; |
82 | 86 |
83 // Owns the WindowDimmers. There is one WindowDimmer for the parent of | 87 // Owns the WindowDimmers. There is one WindowDimmer for the parent of |
84 // |pinned_window_| and one for each display other than the display | 88 // |pinned_window_| and one for each display other than the display |
85 // |pinned_window_| is on. | 89 // |pinned_window_| is on. |
86 std::unique_ptr<WmWindowUserData<WindowDimmer>> window_dimmers_; | 90 std::unique_ptr<WindowUserData<WindowDimmer>> window_dimmers_; |
87 | 91 |
88 // Set true only when restacking done by this controller. | 92 // Set true only when restacking done by this controller. |
89 bool in_restacking_ = false; | 93 bool in_restacking_ = false; |
90 | 94 |
91 // Keep references to remove this as a observer. | 95 // Keep references to remove this as a observer. |
92 // While this controller is alive, it needs to be ensured that the instances | 96 // While this controller is alive, it needs to be ensured that the instances |
93 // refered from the pointers should be alive. | 97 // refered from the pointers should be alive. |
94 WindowTreeHostManager* window_tree_host_manager_; | 98 WindowTreeHostManager* window_tree_host_manager_; |
95 | 99 |
96 // Window observers to translate events for the window to this controller. | 100 // Window observers to translate events for the window to this controller. |
97 std::unique_ptr<PinnedContainerWindowObserver> | 101 std::unique_ptr<PinnedContainerWindowObserver> |
98 pinned_container_window_observer_; | 102 pinned_container_window_observer_; |
99 std::unique_ptr<PinnedContainerChildWindowObserver> | 103 std::unique_ptr<PinnedContainerChildWindowObserver> |
100 pinned_container_child_window_observer_; | 104 pinned_container_child_window_observer_; |
101 std::unique_ptr<SystemModalContainerWindowObserver> | 105 std::unique_ptr<SystemModalContainerWindowObserver> |
102 system_modal_container_window_observer_; | 106 system_modal_container_window_observer_; |
103 std::unique_ptr<SystemModalContainerChildWindowObserver> | 107 std::unique_ptr<SystemModalContainerChildWindowObserver> |
104 system_modal_container_child_window_observer_; | 108 system_modal_container_child_window_observer_; |
105 | 109 |
106 DISALLOW_COPY_AND_ASSIGN(ScreenPinningController); | 110 DISALLOW_COPY_AND_ASSIGN(ScreenPinningController); |
107 }; | 111 }; |
108 | 112 |
109 } // namespace ash | 113 } // namespace ash |
110 | 114 |
111 #endif // ASH_WM_SCREEN_PINNING_CONTROLLER_H_ | 115 #endif // ASH_WM_SCREEN_PINNING_CONTROLLER_H_ |
OLD | NEW |