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/root_window_controller.h" |
11 #include "services/ui/public/interfaces/window_manager_constants.mojom.h" | 12 #include "services/ui/public/interfaces/window_manager_constants.mojom.h" |
12 #include "ui/display/display.h" | 13 #include "ui/display/display.h" |
13 | 14 |
14 namespace aura { | 15 namespace aura { |
15 class WindowTreeHostMus; | 16 class WindowTreeHostMus; |
16 namespace client { | |
17 class WindowParentingClient; | |
18 } | |
19 } | 17 } |
20 | 18 |
21 namespace gfx { | 19 namespace gfx { |
22 class Insets; | 20 class Insets; |
23 } | 21 } |
24 | 22 |
25 namespace service_manager { | 23 namespace service_manager { |
26 class Connector; | 24 class Connector; |
27 } | 25 } |
28 | 26 |
29 namespace ash { | 27 namespace ash { |
30 | |
31 class WmShelf; | |
32 | |
33 namespace mus { | 28 namespace mus { |
34 | 29 |
35 class WindowManager; | 30 class WindowManager; |
36 class WmRootWindowControllerMus; | |
37 class WmTestBase; | 31 class WmTestBase; |
38 class WmTestHelper; | 32 class WmTestHelper; |
39 class WmWindowMus; | 33 class WmWindowMus; |
40 | 34 |
41 // RootWindowController manages the windows and state for a single display. | 35 // RootWindowController manages the windows and state for a single display. |
42 // RootWindowController takes ownership of the WindowTreeHostMus that it passed | 36 // RootWindowController takes ownership of the WindowTreeHostMus that it passed |
43 // to it. | 37 // to it. |
| 38 // TODO(sky): rename this (or possibly just remove entirely). |
| 39 // http://crbug.com/671246 |
44 class RootWindowController { | 40 class RootWindowController { |
45 public: | 41 public: |
46 RootWindowController( | 42 RootWindowController( |
47 WindowManager* window_manager, | 43 WindowManager* window_manager, |
48 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host, | 44 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host, |
49 const display::Display& display); | 45 const display::Display& display, |
| 46 ash::RootWindowController::RootWindowType root_window_type); |
50 ~RootWindowController(); | 47 ~RootWindowController(); |
51 | 48 |
| 49 // Returns the RootWindowController for |window|'s root. |
| 50 static RootWindowController* ForWindow(aura::Window* window); |
| 51 |
52 void Shutdown(); | 52 void Shutdown(); |
53 | 53 |
54 service_manager::Connector* GetConnector(); | 54 service_manager::Connector* GetConnector(); |
55 | 55 |
56 aura::Window* root(); | 56 aura::Window* root(); |
57 const aura::Window* root() const; | 57 const aura::Window* root() const; |
58 WmRootWindowControllerMus* wm_root_window_controller() { | |
59 return wm_root_window_controller_.get(); | |
60 } | |
61 | 58 |
62 aura::Window* NewTopLevelWindow( | 59 aura::Window* NewTopLevelWindow( |
63 ui::mojom::WindowType window_type, | 60 ui::mojom::WindowType window_type, |
64 std::map<std::string, std::vector<uint8_t>>* properties); | 61 std::map<std::string, std::vector<uint8_t>>* properties); |
65 | 62 |
66 WmWindowMus* GetWindowByShellWindowId(int id); | 63 WmWindowMus* GetWindowByShellWindowId(int id); |
67 | 64 |
68 void SetWorkAreaInests(const gfx::Insets& insets); | 65 void SetWorkAreaInests(const gfx::Insets& insets); |
69 void SetDisplay(const display::Display& display); | 66 void SetDisplay(const display::Display& display); |
70 | 67 |
71 WindowManager* window_manager() { return window_manager_; } | 68 WindowManager* window_manager() { return window_manager_; } |
72 | 69 |
73 aura::WindowTreeHostMus* window_tree_host() { | 70 aura::WindowTreeHostMus* window_tree_host() { return window_tree_host_; } |
74 return window_tree_host_.get(); | |
75 } | |
76 | 71 |
77 const display::Display& display() const { return display_; } | 72 const display::Display& display() const { return display_; } |
78 | 73 |
79 WmShelf* wm_shelf() { return wm_shelf_.get(); } | 74 ash::RootWindowController* ash_root_window_controller() { |
| 75 return ash_root_window_controller_.get(); |
| 76 } |
80 | 77 |
81 private: | 78 private: |
82 friend class WmTestBase; | 79 friend class WmTestBase; |
83 friend class WmTestHelper; | 80 friend class WmTestHelper; |
84 | 81 |
85 gfx::Rect CalculateDefaultBounds( | 82 gfx::Rect CalculateDefaultBounds( |
86 aura::Window* container_window, | 83 aura::Window* container_window, |
87 const std::map<std::string, std::vector<uint8_t>>* properties) const; | 84 const std::map<std::string, std::vector<uint8_t>>* properties) const; |
88 gfx::Rect GetMaximizedWindowBounds() const; | 85 gfx::Rect GetMaximizedWindowBounds() const; |
89 | 86 |
90 WindowManager* window_manager_; | 87 WindowManager* window_manager_; |
91 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host_; | 88 std::unique_ptr<ash::RootWindowController> ash_root_window_controller_; |
| 89 // Owned by |ash_root_window_controller_|. |
| 90 aura::WindowTreeHostMus* window_tree_host_; |
92 int window_count_ = 0; | 91 int window_count_ = 0; |
93 | 92 |
94 display::Display display_; | 93 display::Display display_; |
95 | 94 |
96 std::unique_ptr<WmRootWindowControllerMus> wm_root_window_controller_; | |
97 std::unique_ptr<WmShelf> wm_shelf_; | |
98 | |
99 std::unique_ptr<aura::client::WindowParentingClient> parenting_client_; | |
100 | |
101 std::unique_ptr<DisconnectedAppHandler> disconnected_app_handler_; | 95 std::unique_ptr<DisconnectedAppHandler> disconnected_app_handler_; |
102 | 96 |
103 DISALLOW_COPY_AND_ASSIGN(RootWindowController); | 97 DISALLOW_COPY_AND_ASSIGN(RootWindowController); |
104 }; | 98 }; |
105 | 99 |
106 } // namespace mus | 100 } // namespace mus |
107 } // namespace ash | 101 } // namespace ash |
108 | 102 |
109 #endif // ASH_MUS_ROOT_WINDOW_CONTROLLER_H_ | 103 #endif // ASH_MUS_ROOT_WINDOW_CONTROLLER_H_ |
OLD | NEW |