| 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/runner/context.h" | 5 #include "mojo/runner/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 19 matching lines...) Expand all Loading... |
| 30 #include "mojo/edk/embedder/embedder.h" | 30 #include "mojo/edk/embedder/embedder.h" |
| 31 #include "mojo/edk/embedder/simple_platform_support.h" | 31 #include "mojo/edk/embedder/simple_platform_support.h" |
| 32 #include "mojo/runner/about_fetcher.h" | 32 #include "mojo/runner/about_fetcher.h" |
| 33 #include "mojo/runner/in_process_native_runner.h" | 33 #include "mojo/runner/in_process_native_runner.h" |
| 34 #include "mojo/runner/out_of_process_native_runner.h" | 34 #include "mojo/runner/out_of_process_native_runner.h" |
| 35 #include "mojo/runner/switches.h" | 35 #include "mojo/runner/switches.h" |
| 36 #include "mojo/services/tracing/public/cpp/switches.h" | 36 #include "mojo/services/tracing/public/cpp/switches.h" |
| 37 #include "mojo/services/tracing/public/interfaces/tracing.mojom.h" | 37 #include "mojo/services/tracing/public/interfaces/tracing.mojom.h" |
| 38 #include "mojo/shell/application_loader.h" | 38 #include "mojo/shell/application_loader.h" |
| 39 #include "mojo/shell/application_manager.h" | 39 #include "mojo/shell/application_manager.h" |
| 40 #include "mojo/shell/connect_to_application_params.h" |
| 40 #include "mojo/shell/switches.h" | 41 #include "mojo/shell/switches.h" |
| 41 #include "mojo/util/filename_util.h" | 42 #include "mojo/util/filename_util.h" |
| 42 #include "url/gurl.h" | 43 #include "url/gurl.h" |
| 43 | 44 |
| 44 namespace mojo { | 45 namespace mojo { |
| 45 namespace runner { | 46 namespace runner { |
| 46 namespace { | 47 namespace { |
| 47 | 48 |
| 48 // Used to ensure we only init once. | 49 // Used to ensure we only init once. |
| 49 class Setup { | 50 class Setup { |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 command_line.GetSwitchValueASCII(devtools_service::kRemoteDebuggingPort); | 185 command_line.GetSwitchValueASCII(devtools_service::kRemoteDebuggingPort); |
| 185 unsigned port; | 186 unsigned port; |
| 186 if (!base::StringToUint(port_str, &port) || port > 65535) { | 187 if (!base::StringToUint(port_str, &port) || port > 65535) { |
| 187 LOG(ERROR) << "Invalid value for switch " | 188 LOG(ERROR) << "Invalid value for switch " |
| 188 << devtools_service::kRemoteDebuggingPort << ": '" << port_str | 189 << devtools_service::kRemoteDebuggingPort << ": '" << port_str |
| 189 << "' is not a valid port number."; | 190 << "' is not a valid port number."; |
| 190 return; | 191 return; |
| 191 } | 192 } |
| 192 | 193 |
| 193 ServiceProviderPtr devtools_service_provider; | 194 ServiceProviderPtr devtools_service_provider; |
| 194 URLRequestPtr request(URLRequest::New()); | 195 scoped_ptr<shell::ConnectToApplicationParams> params( |
| 195 request->url = "mojo:devtools_service"; | 196 new shell::ConnectToApplicationParams); |
| 196 manager->ConnectToApplication(nullptr, request.Pass(), std::string(), | 197 params->set_originator_identity(shell::Identity(GURL("mojo:shell"))); |
| 197 GURL("mojo:shell"), | 198 params->set_originator_filter(shell::GetPermissiveCapabilityFilter()); |
| 198 GetProxy(&devtools_service_provider), nullptr, | 199 params->SetURLInfo(GURL("mojo:devtools_service")); |
| 199 shell::GetPermissiveCapabilityFilter(), | 200 params->set_services(GetProxy(&devtools_service_provider)); |
| 200 base::Closure(), shell::EmptyConnectCallback()); | 201 params->set_filter(shell::GetPermissiveCapabilityFilter()); |
| 202 manager->ConnectToApplication(params.Pass()); |
| 201 | 203 |
| 202 devtools_service::DevToolsCoordinatorPtr devtools_coordinator; | 204 devtools_service::DevToolsCoordinatorPtr devtools_coordinator; |
| 203 devtools_service_provider->ConnectToService( | 205 devtools_service_provider->ConnectToService( |
| 204 devtools_service::DevToolsCoordinator::Name_, | 206 devtools_service::DevToolsCoordinator::Name_, |
| 205 GetProxy(&devtools_coordinator).PassMessagePipe()); | 207 GetProxy(&devtools_coordinator).PassMessagePipe()); |
| 206 devtools_coordinator->Initialize(static_cast<uint16_t>(port)); | 208 devtools_coordinator->Initialize(static_cast<uint16_t>(port)); |
| 207 } | 209 } |
| 208 | 210 |
| 209 class TracingServiceProvider : public ServiceProvider { | 211 class TracingServiceProvider : public ServiceProvider { |
| 210 public: | 212 public: |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 base::MessageLoop::current()->Quit(); | 414 base::MessageLoop::current()->Quit(); |
| 413 } else { | 415 } else { |
| 414 app_complete_callback_.Run(); | 416 app_complete_callback_.Run(); |
| 415 } | 417 } |
| 416 } | 418 } |
| 417 } | 419 } |
| 418 } | 420 } |
| 419 | 421 |
| 420 } // namespace runner | 422 } // namespace runner |
| 421 } // namespace mojo | 423 } // namespace mojo |
| OLD | NEW |