| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "mojo/shell/context.h" | 5 #include "mojo/shell/context.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 #include "mojo/shell/in_process_dynamic_service_runner.h" | 29 #include "mojo/shell/in_process_dynamic_service_runner.h" |
| 30 #include "mojo/shell/out_of_process_dynamic_service_runner.h" | 30 #include "mojo/shell/out_of_process_dynamic_service_runner.h" |
| 31 #include "mojo/shell/switches.h" | 31 #include "mojo/shell/switches.h" |
| 32 #include "mojo/shell/ui_application_loader_android.h" | 32 #include "mojo/shell/ui_application_loader_android.h" |
| 33 #include "mojo/spy/spy.h" | 33 #include "mojo/spy/spy.h" |
| 34 #include "services/tracing/tracing.mojom.h" | 34 #include "services/tracing/tracing.mojom.h" |
| 35 #include "url/gurl.h" | 35 #include "url/gurl.h" |
| 36 | 36 |
| 37 #if defined(OS_ANDROID) | 37 #if defined(OS_ANDROID) |
| 38 #include "mojo/shell/android/android_handler_loader.h" | 38 #include "mojo/shell/android/android_handler_loader.h" |
| 39 #include "mojo/shell/network_application_loader.h" | |
| 40 #include "services/gles2/gpu_impl.h" | 39 #include "services/gles2/gpu_impl.h" |
| 41 #include "services/native_viewport/native_viewport_impl.h" | 40 #include "services/native_viewport/native_viewport_impl.h" |
| 42 #endif // defined(OS_ANDROID) | 41 #endif // defined(OS_ANDROID) |
| 43 | 42 |
| 44 namespace mojo { | 43 namespace mojo { |
| 45 namespace shell { | 44 namespace shell { |
| 46 namespace { | 45 namespace { |
| 47 | 46 |
| 48 // These mojo: URLs are loaded directly from the local filesystem. They | 47 // These mojo: URLs are loaded directly from the local filesystem. They |
| 49 // correspond to shared libraries bundled alongside the mojo_shell. | 48 // correspond to shared libraries bundled alongside the mojo_shell. |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 if (command_line->HasSwitch(switches::kSpy)) { | 245 if (command_line->HasSwitch(switches::kSpy)) { |
| 247 spy_.reset( | 246 spy_.reset( |
| 248 new mojo::Spy(&application_manager_, | 247 new mojo::Spy(&application_manager_, |
| 249 command_line->GetSwitchValueASCII(switches::kSpy))); | 248 command_line->GetSwitchValueASCII(switches::kSpy))); |
| 250 // TODO(cpu): the spy can snoop, but can't tell anybody until | 249 // TODO(cpu): the spy can snoop, but can't tell anybody until |
| 251 // the Spy::WebSocketDelegate is implemented. In the original repo this | 250 // the Spy::WebSocketDelegate is implemented. In the original repo this |
| 252 // was implemented by src\mojo\spy\websocket_server.h and .cc. | 251 // was implemented by src\mojo\spy\websocket_server.h and .cc. |
| 253 } | 252 } |
| 254 | 253 |
| 255 #if defined(OS_ANDROID) | 254 #if defined(OS_ANDROID) |
| 256 // On android, the network service is bundled with the shell because the | |
| 257 // network stack depends on the android runtime. | |
| 258 { | 255 { |
| 259 scoped_ptr<BackgroundShellApplicationLoader> loader( | 256 // Android handler is bundled with the Mojo shell, because it uses the |
| 260 new BackgroundShellApplicationLoader( | 257 // MojoShell application as the JNI bridge to bootstrap execution of other |
| 261 scoped_ptr<ApplicationLoader>(new NetworkApplicationLoader()), | 258 // Android Mojo apps that need JNI. |
| 262 "network_service", | |
| 263 base::MessageLoop::TYPE_IO)); | |
| 264 application_manager_.SetLoaderForURL(loader.Pass(), | |
| 265 GURL("mojo:network_service")); | |
| 266 } | |
| 267 { | |
| 268 scoped_ptr<BackgroundShellApplicationLoader> loader( | 259 scoped_ptr<BackgroundShellApplicationLoader> loader( |
| 269 new BackgroundShellApplicationLoader( | 260 new BackgroundShellApplicationLoader( |
| 270 scoped_ptr<ApplicationLoader>(new AndroidHandlerLoader()), | 261 scoped_ptr<ApplicationLoader>(new AndroidHandlerLoader()), |
| 271 "android_handler", base::MessageLoop::TYPE_DEFAULT)); | 262 "android_handler", base::MessageLoop::TYPE_DEFAULT)); |
| 272 application_manager_.SetLoaderForURL(loader.Pass(), | 263 application_manager_.SetLoaderForURL(loader.Pass(), |
| 273 GURL("mojo:android_handler")); | 264 GURL("mojo:android_handler")); |
| 274 } | 265 } |
| 275 #endif | 266 #endif |
| 276 | 267 |
| 277 tracing::TraceDataCollectorPtr trace_data_collector_ptr; | 268 tracing::TraceDataCollectorPtr trace_data_collector_ptr; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 ScopedMessagePipeHandle Context::ConnectToServiceByName( | 300 ScopedMessagePipeHandle Context::ConnectToServiceByName( |
| 310 const GURL& application_url, | 301 const GURL& application_url, |
| 311 const std::string& service_name) { | 302 const std::string& service_name) { |
| 312 app_urls_.insert(application_url); | 303 app_urls_.insert(application_url); |
| 313 return application_manager_.ConnectToServiceByName( | 304 return application_manager_.ConnectToServiceByName( |
| 314 application_url, service_name).Pass(); | 305 application_url, service_name).Pass(); |
| 315 } | 306 } |
| 316 | 307 |
| 317 } // namespace shell | 308 } // namespace shell |
| 318 } // namespace mojo | 309 } // namespace mojo |
| OLD | NEW |