| 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_MUS_ROOT_WINDOW_CONTROLLER_H_ | 5 #ifndef ASH_MUS_ROOT_WINDOW_CONTROLLER_H_ |
| 6 #define ASH_MUS_ROOT_WINDOW_CONTROLLER_H_ | 6 #define ASH_MUS_ROOT_WINDOW_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "ash/mus/disconnected_app_handler.h" | 10 #include "ash/mus/disconnected_app_handler.h" |
| 11 #include "ash/mus/shelf_layout_manager_delegate.h" | |
| 12 #include "ash/public/interfaces/container.mojom.h" | 11 #include "ash/public/interfaces/container.mojom.h" |
| 13 #include "services/ui/public/cpp/window_observer.h" | 12 #include "services/ui/public/cpp/window_observer.h" |
| 14 #include "services/ui/public/interfaces/window_manager_constants.mojom.h" | 13 #include "services/ui/public/interfaces/window_manager_constants.mojom.h" |
| 15 #include "ui/display/display.h" | 14 #include "ui/display/display.h" |
| 16 | 15 |
| 17 namespace shell { | 16 namespace shell { |
| 18 class Connector; | 17 class Connector; |
| 19 } | 18 } |
| 20 | 19 |
| 21 namespace ash { | 20 namespace ash { |
| 22 | 21 |
| 23 class AlwaysOnTopController; | 22 class AlwaysOnTopController; |
| 24 class RootWindowControllerCommon; | 23 class RootWindowControllerCommon; |
| 25 class WorkspaceLayoutManager; | 24 class WorkspaceLayoutManager; |
| 26 | 25 |
| 27 namespace mus { | 26 namespace mus { |
| 28 | 27 |
| 29 class LayoutManager; | 28 class LayoutManager; |
| 30 class WindowManager; | 29 class WindowManager; |
| 31 class WmRootWindowControllerMus; | 30 class WmRootWindowControllerMus; |
| 32 class WmShelfMus; | 31 class WmShelfMus; |
| 33 class WmTestBase; | 32 class WmTestBase; |
| 34 class WmTestHelper; | 33 class WmTestHelper; |
| 35 class WmWindowMus; | 34 class WmWindowMus; |
| 36 | 35 |
| 37 // RootWindowController manages the windows and state for a single display. | 36 // RootWindowController manages the windows and state for a single display. |
| 38 // RootWindowController is tied to the lifetime of the ui::Window it is | 37 // RootWindowController is tied to the lifetime of the ui::Window it is |
| 39 // created with. It is assumed the RootWindowController is deleted once the | 38 // created with. It is assumed the RootWindowController is deleted once the |
| 40 // associated ui::Window is destroyed. | 39 // associated ui::Window is destroyed. |
| 41 class RootWindowController : public ShelfLayoutManagerDelegate { | 40 class RootWindowController { |
| 42 public: | 41 public: |
| 43 RootWindowController(WindowManager* window_manager, | 42 RootWindowController(WindowManager* window_manager, |
| 44 ui::Window* root, | 43 ui::Window* root, |
| 45 const display::Display& display); | 44 const display::Display& display); |
| 46 ~RootWindowController() override; | 45 ~RootWindowController(); |
| 47 | 46 |
| 48 shell::Connector* GetConnector(); | 47 shell::Connector* GetConnector(); |
| 49 | 48 |
| 50 ui::Window* root() { return root_; } | 49 ui::Window* root() { return root_; } |
| 51 | 50 |
| 52 ui::Window* NewTopLevelWindow( | 51 ui::Window* NewTopLevelWindow( |
| 53 std::map<std::string, std::vector<uint8_t>>* properties); | 52 std::map<std::string, std::vector<uint8_t>>* properties); |
| 54 | 53 |
| 55 ui::Window* GetWindowForContainer(mojom::Container container); | 54 ui::Window* GetWindowForContainer(mojom::Container container); |
| 56 | 55 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 70 | 69 |
| 71 WmShelfMus* wm_shelf() { return wm_shelf_.get(); } | 70 WmShelfMus* wm_shelf() { return wm_shelf_.get(); } |
| 72 | 71 |
| 73 private: | 72 private: |
| 74 friend class WmTestBase; | 73 friend class WmTestBase; |
| 75 friend class WmTestHelper; | 74 friend class WmTestHelper; |
| 76 | 75 |
| 77 gfx::Rect CalculateDefaultBounds(ui::Window* window) const; | 76 gfx::Rect CalculateDefaultBounds(ui::Window* window) const; |
| 78 gfx::Rect GetMaximizedWindowBounds() const; | 77 gfx::Rect GetMaximizedWindowBounds() const; |
| 79 | 78 |
| 80 // ShelfLayoutManagerDelegate: | |
| 81 void OnShelfWindowAvailable() override; | |
| 82 | |
| 83 // Creates the necessary set of layout managers in the shell windows. | 79 // Creates the necessary set of layout managers in the shell windows. |
| 84 void CreateLayoutManagers(); | 80 void CreateLayoutManagers(); |
| 85 | 81 |
| 86 WindowManager* window_manager_; | 82 WindowManager* window_manager_; |
| 87 ui::Window* root_; | 83 ui::Window* root_; |
| 88 int window_count_ = 0; | 84 int window_count_ = 0; |
| 89 | 85 |
| 90 display::Display display_; | 86 display::Display display_; |
| 91 | 87 |
| 92 std::unique_ptr<RootWindowControllerCommon> root_window_controller_common_; | 88 std::unique_ptr<RootWindowControllerCommon> root_window_controller_common_; |
| 93 | 89 |
| 94 std::unique_ptr<WmRootWindowControllerMus> wm_root_window_controller_; | 90 std::unique_ptr<WmRootWindowControllerMus> wm_root_window_controller_; |
| 95 std::unique_ptr<WmShelfMus> wm_shelf_; | 91 std::unique_ptr<WmShelfMus> wm_shelf_; |
| 96 | 92 |
| 97 // Owned by the corresponding container. | 93 // Owned by the corresponding container. |
| 98 WorkspaceLayoutManager* workspace_layout_manager_ = nullptr; | 94 WorkspaceLayoutManager* workspace_layout_manager_ = nullptr; |
| 99 std::map<ui::Window*, std::unique_ptr<LayoutManager>> layout_managers_; | 95 std::map<ui::Window*, std::unique_ptr<LayoutManager>> layout_managers_; |
| 100 | 96 |
| 101 std::unique_ptr<AlwaysOnTopController> always_on_top_controller_; | 97 std::unique_ptr<AlwaysOnTopController> always_on_top_controller_; |
| 102 | 98 |
| 103 std::unique_ptr<DisconnectedAppHandler> disconnected_app_handler_; | 99 std::unique_ptr<DisconnectedAppHandler> disconnected_app_handler_; |
| 104 | 100 |
| 105 DISALLOW_COPY_AND_ASSIGN(RootWindowController); | 101 DISALLOW_COPY_AND_ASSIGN(RootWindowController); |
| 106 }; | 102 }; |
| 107 | 103 |
| 108 } // namespace mus | 104 } // namespace mus |
| 109 } // namespace ash | 105 } // namespace ash |
| 110 | 106 |
| 111 #endif // ASH_MUS_ROOT_WINDOW_CONTROLLER_H_ | 107 #endif // ASH_MUS_ROOT_WINDOW_CONTROLLER_H_ |
| OLD | NEW |