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