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

Side by Side Diff: components/mus/mus_app.cc

Issue 1675083002: Rename ApplicationDelegate to ShellClient (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@delegate
Patch Set: . Created 4 years, 10 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 | « components/mus/mus_app.h ('k') | components/mus/public/cpp/tests/window_server_test_base.h » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "components/mus/mus_app.h" 5 #include "components/mus/mus_app.h"
6 6
7 #include "base/stl_util.h" 7 #include "base/stl_util.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "components/mus/common/args.h" 9 #include "components/mus/common/args.h"
10 #include "components/mus/gles2/gpu_impl.h" 10 #include "components/mus/gles2/gpu_impl.h"
11 #include "components/mus/ws/client_connection.h" 11 #include "components/mus/ws/client_connection.h"
12 #include "components/mus/ws/connection_manager.h" 12 #include "components/mus/ws/connection_manager.h"
13 #include "components/mus/ws/window_tree_factory.h" 13 #include "components/mus/ws/window_tree_factory.h"
14 #include "components/mus/ws/window_tree_host_connection.h" 14 #include "components/mus/ws/window_tree_host_connection.h"
15 #include "components/mus/ws/window_tree_host_impl.h" 15 #include "components/mus/ws/window_tree_host_impl.h"
16 #include "components/mus/ws/window_tree_impl.h" 16 #include "components/mus/ws/window_tree_impl.h"
17 #include "mojo/public/c/system/main.h" 17 #include "mojo/public/c/system/main.h"
18 #include "mojo/services/tracing/public/cpp/tracing_impl.h" 18 #include "mojo/services/tracing/public/cpp/tracing_impl.h"
19 #include "mojo/shell/public/cpp/application_connection.h" 19 #include "mojo/shell/public/cpp/connection.h"
20 #include "mojo/shell/public/cpp/shell.h" 20 #include "mojo/shell/public/cpp/shell.h"
21 #include "ui/events/event_switches.h" 21 #include "ui/events/event_switches.h"
22 #include "ui/events/platform/platform_event_source.h" 22 #include "ui/events/platform/platform_event_source.h"
23 #include "ui/gl/gl_surface.h" 23 #include "ui/gl/gl_surface.h"
24 24
25 #if defined(USE_X11) 25 #if defined(USE_X11)
26 #include <X11/Xlib.h> 26 #include <X11/Xlib.h>
27 #include "base/command_line.h" 27 #include "base/command_line.h"
28 #include "ui/platform_window/x11/x11_window.h" 28 #include "ui/platform_window/x11/x11_window.h"
29 #elif defined(USE_OZONE) 29 #elif defined(USE_OZONE)
30 #include "ui/ozone/public/ozone_platform.h" 30 #include "ui/ozone/public/ozone_platform.h"
31 #endif 31 #endif
32 32
33 using mojo::ApplicationConnection; 33 using mojo::Connection;
34 using mojo::InterfaceRequest; 34 using mojo::InterfaceRequest;
35 using mus::mojom::WindowTreeHostFactory; 35 using mus::mojom::WindowTreeHostFactory;
36 using mus::mojom::Gpu; 36 using mus::mojom::Gpu;
37 37
38 namespace mus { 38 namespace mus {
39 39
40 // TODO(sky): this is a pretty typical pattern, make it easier to do. 40 // TODO(sky): this is a pretty typical pattern, make it easier to do.
41 struct MandolineUIServicesApp::PendingRequest { 41 struct MandolineUIServicesApp::PendingRequest {
42 scoped_ptr<mojo::InterfaceRequest<mojom::DisplayManager>> dm_request; 42 scoped_ptr<mojo::InterfaceRequest<mojom::DisplayManager>> dm_request;
43 scoped_ptr<mojo::InterfaceRequest<mojom::WindowTreeFactory>> wtf_request; 43 scoped_ptr<mojo::InterfaceRequest<mojom::WindowTreeFactory>> wtf_request;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 83
84 // TODO(rjkroege): It is possible that we might want to generalize the 84 // TODO(rjkroege): It is possible that we might want to generalize the
85 // GpuState object. 85 // GpuState object.
86 if (!gpu_state_.get()) 86 if (!gpu_state_.get())
87 gpu_state_ = new GpuState(hardware_rendering_available); 87 gpu_state_ = new GpuState(hardware_rendering_available);
88 connection_manager_.reset(new ws::ConnectionManager(this, surfaces_state_)); 88 connection_manager_.reset(new ws::ConnectionManager(this, surfaces_state_));
89 89
90 tracing_.Initialize(shell, url); 90 tracing_.Initialize(shell, url);
91 } 91 }
92 92
93 bool MandolineUIServicesApp::AcceptConnection( 93 bool MandolineUIServicesApp::AcceptConnection(Connection* connection) {
94 ApplicationConnection* connection) {
95 connection->AddService<Gpu>(this); 94 connection->AddService<Gpu>(this);
96 connection->AddService<mojom::DisplayManager>(this); 95 connection->AddService<mojom::DisplayManager>(this);
97 connection->AddService<mojom::WindowManagerFactoryService>(this); 96 connection->AddService<mojom::WindowManagerFactoryService>(this);
98 connection->AddService<mojom::WindowTreeFactory>(this); 97 connection->AddService<mojom::WindowTreeFactory>(this);
99 connection->AddService<WindowTreeHostFactory>(this); 98 connection->AddService<WindowTreeHostFactory>(this);
100 return true; 99 return true;
101 } 100 }
102 101
103 void MandolineUIServicesApp::OnFirstRootConnectionCreated() { 102 void MandolineUIServicesApp::OnFirstRootConnectionCreated() {
104 PendingRequests requests; 103 PendingRequests requests;
(...skipping 18 matching lines...) Expand all
123 uint32_t policy_bitmask, 122 uint32_t policy_bitmask,
124 mojom::WindowTreeClientPtr client) { 123 mojom::WindowTreeClientPtr client) {
125 scoped_ptr<ws::WindowTreeImpl> service( 124 scoped_ptr<ws::WindowTreeImpl> service(
126 new ws::WindowTreeImpl(connection_manager, root, policy_bitmask)); 125 new ws::WindowTreeImpl(connection_manager, root, policy_bitmask));
127 return new ws::DefaultClientConnection(std::move(service), connection_manager, 126 return new ws::DefaultClientConnection(std::move(service), connection_manager,
128 std::move(tree_request), 127 std::move(tree_request),
129 std::move(client)); 128 std::move(client));
130 } 129 }
131 130
132 void MandolineUIServicesApp::Create( 131 void MandolineUIServicesApp::Create(
133 mojo::ApplicationConnection* connection, 132 mojo::Connection* connection,
134 mojo::InterfaceRequest<mojom::DisplayManager> request) { 133 mojo::InterfaceRequest<mojom::DisplayManager> request) {
135 if (!connection_manager_->has_tree_host_connections()) { 134 if (!connection_manager_->has_tree_host_connections()) {
136 scoped_ptr<PendingRequest> pending_request(new PendingRequest); 135 scoped_ptr<PendingRequest> pending_request(new PendingRequest);
137 pending_request->dm_request.reset( 136 pending_request->dm_request.reset(
138 new mojo::InterfaceRequest<mojom::DisplayManager>(std::move(request))); 137 new mojo::InterfaceRequest<mojom::DisplayManager>(std::move(request)));
139 pending_requests_.push_back(std::move(pending_request)); 138 pending_requests_.push_back(std::move(pending_request));
140 return; 139 return;
141 } 140 }
142 connection_manager_->AddDisplayManagerBinding(std::move(request)); 141 connection_manager_->AddDisplayManagerBinding(std::move(request));
143 } 142 }
144 143
145 void MandolineUIServicesApp::Create( 144 void MandolineUIServicesApp::Create(
146 mojo::ApplicationConnection* connection, 145 mojo::Connection* connection,
147 mojo::InterfaceRequest<mojom::WindowManagerFactoryService> request) { 146 mojo::InterfaceRequest<mojom::WindowManagerFactoryService> request) {
148 connection_manager_->CreateWindowManagerFactoryService(std::move(request)); 147 connection_manager_->CreateWindowManagerFactoryService(std::move(request));
149 } 148 }
150 149
151 void MandolineUIServicesApp::Create( 150 void MandolineUIServicesApp::Create(
152 ApplicationConnection* connection, 151 Connection* connection,
153 InterfaceRequest<mojom::WindowTreeFactory> request) { 152 InterfaceRequest<mojom::WindowTreeFactory> request) {
154 if (!connection_manager_->has_tree_host_connections()) { 153 if (!connection_manager_->has_tree_host_connections()) {
155 scoped_ptr<PendingRequest> pending_request(new PendingRequest); 154 scoped_ptr<PendingRequest> pending_request(new PendingRequest);
156 pending_request->wtf_request.reset( 155 pending_request->wtf_request.reset(
157 new mojo::InterfaceRequest<mojom::WindowTreeFactory>( 156 new mojo::InterfaceRequest<mojom::WindowTreeFactory>(
158 std::move(request))); 157 std::move(request)));
159 pending_requests_.push_back(std::move(pending_request)); 158 pending_requests_.push_back(std::move(pending_request));
160 return; 159 return;
161 } 160 }
162 if (!window_tree_factory_) { 161 if (!window_tree_factory_) {
163 window_tree_factory_.reset( 162 window_tree_factory_.reset(
164 new ws::WindowTreeFactory(connection_manager_.get())); 163 new ws::WindowTreeFactory(connection_manager_.get()));
165 } 164 }
166 window_tree_factory_->AddBinding(std::move(request)); 165 window_tree_factory_->AddBinding(std::move(request));
167 } 166 }
168 167
169 void MandolineUIServicesApp::Create( 168 void MandolineUIServicesApp::Create(
170 ApplicationConnection* connection, 169 Connection* connection,
171 InterfaceRequest<WindowTreeHostFactory> request) { 170 InterfaceRequest<WindowTreeHostFactory> request) {
172 factory_bindings_.AddBinding(this, std::move(request)); 171 factory_bindings_.AddBinding(this, std::move(request));
173 } 172 }
174 173
175 void MandolineUIServicesApp::Create(mojo::ApplicationConnection* connection, 174 void MandolineUIServicesApp::Create(mojo::Connection* connection,
176 mojo::InterfaceRequest<Gpu> request) { 175 mojo::InterfaceRequest<Gpu> request) {
177 DCHECK(gpu_state_); 176 DCHECK(gpu_state_);
178 new GpuImpl(std::move(request), gpu_state_); 177 new GpuImpl(std::move(request), gpu_state_);
179 } 178 }
180 179
181 void MandolineUIServicesApp::CreateWindowTreeHost( 180 void MandolineUIServicesApp::CreateWindowTreeHost(
182 mojo::InterfaceRequest<mojom::WindowTreeHost> host, 181 mojo::InterfaceRequest<mojom::WindowTreeHost> host,
183 mojom::WindowTreeClientPtr tree_client) { 182 mojom::WindowTreeClientPtr tree_client) {
184 DCHECK(connection_manager_); 183 DCHECK(connection_manager_);
185 184
186 // TODO(fsamuel): We need to make sure that only the window manager can create 185 // TODO(fsamuel): We need to make sure that only the window manager can create
187 // new roots. 186 // new roots.
188 ws::WindowTreeHostImpl* host_impl = new ws::WindowTreeHostImpl( 187 ws::WindowTreeHostImpl* host_impl = new ws::WindowTreeHostImpl(
189 connection_manager_.get(), shell_, gpu_state_, surfaces_state_); 188 connection_manager_.get(), shell_, gpu_state_, surfaces_state_);
190 189
191 // WindowTreeHostConnection manages its own lifetime. 190 // WindowTreeHostConnection manages its own lifetime.
192 host_impl->Init(new ws::WindowTreeHostConnectionImpl( 191 host_impl->Init(new ws::WindowTreeHostConnectionImpl(
193 std::move(host), make_scoped_ptr(host_impl), std::move(tree_client), 192 std::move(host), make_scoped_ptr(host_impl), std::move(tree_client),
194 connection_manager_.get())); 193 connection_manager_.get()));
195 } 194 }
196 195
197 } // namespace mus 196 } // namespace mus
OLDNEW
« no previous file with comments | « components/mus/mus_app.h ('k') | components/mus/public/cpp/tests/window_server_test_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698