| 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 "shell/context.h" | 5 #include "shell/context.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/base_switches.h" | 9 #include "base/base_switches.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #include "mojo/edk/embedder/simple_platform_support.h" | 25 #include "mojo/edk/embedder/simple_platform_support.h" |
| 26 #include "mojo/public/cpp/application/application_connection.h" | 26 #include "mojo/public/cpp/application/application_connection.h" |
| 27 #include "mojo/public/cpp/application/application_delegate.h" | 27 #include "mojo/public/cpp/application/application_delegate.h" |
| 28 #include "mojo/public/cpp/application/application_impl.h" | 28 #include "mojo/public/cpp/application/application_impl.h" |
| 29 #include "services/tracing/tracing.mojom.h" | 29 #include "services/tracing/tracing.mojom.h" |
| 30 #include "shell/application_manager/application_loader.h" | 30 #include "shell/application_manager/application_loader.h" |
| 31 #include "shell/application_manager/application_manager.h" | 31 #include "shell/application_manager/application_manager.h" |
| 32 #include "shell/command_line_util.h" | 32 #include "shell/command_line_util.h" |
| 33 #include "shell/external_application_listener.h" | 33 #include "shell/external_application_listener.h" |
| 34 #include "shell/filename_util.h" | 34 #include "shell/filename_util.h" |
| 35 #include "shell/in_process_dynamic_service_runner.h" | 35 #include "shell/in_process_native_runner.h" |
| 36 #include "shell/out_of_process_dynamic_service_runner.h" | 36 #include "shell/out_of_process_native_runner.h" |
| 37 #include "shell/switches.h" | 37 #include "shell/switches.h" |
| 38 #include "url/gurl.h" | 38 #include "url/gurl.h" |
| 39 | 39 |
| 40 namespace mojo { | 40 namespace mojo { |
| 41 namespace shell { | 41 namespace shell { |
| 42 namespace { | 42 namespace { |
| 43 | 43 |
| 44 // Used to ensure we only init once. | 44 // Used to ensure we only init once. |
| 45 class Setup { | 45 class Setup { |
| 46 public: | 46 public: |
| 47 Setup() { | 47 Setup() { |
| 48 embedder::Init(scoped_ptr<mojo::embedder::PlatformSupport>( | 48 embedder::Init(make_scoped_ptr(new embedder::SimplePlatformSupport())); |
| 49 new mojo::embedder::SimplePlatformSupport())); | |
| 50 } | 49 } |
| 51 | 50 |
| 52 ~Setup() {} | 51 ~Setup() {} |
| 53 | 52 |
| 54 private: | 53 private: |
| 55 DISALLOW_COPY_AND_ASSIGN(Setup); | 54 DISALLOW_COPY_AND_ASSIGN(Setup); |
| 56 }; | 55 }; |
| 57 | 56 |
| 58 bool ConfigureURLMappings(const base::CommandLine& command_line, | 57 bool ConfigureURLMappings(const base::CommandLine& command_line, |
| 59 Context* context) { | 58 Context* context) { |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 manager->SetNativeOptionsForURL(options, gurl); | 172 manager->SetNativeOptionsForURL(options, gurl); |
| 174 } | 173 } |
| 175 } | 174 } |
| 176 | 175 |
| 177 class TracingServiceProvider : public ServiceProvider { | 176 class TracingServiceProvider : public ServiceProvider { |
| 178 public: | 177 public: |
| 179 explicit TracingServiceProvider(InterfaceRequest<ServiceProvider> request) | 178 explicit TracingServiceProvider(InterfaceRequest<ServiceProvider> request) |
| 180 : binding_(this, request.Pass()) {} | 179 : binding_(this, request.Pass()) {} |
| 181 ~TracingServiceProvider() override {} | 180 ~TracingServiceProvider() override {} |
| 182 | 181 |
| 183 void ConnectToService(const mojo::String& service_name, | 182 void ConnectToService(const String& service_name, |
| 184 ScopedMessagePipeHandle client_handle) override { | 183 ScopedMessagePipeHandle client_handle) override { |
| 185 if (service_name == tracing::TraceController::Name_) { | 184 if (service_name == tracing::TraceController::Name_) { |
| 186 new TraceControllerImpl( | 185 new TraceControllerImpl( |
| 187 MakeRequest<tracing::TraceController>(client_handle.Pass())); | 186 MakeRequest<tracing::TraceController>(client_handle.Pass())); |
| 188 } | 187 } |
| 189 } | 188 } |
| 190 | 189 |
| 191 private: | 190 private: |
| 192 StrongBinding<ServiceProvider> binding_; | 191 StrongBinding<ServiceProvider> binding_; |
| 193 | 192 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 socket_path = ExternalApplicationListener::ConstructDefaultSocketPath(); | 269 socket_path = ExternalApplicationListener::ConstructDefaultSocketPath(); |
| 271 | 270 |
| 272 listener_->ListenInBackground( | 271 listener_->ListenInBackground( |
| 273 socket_path, | 272 socket_path, |
| 274 base::Bind(&ApplicationManager::RegisterExternalApplication, | 273 base::Bind(&ApplicationManager::RegisterExternalApplication, |
| 275 base::Unretained(&application_manager_))); | 274 base::Unretained(&application_manager_))); |
| 276 } | 275 } |
| 277 | 276 |
| 278 scoped_ptr<NativeRunnerFactory> runner_factory; | 277 scoped_ptr<NativeRunnerFactory> runner_factory; |
| 279 if (command_line.HasSwitch(switches::kEnableMultiprocess)) | 278 if (command_line.HasSwitch(switches::kEnableMultiprocess)) |
| 280 runner_factory.reset(new OutOfProcessDynamicServiceRunnerFactory(this)); | 279 runner_factory.reset(new OutOfProcessNativeRunnerFactory(this)); |
| 281 else | 280 else |
| 282 runner_factory.reset(new InProcessDynamicServiceRunnerFactory(this)); | 281 runner_factory.reset(new InProcessNativeRunnerFactory(this)); |
| 283 application_manager_.set_blocking_pool(task_runners_->blocking_pool()); | 282 application_manager_.set_blocking_pool(task_runners_->blocking_pool()); |
| 284 application_manager_.set_native_runner_factory(runner_factory.Pass()); | 283 application_manager_.set_native_runner_factory(runner_factory.Pass()); |
| 285 application_manager_.set_disable_cache( | 284 application_manager_.set_disable_cache( |
| 286 base::CommandLine::ForCurrentProcess()->HasSwitch( | 285 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 287 switches::kDisableCache)); | 286 switches::kDisableCache)); |
| 288 | 287 |
| 289 InitContentHandlers(&application_manager_, command_line); | 288 InitContentHandlers(&application_manager_, command_line); |
| 290 InitNativeOptions(&application_manager_, command_line); | 289 InitNativeOptions(&application_manager_, command_line); |
| 291 | 290 |
| 292 ServiceProviderPtr tracing_service_provider_ptr; | 291 ServiceProviderPtr tracing_service_provider_ptr; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 ScopedMessagePipeHandle Context::ConnectToServiceByName( | 345 ScopedMessagePipeHandle Context::ConnectToServiceByName( |
| 347 const GURL& application_url, | 346 const GURL& application_url, |
| 348 const std::string& service_name) { | 347 const std::string& service_name) { |
| 349 app_urls_.insert(application_url); | 348 app_urls_.insert(application_url); |
| 350 return application_manager_.ConnectToServiceByName(application_url, | 349 return application_manager_.ConnectToServiceByName(application_url, |
| 351 service_name).Pass(); | 350 service_name).Pass(); |
| 352 } | 351 } |
| 353 | 352 |
| 354 } // namespace shell | 353 } // namespace shell |
| 355 } // namespace mojo | 354 } // namespace mojo |
| OLD | NEW |