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 ash { | 14 namespace ash { |
15 | 15 |
16 class WindowTreeHostManager; | 16 class WindowTreeHostManager; |
17 class WmShellCommon; | |
18 class WmWindow; | 17 class WmWindow; |
19 | 18 |
20 // Handles pinned state. | 19 // Handles pinned state. |
21 class ScreenPinningController : public WindowTreeHostManager::Observer { | 20 class ScreenPinningController : public WindowTreeHostManager::Observer { |
22 public: | 21 public: |
23 ScreenPinningController(WmShellCommon* wm_shell_common, | 22 explicit ScreenPinningController( |
24 WindowTreeHostManager* window_tree_host_manager); | 23 WindowTreeHostManager* window_tree_host_manager); |
25 ~ScreenPinningController() override; | 24 ~ScreenPinningController() override; |
26 | 25 |
27 // Sets a pinned window. It is not allowed to call this when there already | 26 // Sets a pinned window. It is not allowed to call this when there already |
28 // is a pinned window. | 27 // is a pinned window. |
29 void SetPinnedWindow(WmWindow* pinned_window); | 28 void SetPinnedWindow(WmWindow* pinned_window); |
30 | 29 |
31 // Returns true if in pinned mode, otherwise false. | 30 // Returns true if in pinned mode, otherwise false. |
32 bool IsPinned() const; | 31 bool IsPinned() const; |
33 | 32 |
34 // Returns the pinned window if in pinned mode, or nullptr. | 33 // Returns the pinned window if in pinned mode, or nullptr. |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 // Not owned. The parent has its ownership. | 80 // Not owned. The parent has its ownership. |
82 WmWindow* background_window_ = nullptr; | 81 WmWindow* background_window_ = nullptr; |
83 | 82 |
84 // In pinned mode, all displays other than the one where pinned_window_ is. | 83 // In pinned mode, all displays other than the one where pinned_window_ is. |
85 // Similar to background_window_, not owned. | 84 // Similar to background_window_, not owned. |
86 std::vector<WmWindow*> dim_windows_; | 85 std::vector<WmWindow*> dim_windows_; |
87 | 86 |
88 // Set true only when restacking done by this controller. | 87 // Set true only when restacking done by this controller. |
89 bool in_restacking_ = false; | 88 bool in_restacking_ = false; |
90 | 89 |
91 // For OnPinnedStateChanged event notification. | |
92 // While this controller is alive, it needs to be ensured that the instances | |
93 // refered from the pointers should be alive. | |
94 WmShellCommon* wm_shell_common_; | |
95 | |
96 // Keep references to remove this as a observer. | 90 // Keep references to remove this as a observer. |
97 // While this controller is alive, it needs to be ensured that the instances | 91 // While this controller is alive, it needs to be ensured that the instances |
98 // refered from the pointers should be alive. | 92 // refered from the pointers should be alive. |
99 WindowTreeHostManager* window_tree_host_manager_; | 93 WindowTreeHostManager* window_tree_host_manager_; |
100 | 94 |
101 // Window observers to translate events for the window to this controller. | 95 // Window observers to translate events for the window to this controller. |
102 std::unique_ptr<PinnedContainerWindowObserver> | 96 std::unique_ptr<PinnedContainerWindowObserver> |
103 pinned_container_window_observer_; | 97 pinned_container_window_observer_; |
104 std::unique_ptr<PinnedContainerChildWindowObserver> | 98 std::unique_ptr<PinnedContainerChildWindowObserver> |
105 pinned_container_child_window_observer_; | 99 pinned_container_child_window_observer_; |
106 std::unique_ptr<SystemModalContainerWindowObserver> | 100 std::unique_ptr<SystemModalContainerWindowObserver> |
107 system_modal_container_window_observer_; | 101 system_modal_container_window_observer_; |
108 std::unique_ptr<SystemModalContainerChildWindowObserver> | 102 std::unique_ptr<SystemModalContainerChildWindowObserver> |
109 system_modal_container_child_window_observer_; | 103 system_modal_container_child_window_observer_; |
110 std::unique_ptr<DimWindowObserver> dim_window_observer_; | 104 std::unique_ptr<DimWindowObserver> dim_window_observer_; |
111 | 105 |
112 DISALLOW_COPY_AND_ASSIGN(ScreenPinningController); | 106 DISALLOW_COPY_AND_ASSIGN(ScreenPinningController); |
113 }; | 107 }; |
114 | 108 |
115 } // namespace ash | 109 } // namespace ash |
116 | 110 |
117 #endif // ASH_WM_SCREEN_PINNING_CONTROLLER_H_ | 111 #endif // ASH_WM_SCREEN_PINNING_CONTROLLER_H_ |
OLD | NEW |