| 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/common/tracing_impl.h" | 25 #include "mojo/common/tracing_impl.h" |
| 26 #include "mojo/edk/embedder/embedder.h" | 26 #include "mojo/edk/embedder/embedder.h" |
| 27 #include "mojo/edk/embedder/simple_platform_support.h" | 27 #include "mojo/edk/embedder/simple_platform_support.h" |
| 28 #include "mojo/public/cpp/application/application_connection.h" | 28 #include "mojo/public/cpp/application/application_connection.h" |
| 29 #include "mojo/public/cpp/application/application_delegate.h" | 29 #include "mojo/public/cpp/application/application_delegate.h" |
| 30 #include "mojo/public/cpp/application/application_impl.h" | 30 #include "mojo/public/cpp/application/application_impl.h" |
| 31 #include "mojo/public/cpp/bindings/strong_binding.h" | 31 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 32 #include "mojo/services/tracing/public/interfaces/tracing.mojom.h" | 32 #include "mojo/services/tracing/public/interfaces/tracing.mojom.h" |
| 33 #include "shell/application_manager/application_loader.h" | 33 #include "shell/application_manager/application_loader.h" |
| 34 #include "shell/application_manager/application_manager.h" | 34 #include "shell/application_manager/application_manager.h" |
| 35 #include "shell/application_manager/native_application_options.h" |
| 35 #include "shell/background_application_loader.h" | 36 #include "shell/background_application_loader.h" |
| 36 #include "shell/command_line_util.h" | 37 #include "shell/command_line_util.h" |
| 37 #include "shell/filename_util.h" | 38 #include "shell/filename_util.h" |
| 38 #include "shell/in_process_native_runner.h" | 39 #include "shell/in_process_native_runner.h" |
| 39 #include "shell/out_of_process_native_runner.h" | 40 #include "shell/out_of_process_native_runner.h" |
| 40 #include "shell/switches.h" | 41 #include "shell/switches.h" |
| 41 #include "shell/tracer.h" | 42 #include "shell/tracer.h" |
| 42 #include "url/gurl.h" | 43 #include "url/gurl.h" |
| 43 | 44 |
| 44 #if !defined(OS_MACOSX) | 45 #if !defined(OS_MACOSX) |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 manager->RegisterContentHandler(parts[i], url); | 173 manager->RegisterContentHandler(parts[i], url); |
| 173 } | 174 } |
| 174 } | 175 } |
| 175 | 176 |
| 176 void InitNativeOptions(ApplicationManager* manager, | 177 void InitNativeOptions(ApplicationManager* manager, |
| 177 const base::CommandLine& command_line) { | 178 const base::CommandLine& command_line) { |
| 178 std::vector<std::string> force_in_process_url_list; | 179 std::vector<std::string> force_in_process_url_list; |
| 179 base::SplitString(command_line.GetSwitchValueASCII(switches::kForceInProcess), | 180 base::SplitString(command_line.GetSwitchValueASCII(switches::kForceInProcess), |
| 180 ',', &force_in_process_url_list); | 181 ',', &force_in_process_url_list); |
| 181 for (const auto& force_in_process_url : force_in_process_url_list) { | 182 for (const auto& force_in_process_url : force_in_process_url_list) { |
| 182 GURL gurl(force_in_process_url); | 183 GURL url(force_in_process_url); |
| 183 if (!gurl.is_valid()) { | 184 if (!url.is_valid()) { |
| 184 LOG(ERROR) << "Invalid value for switch " << switches::kForceInProcess | 185 LOG(ERROR) << "Invalid value for switch " << switches::kForceInProcess |
| 185 << ": '" << force_in_process_url << "'is not a valid URL."; | 186 << ": '" << force_in_process_url << "'is not a valid URL."; |
| 186 return; | 187 return; |
| 187 } | 188 } |
| 188 | 189 |
| 189 NativeRunnerFactory::Options options; | 190 manager->GetNativeApplicationOptionsForURL(url)->force_in_process = true; |
| 190 options.force_in_process = true; | |
| 191 manager->SetNativeOptionsForURL(options, gurl); | |
| 192 } | 191 } |
| 192 |
| 193 // TODO(vtl): This is a total hack. We should have a systematic way of |
| 194 // configuring options for native apps. |
| 195 manager->GetNativeApplicationOptionsForURL(GURL("mojo:native_support")) |
| 196 ->allow_new_privs = true; |
| 193 } | 197 } |
| 194 | 198 |
| 195 class TracingServiceProvider : public ServiceProvider { | 199 class TracingServiceProvider : public ServiceProvider { |
| 196 public: | 200 public: |
| 197 TracingServiceProvider(Tracer* tracer, | 201 TracingServiceProvider(Tracer* tracer, |
| 198 mojo::InterfaceRequest<ServiceProvider> request) | 202 mojo::InterfaceRequest<ServiceProvider> request) |
| 199 : tracer_(tracer), binding_(this, request.Pass()) {} | 203 : tracer_(tracer), binding_(this, request.Pass()) {} |
| 200 ~TracingServiceProvider() override {} | 204 ~TracingServiceProvider() override {} |
| 201 | 205 |
| 202 void ConnectToService(const mojo::String& service_name, | 206 void ConnectToService(const mojo::String& service_name, |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 app_urls_.erase(url); | 388 app_urls_.erase(url); |
| 385 if (app_urls_.empty() && base::MessageLoop::current()->is_running()) { | 389 if (app_urls_.empty() && base::MessageLoop::current()->is_running()) { |
| 386 DCHECK_EQ(base::MessageLoop::current()->task_runner(), | 390 DCHECK_EQ(base::MessageLoop::current()->task_runner(), |
| 387 task_runners_->shell_runner()); | 391 task_runners_->shell_runner()); |
| 388 base::MessageLoop::current()->Quit(); | 392 base::MessageLoop::current()->Quit(); |
| 389 } | 393 } |
| 390 } | 394 } |
| 391 } | 395 } |
| 392 | 396 |
| 393 } // namespace shell | 397 } // namespace shell |
| OLD | NEW |