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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 << devtools_service::kRemoteDebuggingPort << ": '" << port_str | 188 << devtools_service::kRemoteDebuggingPort << ": '" << port_str |
189 << "' is not a valid port number."; | 189 << "' is not a valid port number."; |
190 return; | 190 return; |
191 } | 191 } |
192 | 192 |
193 ServiceProviderPtr devtools_service_provider; | 193 ServiceProviderPtr devtools_service_provider; |
194 URLRequestPtr request(URLRequest::New()); | 194 URLRequestPtr request(URLRequest::New()); |
195 request->url = "mojo:devtools_service"; | 195 request->url = "mojo:devtools_service"; |
196 manager->ConnectToApplication( | 196 manager->ConnectToApplication( |
197 nullptr, request.Pass(), std::string(), GURL("mojo:shell"), | 197 nullptr, request.Pass(), std::string(), GURL("mojo:shell"), |
| 198 shell::ApplicationManager::kInvalidContentHandlerID, |
198 GetProxy(&devtools_service_provider), nullptr, | 199 GetProxy(&devtools_service_provider), nullptr, |
199 shell::GetPermissiveCapabilityFilter(), base::Closure()); | 200 shell::GetPermissiveCapabilityFilter(), base::Closure(), |
| 201 shell::EmptyConnectCallback()); |
200 | 202 |
201 devtools_service::DevToolsCoordinatorPtr devtools_coordinator; | 203 devtools_service::DevToolsCoordinatorPtr devtools_coordinator; |
202 devtools_service_provider->ConnectToService( | 204 devtools_service_provider->ConnectToService( |
203 devtools_service::DevToolsCoordinator::Name_, | 205 devtools_service::DevToolsCoordinator::Name_, |
204 GetProxy(&devtools_coordinator).PassMessagePipe()); | 206 GetProxy(&devtools_coordinator).PassMessagePipe()); |
205 devtools_coordinator->Initialize(static_cast<uint16_t>(port)); | 207 devtools_coordinator->Initialize(static_cast<uint16_t>(port)); |
206 } | 208 } |
207 | 209 |
208 class TracingServiceProvider : public ServiceProvider { | 210 class TracingServiceProvider : public ServiceProvider { |
209 public: | 211 public: |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 InitContentHandlers(&application_manager_, command_line); | 308 InitContentHandlers(&application_manager_, command_line); |
307 InitNativeOptions(&application_manager_, command_line); | 309 InitNativeOptions(&application_manager_, command_line); |
308 | 310 |
309 ServiceProviderPtr service_provider_ptr; | 311 ServiceProviderPtr service_provider_ptr; |
310 ServiceProviderPtr tracing_service_provider_ptr; | 312 ServiceProviderPtr tracing_service_provider_ptr; |
311 new TracingServiceProvider(GetProxy(&tracing_service_provider_ptr)); | 313 new TracingServiceProvider(GetProxy(&tracing_service_provider_ptr)); |
312 mojo::URLRequestPtr request(mojo::URLRequest::New()); | 314 mojo::URLRequestPtr request(mojo::URLRequest::New()); |
313 request->url = mojo::String::From("mojo:tracing"); | 315 request->url = mojo::String::From("mojo:tracing"); |
314 application_manager_.ConnectToApplication( | 316 application_manager_.ConnectToApplication( |
315 nullptr, request.Pass(), std::string(), GURL(), | 317 nullptr, request.Pass(), std::string(), GURL(), |
| 318 shell::ApplicationManager::kInvalidContentHandlerID, |
316 GetProxy(&service_provider_ptr), tracing_service_provider_ptr.Pass(), | 319 GetProxy(&service_provider_ptr), tracing_service_provider_ptr.Pass(), |
317 shell::GetPermissiveCapabilityFilter(), base::Closure()); | 320 shell::GetPermissiveCapabilityFilter(), base::Closure(), |
| 321 shell::EmptyConnectCallback()); |
318 | 322 |
319 // Record the shell startup metrics used for performance testing. | 323 // Record the shell startup metrics used for performance testing. |
320 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 324 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
321 tracing::kEnableStatsCollectionBindings)) { | 325 tracing::kEnableStatsCollectionBindings)) { |
322 tracing::StartupPerformanceDataCollectorPtr collector; | 326 tracing::StartupPerformanceDataCollectorPtr collector; |
323 service_provider_ptr->ConnectToService( | 327 service_provider_ptr->ConnectToService( |
324 tracing::StartupPerformanceDataCollector::Name_, | 328 tracing::StartupPerformanceDataCollector::Name_, |
325 GetProxy(&collector).PassMessagePipe()); | 329 GetProxy(&collector).PassMessagePipe()); |
326 #if defined(OS_MACOSX) || defined(OS_WIN) || defined(OS_LINUX) | 330 #if defined(OS_MACOSX) || defined(OS_WIN) || defined(OS_LINUX) |
327 // CurrentProcessInfo::CreationTime is only defined on some platforms. | 331 // CurrentProcessInfo::CreationTime is only defined on some platforms. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 | 376 |
373 void Context::Run(const GURL& url) { | 377 void Context::Run(const GURL& url) { |
374 DCHECK(app_complete_callback_.is_null()); | 378 DCHECK(app_complete_callback_.is_null()); |
375 ServiceProviderPtr services; | 379 ServiceProviderPtr services; |
376 ServiceProviderPtr exposed_services; | 380 ServiceProviderPtr exposed_services; |
377 | 381 |
378 app_urls_.insert(url); | 382 app_urls_.insert(url); |
379 mojo::URLRequestPtr request(mojo::URLRequest::New()); | 383 mojo::URLRequestPtr request(mojo::URLRequest::New()); |
380 request->url = mojo::String::From(url.spec()); | 384 request->url = mojo::String::From(url.spec()); |
381 application_manager_.ConnectToApplication( | 385 application_manager_.ConnectToApplication( |
382 nullptr, request.Pass(), std::string(), GURL(), GetProxy(&services), | 386 nullptr, request.Pass(), std::string(), GURL(), |
| 387 shell::ApplicationManager::kInvalidContentHandlerID, GetProxy(&services), |
383 exposed_services.Pass(), shell::GetPermissiveCapabilityFilter(), | 388 exposed_services.Pass(), shell::GetPermissiveCapabilityFilter(), |
384 base::Bind(&Context::OnApplicationEnd, base::Unretained(this), url)); | 389 base::Bind(&Context::OnApplicationEnd, base::Unretained(this), url), |
| 390 shell::EmptyConnectCallback()); |
385 } | 391 } |
386 | 392 |
387 void Context::RunCommandLineApplication(const base::Closure& callback) { | 393 void Context::RunCommandLineApplication(const base::Closure& callback) { |
388 DCHECK(app_urls_.empty()); | 394 DCHECK(app_urls_.empty()); |
389 DCHECK(app_complete_callback_.is_null()); | 395 DCHECK(app_complete_callback_.is_null()); |
390 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 396 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
391 base::CommandLine::StringVector args = command_line->GetArgs(); | 397 base::CommandLine::StringVector args = command_line->GetArgs(); |
392 for (size_t i = 0; i < args.size(); ++i) { | 398 for (size_t i = 0; i < args.size(); ++i) { |
393 GURL possible_app(args[i]); | 399 GURL possible_app(args[i]); |
394 if (possible_app.SchemeIs("mojo")) { | 400 if (possible_app.SchemeIs("mojo")) { |
(...skipping 14 matching lines...) Expand all Loading... |
409 base::MessageLoop::current()->Quit(); | 415 base::MessageLoop::current()->Quit(); |
410 } else { | 416 } else { |
411 app_complete_callback_.Run(); | 417 app_complete_callback_.Run(); |
412 } | 418 } |
413 } | 419 } |
414 } | 420 } |
415 } | 421 } |
416 | 422 |
417 } // namespace runner | 423 } // namespace runner |
418 } // namespace mojo | 424 } // namespace mojo |
OLD | NEW |