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

Side by Side Diff: content/browser/mojo/mojo_shell_context.cc

Issue 1764253002: Rename shell.mojom to connector.mojom, ApplicationManager to Shell (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@32exe
Patch Set: . Created 4 years, 9 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 | « content/browser/mojo/mojo_shell_context.h ('k') | content/renderer/render_frame_impl.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 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 #include "content/browser/mojo/mojo_shell_context.h" 5 #include "content/browser/mojo/mojo_shell_context.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 12 matching lines...) Expand all
23 #include "content/public/browser/utility_process_host_client.h" 23 #include "content/public/browser/utility_process_host_client.h"
24 #include "content/public/common/content_client.h" 24 #include "content/public/common/content_client.h"
25 #include "content/public/common/service_registry.h" 25 #include "content/public/common/service_registry.h"
26 #include "mojo/public/cpp/bindings/interface_request.h" 26 #include "mojo/public/cpp/bindings/interface_request.h"
27 #include "mojo/public/cpp/bindings/string.h" 27 #include "mojo/public/cpp/bindings/string.h"
28 #include "mojo/shell/connect_params.h" 28 #include "mojo/shell/connect_params.h"
29 #include "mojo/shell/identity.h" 29 #include "mojo/shell/identity.h"
30 #include "mojo/shell/loader.h" 30 #include "mojo/shell/loader.h"
31 #include "mojo/shell/native_runner.h" 31 #include "mojo/shell/native_runner.h"
32 #include "mojo/shell/public/cpp/shell_client.h" 32 #include "mojo/shell/public/cpp/shell_client.h"
33 #include "mojo/shell/public/interfaces/shell.mojom.h" 33 #include "mojo/shell/public/interfaces/connector.mojom.h"
34 #include "mojo/shell/runner/host/in_process_native_runner.h" 34 #include "mojo/shell/runner/host/in_process_native_runner.h"
35 35
36 namespace content { 36 namespace content {
37 37
38 namespace { 38 namespace {
39 39
40 const char kBrowserAppName[] = "exe:chrome"; 40 const char kBrowserAppName[] = "exe:chrome";
41 41
42 // An extra set of apps to register on initialization, if set by a test. 42 // An extra set of apps to register on initialization, if set by a test.
43 const MojoShellContext::StaticApplicationMap* g_applications_for_test; 43 const MojoShellContext::StaticApplicationMap* g_applications_for_test;
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 } 198 }
199 199
200 MojoShellContext::MojoShellContext() { 200 MojoShellContext::MojoShellContext() {
201 proxy_.Get().reset(new Proxy(this)); 201 proxy_.Get().reset(new Proxy(this));
202 202
203 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner = 203 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner =
204 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE); 204 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE);
205 scoped_ptr<mojo::shell::NativeRunnerFactory> native_runner_factory( 205 scoped_ptr<mojo::shell::NativeRunnerFactory> native_runner_factory(
206 new mojo::shell::InProcessNativeRunnerFactory( 206 new mojo::shell::InProcessNativeRunnerFactory(
207 BrowserThread::GetBlockingPool())); 207 BrowserThread::GetBlockingPool()));
208 application_manager_.reset(new mojo::shell::ApplicationManager( 208 shell_.reset(new mojo::shell::Shell(std::move(native_runner_factory),
209 std::move(native_runner_factory), file_task_runner.get(), nullptr)); 209 file_task_runner.get(), nullptr));
210 210
211 application_manager_->set_default_loader( 211 shell_->set_default_loader(
212 scoped_ptr<mojo::shell::Loader>(new DefaultLoader)); 212 scoped_ptr<mojo::shell::Loader>(new DefaultLoader));
213 213
214 StaticApplicationMap apps; 214 StaticApplicationMap apps;
215 GetContentClient()->browser()->RegisterInProcessMojoApplications(&apps); 215 GetContentClient()->browser()->RegisterInProcessMojoApplications(&apps);
216 if (g_applications_for_test) { 216 if (g_applications_for_test) {
217 // Add testing apps to the map, potentially overwriting whatever the 217 // Add testing apps to the map, potentially overwriting whatever the
218 // browser client registered. 218 // browser client registered.
219 for (const auto& entry : *g_applications_for_test) 219 for (const auto& entry : *g_applications_for_test)
220 apps[entry.first] = entry.second; 220 apps[entry.first] = entry.second;
221 } 221 }
222 for (const auto& entry : apps) { 222 for (const auto& entry : apps) {
223 application_manager_->SetLoaderForName( 223 shell_->SetLoaderForName(
224 make_scoped_ptr(new StaticLoader(entry.second)), entry.first); 224 make_scoped_ptr(new StaticLoader(entry.second)), entry.first);
225 } 225 }
226 226
227 ContentBrowserClient::OutOfProcessMojoApplicationMap sandboxed_apps; 227 ContentBrowserClient::OutOfProcessMojoApplicationMap sandboxed_apps;
228 GetContentClient() 228 GetContentClient()
229 ->browser() 229 ->browser()
230 ->RegisterOutOfProcessMojoApplications(&sandboxed_apps); 230 ->RegisterOutOfProcessMojoApplications(&sandboxed_apps);
231 for (const auto& app : sandboxed_apps) { 231 for (const auto& app : sandboxed_apps) {
232 application_manager_->SetLoaderForName( 232 shell_->SetLoaderForName(
233 make_scoped_ptr( 233 make_scoped_ptr(
234 new UtilityProcessLoader(app.second, true /* use_sandbox */)), 234 new UtilityProcessLoader(app.second, true /* use_sandbox */)),
235 app.first); 235 app.first);
236 } 236 }
237 237
238 ContentBrowserClient::OutOfProcessMojoApplicationMap unsandboxed_apps; 238 ContentBrowserClient::OutOfProcessMojoApplicationMap unsandboxed_apps;
239 GetContentClient() 239 GetContentClient()
240 ->browser() 240 ->browser()
241 ->RegisterUnsandboxedOutOfProcessMojoApplications(&unsandboxed_apps); 241 ->RegisterUnsandboxedOutOfProcessMojoApplications(&unsandboxed_apps);
242 for (const auto& app : unsandboxed_apps) { 242 for (const auto& app : unsandboxed_apps) {
243 application_manager_->SetLoaderForName( 243 shell_->SetLoaderForName(
244 make_scoped_ptr( 244 make_scoped_ptr(
245 new UtilityProcessLoader(app.second, false /* use_sandbox */)), 245 new UtilityProcessLoader(app.second, false /* use_sandbox */)),
246 app.first); 246 app.first);
247 } 247 }
248 248
249 #if (ENABLE_MOJO_MEDIA_IN_GPU_PROCESS) 249 #if (ENABLE_MOJO_MEDIA_IN_GPU_PROCESS)
250 application_manager_->SetLoaderForName(make_scoped_ptr(new GpuProcessLoader), 250 shell_->SetLoaderForName(make_scoped_ptr(new GpuProcessLoader), "mojo:media");
251 "mojo:media");
252 #endif 251 #endif
253 252
254 base::Callback<scoped_ptr<mojo::ShellClient>()> profile_callback = 253 base::Callback<scoped_ptr<mojo::ShellClient>()> profile_callback =
255 base::Bind(&profile::CreateProfileApp); 254 base::Bind(&profile::CreateProfileApp);
256 application_manager_->SetLoaderForName( 255 shell_->SetLoaderForName(
257 make_scoped_ptr(new StaticLoader(profile_callback)), "mojo:profile"); 256 make_scoped_ptr(new StaticLoader(profile_callback)), "mojo:profile");
258 257
259 if (!IsRunningInMojoShell()) { 258 if (!IsRunningInMojoShell()) {
260 MojoShellConnectionImpl::Create( 259 MojoShellConnectionImpl::Create(
261 application_manager_->InitInstanceForEmbedder(kBrowserAppName)); 260 shell_->InitInstanceForEmbedder(kBrowserAppName));
262 } 261 }
263 } 262 }
264 263
265 MojoShellContext::~MojoShellContext() { 264 MojoShellContext::~MojoShellContext() {
266 if (!IsRunningInMojoShell()) 265 if (!IsRunningInMojoShell())
267 MojoShellConnectionImpl::Destroy(); 266 MojoShellConnectionImpl::Destroy();
268 } 267 }
269 268
270 // static 269 // static
271 void MojoShellContext::ConnectToApplication( 270 void MojoShellContext::ConnectToApplication(
(...skipping 19 matching lines...) Expand all
291 // manager doesn't understand. 290 // manager doesn't understand.
292 mojo::shell::Identity source_id( 291 mojo::shell::Identity source_id(
293 requestor_name, std::string(), mojo::shell::mojom::Connector::kUserRoot); 292 requestor_name, std::string(), mojo::shell::mojom::Connector::kUserRoot);
294 source_id.set_filter(mojo::shell::GetPermissiveCapabilityFilter()); 293 source_id.set_filter(mojo::shell::GetPermissiveCapabilityFilter());
295 params->set_source(source_id); 294 params->set_source(source_id);
296 params->set_target(mojo::shell::Identity( 295 params->set_target(mojo::shell::Identity(
297 name, std::string(), mojo::shell::mojom::Connector::kUserRoot)); 296 name, std::string(), mojo::shell::mojom::Connector::kUserRoot));
298 params->set_remote_interfaces(std::move(request)); 297 params->set_remote_interfaces(std::move(request));
299 params->set_local_interfaces(std::move(exposed_services)); 298 params->set_local_interfaces(std::move(exposed_services));
300 params->set_connect_callback(callback); 299 params->set_connect_callback(callback);
301 application_manager_->Connect(std::move(params)); 300 shell_->Connect(std::move(params));
302 } 301 }
303 302
304 } // namespace content 303 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/mojo/mojo_shell_context.h ('k') | content/renderer/render_frame_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698