| 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 #include "ui/aura/window_tracker.h" |
| 13 | 14 |
| 14 namespace ash { | 15 namespace ash { |
| 15 | 16 |
| 16 class WindowDimmer; | |
| 17 class WindowTreeHostManager; | 17 class WindowTreeHostManager; |
| 18 class WmWindow; | 18 class WmWindow; |
| 19 | 19 |
| 20 template <typename UserData> | |
| 21 class WmWindowUserData; | |
| 22 | |
| 23 // Handles pinned state. | 20 // Handles pinned state. |
| 24 class ScreenPinningController : public WindowTreeHostManager::Observer { | 21 class ScreenPinningController : public WindowTreeHostManager::Observer { |
| 25 public: | 22 public: |
| 26 explicit ScreenPinningController( | 23 explicit ScreenPinningController( |
| 27 WindowTreeHostManager* window_tree_host_manager); | 24 WindowTreeHostManager* window_tree_host_manager); |
| 28 ~ScreenPinningController() override; | 25 ~ScreenPinningController() override; |
| 29 | 26 |
| 30 // Sets a pinned window. It is not allowed to call this when there already | 27 // Sets a pinned window. It is not allowed to call this when there already |
| 31 // is a pinned window. | 28 // is a pinned window. |
| 32 void SetPinnedWindow(WmWindow* pinned_window); | 29 void SetPinnedWindow(WmWindow* pinned_window); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 // Creates a WindowDimmer for |container| and places it in |window_dimmers_|. | 70 // Creates a WindowDimmer for |container| and places it in |window_dimmers_|. |
| 74 // Returns the window from WindowDimmer. | 71 // Returns the window from WindowDimmer. |
| 75 WmWindow* CreateWindowDimmer(WmWindow* container); | 72 WmWindow* CreateWindowDimmer(WmWindow* container); |
| 76 | 73 |
| 77 // WindowTreeHostManager::Observer: | 74 // WindowTreeHostManager::Observer: |
| 78 void OnDisplayConfigurationChanged() override; | 75 void OnDisplayConfigurationChanged() override; |
| 79 | 76 |
| 80 // Pinned window should be on top in the parent window. | 77 // Pinned window should be on top in the parent window. |
| 81 WmWindow* pinned_window_ = nullptr; | 78 WmWindow* pinned_window_ = nullptr; |
| 82 | 79 |
| 83 // Owns the WindowDimmers. There is one WindowDimmer for the parent of | 80 // Maintains the set of aura::Windows that have a WindowDimmer installed on |
| 84 // |pinned_window_| and one for each display other than the display | 81 // them. There is one WindowDimmer for the parent of |pinned_window_| and one |
| 85 // |pinned_window_| is on. | 82 // for each display other than the display |pinned_window_| is on. |
| 86 std::unique_ptr<WmWindowUserData<WindowDimmer>> window_dimmers_; | 83 aura::WindowTracker windows_with_dimmers_; |
| 87 | 84 |
| 88 // Set true only when restacking done by this controller. | 85 // Set true only when restacking done by this controller. |
| 89 bool in_restacking_ = false; | 86 bool in_restacking_ = false; |
| 90 | 87 |
| 91 // Keep references to remove this as a observer. | 88 // Keep references to remove this as a observer. |
| 92 // While this controller is alive, it needs to be ensured that the instances | 89 // While this controller is alive, it needs to be ensured that the instances |
| 93 // refered from the pointers should be alive. | 90 // refered from the pointers should be alive. |
| 94 WindowTreeHostManager* window_tree_host_manager_; | 91 WindowTreeHostManager* window_tree_host_manager_; |
| 95 | 92 |
| 96 // Window observers to translate events for the window to this controller. | 93 // Window observers to translate events for the window to this controller. |
| 97 std::unique_ptr<PinnedContainerWindowObserver> | 94 std::unique_ptr<PinnedContainerWindowObserver> |
| 98 pinned_container_window_observer_; | 95 pinned_container_window_observer_; |
| 99 std::unique_ptr<PinnedContainerChildWindowObserver> | 96 std::unique_ptr<PinnedContainerChildWindowObserver> |
| 100 pinned_container_child_window_observer_; | 97 pinned_container_child_window_observer_; |
| 101 std::unique_ptr<SystemModalContainerWindowObserver> | 98 std::unique_ptr<SystemModalContainerWindowObserver> |
| 102 system_modal_container_window_observer_; | 99 system_modal_container_window_observer_; |
| 103 std::unique_ptr<SystemModalContainerChildWindowObserver> | 100 std::unique_ptr<SystemModalContainerChildWindowObserver> |
| 104 system_modal_container_child_window_observer_; | 101 system_modal_container_child_window_observer_; |
| 105 | 102 |
| 106 DISALLOW_COPY_AND_ASSIGN(ScreenPinningController); | 103 DISALLOW_COPY_AND_ASSIGN(ScreenPinningController); |
| 107 }; | 104 }; |
| 108 | 105 |
| 109 } // namespace ash | 106 } // namespace ash |
| 110 | 107 |
| 111 #endif // ASH_WM_SCREEN_PINNING_CONTROLLER_H_ | 108 #endif // ASH_WM_SCREEN_PINNING_CONTROLLER_H_ |
| OLD | NEW |