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

Side by Side Diff: ash/mus/window_manager_application.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/window_manager.cc ('k') | ash/mus/window_manager_application.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_WINDOW_MANAGER_APPLICATION_H_ 5 #ifndef ASH_MUS_WINDOW_MANAGER_APPLICATION_H_
6 #define ASH_MUS_WINDOW_MANAGER_APPLICATION_H_ 6 #define ASH_MUS_WINDOW_MANAGER_APPLICATION_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 #include <set> 11 #include <set>
12 12
13 #include "ash/mus/root_windows_observer.h"
13 #include "ash/public/interfaces/shelf_layout.mojom.h" 14 #include "ash/public/interfaces/shelf_layout.mojom.h"
14 #include "ash/public/interfaces/user_window_controller.mojom.h" 15 #include "ash/public/interfaces/user_window_controller.mojom.h"
15 #include "base/macros.h" 16 #include "base/macros.h"
16 #include "base/observer_list.h"
17 #include "components/mus/common/types.h" 17 #include "components/mus/common/types.h"
18 #include "components/mus/public/interfaces/accelerator_registrar.mojom.h" 18 #include "components/mus/public/interfaces/accelerator_registrar.mojom.h"
19 #include "components/mus/public/interfaces/window_manager.mojom.h"
20 #include "components/mus/public/interfaces/window_manager_factory.mojom.h"
21 #include "components/mus/public/interfaces/window_tree_host.mojom.h"
22 #include "mash/session/public/interfaces/session.mojom.h" 19 #include "mash/session/public/interfaces/session.mojom.h"
23 #include "mojo/public/cpp/bindings/binding.h" 20 #include "mojo/public/cpp/bindings/binding.h"
24 #include "mojo/public/cpp/bindings/binding_set.h" 21 #include "mojo/public/cpp/bindings/binding_set.h"
25 #include "services/shell/public/cpp/shell_client.h" 22 #include "services/shell/public/cpp/shell_client.h"
26 #include "services/tracing/public/cpp/tracing_impl.h" 23 #include "services/tracing/public/cpp/tracing_impl.h"
27 24
28 namespace display { 25 namespace mus {
29 class Screen; 26 class WindowTreeClient;
30 } 27 }
31 28
32 namespace views { 29 namespace views {
33 class AuraInit; 30 class AuraInit;
34 } 31 }
35 32
36 namespace ui { 33 namespace ui {
37 class Event; 34 class Event;
38 } 35 }
39 36
40 namespace ash { 37 namespace ash {
41 namespace mus { 38 namespace mus {
42 39
43 class AcceleratorRegistrarImpl; 40 class AcceleratorRegistrarImpl;
44 class RootWindowController; 41 class RootWindowController;
45 class RootWindowsObserver;
46 class ShelfLayoutImpl; 42 class ShelfLayoutImpl;
47 class UserWindowControllerImpl; 43 class UserWindowControllerImpl;
48 class WmShellMus; 44 class WindowManager;
49 class WmLookupMus;
50 class WmScreen;
51 45
52 class WindowManagerApplication 46 class WindowManagerApplication
53 : public shell::ShellClient, 47 : public shell::ShellClient,
54 public ::mus::mojom::WindowManagerFactory,
55 public shell::InterfaceFactory<mojom::ShelfLayout>, 48 public shell::InterfaceFactory<mojom::ShelfLayout>,
56 public shell::InterfaceFactory<mojom::UserWindowController>, 49 public shell::InterfaceFactory<mojom::UserWindowController>,
57 public shell::InterfaceFactory<::mus::mojom::AcceleratorRegistrar> { 50 public shell::InterfaceFactory<::mus::mojom::AcceleratorRegistrar>,
51 public mash::session::mojom::ScreenlockStateListener,
52 public RootWindowsObserver {
58 public: 53 public:
59 WindowManagerApplication(); 54 WindowManagerApplication();
60 ~WindowManagerApplication() override; 55 ~WindowManagerApplication() override;
61 56
62 shell::Connector* connector() { return connector_; } 57 shell::Connector* connector() { return connector_; }
63 58
64 // Returns the RootWindowControllers that have valid roots. 59 WindowManager* window_manager() { return window_manager_.get(); }
65 //
66 // NOTE: this does not return |controllers_| as most clients want a
67 // RootWindowController that has a valid root window.
68 std::set<RootWindowController*> GetRootControllers();
69
70 WmShellMus* shell() { return shell_.get(); }
71
72 // Called when the root window of |root_controller| is obtained.
73 void OnRootWindowControllerGotRoot(RootWindowController* root_controller);
74
75 // Called after RootWindowController creates the necessary resources.
76 void OnRootWindowControllerDoneInit(RootWindowController* root_controller);
77
78 // Called when the root mus::Window of RootWindowController is destroyed.
79 // |root_controller| is destroyed after this call.
80 void OnRootWindowDestroyed(RootWindowController* root_controller);
81 60
82 // TODO(sky): figure out right place for this code. 61 // TODO(sky): figure out right place for this code.
83 void OnAccelerator(uint32_t id, const ui::Event& event); 62 void OnAccelerator(uint32_t id, const ui::Event& event);
84 63
85 void AddRootWindowsObserver(RootWindowsObserver* observer);
86 void RemoveRootWindowsObserver(RootWindowsObserver* observer);
87
88 mash::session::mojom::Session* session() { return session_.get(); } 64 mash::session::mojom::Session* session() { return session_.get(); }
89 65
90 private: 66 private:
91 friend class WmTestBase; 67 friend class WmTestBase;
92 friend class WmTestHelper; 68 friend class WmTestHelper;
93 69
94 void OnAcceleratorRegistrarDestroyed(AcceleratorRegistrarImpl* registrar); 70 void OnAcceleratorRegistrarDestroyed(AcceleratorRegistrarImpl* registrar);
95 71
96 // Adds |root_window_controller| to the set of known roots. 72 void InitWindowManager(::mus::WindowTreeClient* window_tree_client);
97 void AddRootWindowController(RootWindowController* root_window_controller);
98 73
99 // shell::ShellClient: 74 // shell::ShellClient:
100 void Initialize(shell::Connector* connector, 75 void Initialize(shell::Connector* connector,
101 const shell::Identity& identity, 76 const shell::Identity& identity,
102 uint32_t id) override; 77 uint32_t id) override;
103 bool AcceptConnection(shell::Connection* connection) override; 78 bool AcceptConnection(shell::Connection* connection) override;
104 79
105 // shell::InterfaceFactory<mojom::ShelfLayout>: 80 // shell::InterfaceFactory<mojom::ShelfLayout>:
106 void Create(shell::Connection* connection, 81 void Create(shell::Connection* connection,
107 mojo::InterfaceRequest<mojom::ShelfLayout> request) override; 82 mojo::InterfaceRequest<mojom::ShelfLayout> request) override;
108 83
109 // shell::InterfaceFactory<mojom::UserWindowController>: 84 // shell::InterfaceFactory<mojom::UserWindowController>:
110 void Create( 85 void Create(
111 shell::Connection* connection, 86 shell::Connection* connection,
112 mojo::InterfaceRequest<mojom::UserWindowController> request) override; 87 mojo::InterfaceRequest<mojom::UserWindowController> request) override;
113 88
114 // shell::InterfaceFactory<mus::mojom::AcceleratorRegistrar>: 89 // shell::InterfaceFactory<mus::mojom::AcceleratorRegistrar>:
115 void Create(shell::Connection* connection, 90 void Create(shell::Connection* connection,
116 mojo::InterfaceRequest<::mus::mojom::AcceleratorRegistrar> 91 mojo::InterfaceRequest<::mus::mojom::AcceleratorRegistrar>
117 request) override; 92 request) override;
118 93
119 // mus::mojom::WindowManagerFactory: 94 // session::mojom::ScreenlockStateListener:
120 void CreateWindowManager( 95 void ScreenlockStateChanged(bool locked) override;
121 ::mus::mojom::DisplayPtr display, 96
122 mojo::InterfaceRequest<::mus::mojom::WindowTreeClient> client_request) 97 // RootWindowsObserver:
123 override; 98 void OnRootWindowControllerAdded(RootWindowController* controller) override;
99 void OnWillDestroyRootWindowController(
100 RootWindowController* controller) override;
124 101
125 shell::Connector* connector_; 102 shell::Connector* connector_;
126 103
127 mojo::TracingImpl tracing_; 104 mojo::TracingImpl tracing_;
128 105
129 std::unique_ptr<display::Screen> screen_;
130 std::unique_ptr<views::AuraInit> aura_init_; 106 std::unique_ptr<views::AuraInit> aura_init_;
131 107
132 std::unique_ptr<WmShellMus> shell_;
133 std::unique_ptr<WmLookupMus> lookup_;
134
135 // The |shelf_layout_| object is created once OnEmbed() is called. Until that 108 // The |shelf_layout_| object is created once OnEmbed() is called. Until that
136 // time |shelf_layout_requests_| stores pending interface requests. 109 // time |shelf_layout_requests_| stores pending interface requests.
137 std::unique_ptr<ShelfLayoutImpl> shelf_layout_; 110 std::unique_ptr<ShelfLayoutImpl> shelf_layout_;
138 mojo::BindingSet<mojom::ShelfLayout> shelf_layout_bindings_; 111 mojo::BindingSet<mojom::ShelfLayout> shelf_layout_bindings_;
139 std::vector<std::unique_ptr<mojo::InterfaceRequest<mojom::ShelfLayout>>> 112 std::vector<std::unique_ptr<mojo::InterfaceRequest<mojom::ShelfLayout>>>
140 shelf_layout_requests_; 113 shelf_layout_requests_;
141 114
142 // |user_window_controller_| is created once OnEmbed() is called. Until that 115 // |user_window_controller_| is created once OnEmbed() is called. Until that
143 // time |user_window_controller_requests_| stores pending interface requests. 116 // time |user_window_controller_requests_| stores pending interface requests.
144 std::unique_ptr<UserWindowControllerImpl> user_window_controller_; 117 std::unique_ptr<UserWindowControllerImpl> user_window_controller_;
145 mojo::BindingSet<mojom::UserWindowController> 118 mojo::BindingSet<mojom::UserWindowController>
146 user_window_controller_bindings_; 119 user_window_controller_bindings_;
147 std::vector< 120 std::vector<
148 std::unique_ptr<mojo::InterfaceRequest<mojom::UserWindowController>>> 121 std::unique_ptr<mojo::InterfaceRequest<mojom::UserWindowController>>>
149 user_window_controller_requests_; 122 user_window_controller_requests_;
150 123
124 std::unique_ptr<WindowManager> window_manager_;
125
151 std::set<AcceleratorRegistrarImpl*> accelerator_registrars_; 126 std::set<AcceleratorRegistrarImpl*> accelerator_registrars_;
152 std::set<RootWindowController*> root_controllers_;
153
154 mojo::Binding<::mus::mojom::WindowManagerFactory>
155 window_manager_factory_binding_;
156 127
157 mash::session::mojom::SessionPtr session_; 128 mash::session::mojom::SessionPtr session_;
158 129
159 base::ObserverList<RootWindowsObserver> root_windows_observers_; 130 mojo::Binding<mash::session::mojom::ScreenlockStateListener>
131 screenlock_state_listener_binding_;
160 132
161 DISALLOW_COPY_AND_ASSIGN(WindowManagerApplication); 133 DISALLOW_COPY_AND_ASSIGN(WindowManagerApplication);
162 }; 134 };
163 135
164 } // namespace mus 136 } // namespace mus
165 } // namespace ash 137 } // namespace ash
166 138
167 #endif // ASH_MUS_WINDOW_MANAGER_APPLICATION_H_ 139 #endif // ASH_MUS_WINDOW_MANAGER_APPLICATION_H_
OLDNEW
« no previous file with comments | « ash/mus/window_manager.cc ('k') | ash/mus/window_manager_application.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698