Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1196)

Side by Side Diff: ash/mus/root_window_controller.h

Issue 2072343002: Changes how window manager obtains WindowTree from mus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: include Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/mus/manifest.json ('k') | ash/mus/root_window_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/shelf_layout_manager_delegate.h" 11 #include "ash/mus/shelf_layout_manager_delegate.h"
11 #include "ash/public/interfaces/container.mojom.h" 12 #include "ash/public/interfaces/container.mojom.h"
12 #include "components/mus/public/cpp/window_observer.h" 13 #include "components/mus/public/cpp/window_observer.h"
13 #include "components/mus/public/cpp/window_tree_client.h"
14 #include "components/mus/public/cpp/window_tree_client_delegate.h"
15 #include "components/mus/public/interfaces/window_manager_constants.mojom.h" 14 #include "components/mus/public/interfaces/window_manager_constants.mojom.h"
16 #include "components/mus/public/interfaces/window_tree_host.mojom.h"
17 #include "mojo/public/cpp/bindings/binding.h"
18 #include "ui/display/display.h" 15 #include "ui/display/display.h"
19 16
20 namespace mus {
21 class WindowManagerClient;
22 }
23
24 namespace shell { 17 namespace shell {
25 class Connector; 18 class Connector;
26 } 19 }
27 20
28 namespace ui {
29 class Event;
30 }
31
32 namespace ash { 21 namespace ash {
33 22
34 class AlwaysOnTopController; 23 class AlwaysOnTopController;
35 class RootWindowControllerCommon; 24 class RootWindowControllerCommon;
36 25
37 namespace mus { 26 namespace mus {
38 27
39 class LayoutManager; 28 class LayoutManager;
40 class ShadowController;
41 class ShelfLayoutManager; 29 class ShelfLayoutManager;
42 class StatusLayoutManager; 30 class StatusLayoutManager;
43 class WindowManager; 31 class WindowManager;
44 class WindowManagerApplication;
45 class WmRootWindowControllerMus; 32 class WmRootWindowControllerMus;
46 class WmShelfMus; 33 class WmShelfMus;
47 class WmTestBase; 34 class WmTestBase;
48 class WmTestHelper; 35 class WmTestHelper;
49 class WmWindowMus; 36 class WmWindowMus;
50 37
51 // RootWindowController manages the windows and state for a single display. 38 // RootWindowController manages the windows and state for a single display.
52 // 39 // RootWindowController is tied to the lifetime of the ::mus::Window it is
53 // RootWindowController deletes itself when the root mus::Window is destroyed. 40 // created with. It is assumed the RootWindowController is deleted once the
54 // You can trigger deletion explicitly by way of Destroy(). 41 // associated ::mus::Window is destroyed.
55 class RootWindowController : public ::mus::WindowObserver, 42 class RootWindowController : public ShelfLayoutManagerDelegate {
56 public ::mus::WindowTreeClientDelegate,
57 public ShelfLayoutManagerDelegate {
58 public: 43 public:
59 static RootWindowController* CreateFromDisplay( 44 RootWindowController(WindowManager* window_manager,
60 WindowManagerApplication* app, 45 ::mus::Window* root,
61 ::mus::mojom::DisplayPtr display, 46 const display::Display& display);
62 mojo::InterfaceRequest<::mus::mojom::WindowTreeClient> client_request); 47 ~RootWindowController() override;
63
64 // Deletes this.
65 void Destroy();
66 48
67 shell::Connector* GetConnector(); 49 shell::Connector* GetConnector();
68 50
69 ::mus::Window* root() { return root_; } 51 ::mus::Window* root() { return root_; }
70 52
71 int window_count() { return window_count_; } 53 int window_count() { return window_count_; }
72 void IncrementWindowCount() { ++window_count_; } 54
55 ::mus::Window* NewTopLevelWindow(
56 std::map<std::string, std::vector<uint8_t>>* properties);
73 57
74 ::mus::Window* GetWindowForContainer(mojom::Container container); 58 ::mus::Window* GetWindowForContainer(mojom::Container container);
75 bool WindowIsContainer(::mus::Window* window);
76 59
77 WmWindowMus* GetWindowByShellWindowId(int id); 60 WmWindowMus* GetWindowByShellWindowId(int id);
78 61
79 WindowManager* window_manager() { return window_manager_.get(); } 62 WindowManager* window_manager() { return window_manager_; }
80
81 ::mus::WindowManagerClient* window_manager_client();
82
83 void OnAccelerator(uint32_t id, const ui::Event& event);
84 63
85 const display::Display& display() const { return display_; } 64 const display::Display& display() const { return display_; }
86 65
87 ShelfLayoutManager* GetShelfLayoutManager(); 66 ShelfLayoutManager* GetShelfLayoutManager();
88 StatusLayoutManager* GetStatusLayoutManager(); 67 StatusLayoutManager* GetStatusLayoutManager();
89 68
90 AlwaysOnTopController* always_on_top_controller() { 69 AlwaysOnTopController* always_on_top_controller() {
91 return always_on_top_controller_.get(); 70 return always_on_top_controller_.get();
92 } 71 }
93 72
94 WmShelfMus* wm_shelf() { return wm_shelf_.get(); } 73 WmShelfMus* wm_shelf() { return wm_shelf_.get(); }
95 74
96 private: 75 private:
97 friend class WmTestBase; 76 friend class WmTestBase;
98 friend class WmTestHelper; 77 friend class WmTestHelper;
99 78
100 explicit RootWindowController(WindowManagerApplication* app); 79 gfx::Rect CalculateDefaultBounds(::mus::Window* window) const;
101 ~RootWindowController() override; 80 gfx::Rect GetMaximizedWindowBounds() const;
102
103 void AddAccelerators();
104
105 // WindowTreeClientDelegate:
106 void OnEmbed(::mus::Window* root) override;
107 void OnWindowTreeClientDestroyed(::mus::WindowTreeClient* client) override;
108 void OnEventObserved(const ui::Event& event, ::mus::Window* target) override;
109
110 // ::mus::WindowObserver:
111 void OnWindowDestroyed(::mus::Window* window) override;
112 81
113 // ShelfLayoutManagerDelegate: 82 // ShelfLayoutManagerDelegate:
114 void OnShelfWindowAvailable() override; 83 void OnShelfWindowAvailable() override;
115 84
116 // Creates the necessary set of layout managers in the shell windows. 85 // Creates the necessary set of layout managers in the shell windows.
117 void CreateLayoutManagers(); 86 void CreateLayoutManagers();
118 87
119 WindowManagerApplication* app_; 88 WindowManager* window_manager_;
120 ::mus::Window* root_; 89 ::mus::Window* root_;
121 int window_count_; 90 int window_count_ = 0;
91
92 display::Display display_;
122 93
123 std::unique_ptr<RootWindowControllerCommon> root_window_controller_common_; 94 std::unique_ptr<RootWindowControllerCommon> root_window_controller_common_;
124 95
125 std::unique_ptr<WmRootWindowControllerMus> wm_root_window_controller_; 96 std::unique_ptr<WmRootWindowControllerMus> wm_root_window_controller_;
126 std::unique_ptr<WmShelfMus> wm_shelf_; 97 std::unique_ptr<WmShelfMus> wm_shelf_;
127 98
128 std::unique_ptr<WindowManager> window_manager_;
129
130 std::map<::mus::Window*, std::unique_ptr<LayoutManager>> layout_managers_; 99 std::map<::mus::Window*, std::unique_ptr<LayoutManager>> layout_managers_;
131 100
132 std::unique_ptr<ShadowController> shadow_controller_; 101 std::unique_ptr<AlwaysOnTopController> always_on_top_controller_;
133 102
134 display::Display display_; 103 std::unique_ptr<DisconnectedAppHandler> disconnected_app_handler_;
135
136 std::unique_ptr<AlwaysOnTopController> always_on_top_controller_;
137 104
138 DISALLOW_COPY_AND_ASSIGN(RootWindowController); 105 DISALLOW_COPY_AND_ASSIGN(RootWindowController);
139 }; 106 };
140 107
141 } // namespace mus 108 } // namespace mus
142 } // namespace ash 109 } // namespace ash
143 110
144 #endif // ASH_MUS_ROOT_WINDOW_CONTROLLER_H_ 111 #endif // ASH_MUS_ROOT_WINDOW_CONTROLLER_H_
OLDNEW
« no previous file with comments | « ash/mus/manifest.json ('k') | ash/mus/root_window_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698