| 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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 | 308 |
| 309 InitContentHandlers(&application_manager_, command_line); | 309 InitContentHandlers(&application_manager_, command_line); |
| 310 InitNativeOptions(&application_manager_, command_line); | 310 InitNativeOptions(&application_manager_, command_line); |
| 311 | 311 |
| 312 ServiceProviderPtr service_provider_ptr; | 312 ServiceProviderPtr service_provider_ptr; |
| 313 ServiceProviderPtr tracing_service_provider_ptr; | 313 ServiceProviderPtr tracing_service_provider_ptr; |
| 314 new TracingServiceProvider(GetProxy(&tracing_service_provider_ptr)); | 314 new TracingServiceProvider(GetProxy(&tracing_service_provider_ptr)); |
| 315 mojo::URLRequestPtr request(mojo::URLRequest::New()); | 315 mojo::URLRequestPtr request(mojo::URLRequest::New()); |
| 316 request->url = mojo::String::From("mojo:tracing"); | 316 request->url = mojo::String::From("mojo:tracing"); |
| 317 application_manager_.ConnectToApplication( | 317 application_manager_.ConnectToApplication( |
| 318 nullptr, request.Pass(), std::string(), GURL(), | 318 nullptr, request.Pass(), std::string(), GetProxy(&service_provider_ptr), |
| 319 GetProxy(&service_provider_ptr), tracing_service_provider_ptr.Pass(), | 319 tracing_service_provider_ptr.Pass(), |
| 320 shell::GetPermissiveCapabilityFilter(), base::Closure(), | 320 shell::GetPermissiveCapabilityFilter(), base::Closure(), |
| 321 shell::EmptyConnectCallback()); | 321 shell::EmptyConnectCallback()); |
| 322 | 322 |
| 323 // Record the shell startup metrics used for performance testing. | 323 // Record the shell startup metrics used for performance testing. |
| 324 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 324 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 325 tracing::kEnableStatsCollectionBindings)) { | 325 tracing::kEnableStatsCollectionBindings)) { |
| 326 tracing::StartupPerformanceDataCollectorPtr collector; | 326 tracing::StartupPerformanceDataCollectorPtr collector; |
| 327 service_provider_ptr->ConnectToService( | 327 service_provider_ptr->ConnectToService( |
| 328 tracing::StartupPerformanceDataCollector::Name_, | 328 tracing::StartupPerformanceDataCollector::Name_, |
| 329 GetProxy(&collector).PassMessagePipe()); | 329 GetProxy(&collector).PassMessagePipe()); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 | 376 |
| 377 void Context::Run(const GURL& url) { | 377 void Context::Run(const GURL& url) { |
| 378 DCHECK(app_complete_callback_.is_null()); | 378 DCHECK(app_complete_callback_.is_null()); |
| 379 ServiceProviderPtr services; | 379 ServiceProviderPtr services; |
| 380 ServiceProviderPtr exposed_services; | 380 ServiceProviderPtr exposed_services; |
| 381 | 381 |
| 382 app_urls_.insert(url); | 382 app_urls_.insert(url); |
| 383 mojo::URLRequestPtr request(mojo::URLRequest::New()); | 383 mojo::URLRequestPtr request(mojo::URLRequest::New()); |
| 384 request->url = mojo::String::From(url.spec()); | 384 request->url = mojo::String::From(url.spec()); |
| 385 application_manager_.ConnectToApplication( | 385 application_manager_.ConnectToApplication( |
| 386 nullptr, request.Pass(), std::string(), GURL(), GetProxy(&services), | 386 nullptr, request.Pass(), std::string(), GetProxy(&services), |
| 387 exposed_services.Pass(), shell::GetPermissiveCapabilityFilter(), | 387 exposed_services.Pass(), shell::GetPermissiveCapabilityFilter(), |
| 388 base::Bind(&Context::OnApplicationEnd, base::Unretained(this), url), | 388 base::Bind(&Context::OnApplicationEnd, base::Unretained(this), url), |
| 389 shell::EmptyConnectCallback()); | 389 shell::EmptyConnectCallback()); |
| 390 } | 390 } |
| 391 | 391 |
| 392 void Context::RunCommandLineApplication(const base::Closure& callback) { | 392 void Context::RunCommandLineApplication(const base::Closure& callback) { |
| 393 DCHECK(app_urls_.empty()); | 393 DCHECK(app_urls_.empty()); |
| 394 DCHECK(app_complete_callback_.is_null()); | 394 DCHECK(app_complete_callback_.is_null()); |
| 395 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 395 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 396 base::CommandLine::StringVector args = command_line->GetArgs(); | 396 base::CommandLine::StringVector args = command_line->GetArgs(); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 414 base::MessageLoop::current()->Quit(); | 414 base::MessageLoop::current()->Quit(); |
| 415 } else { | 415 } else { |
| 416 app_complete_callback_.Run(); | 416 app_complete_callback_.Run(); |
| 417 } | 417 } |
| 418 } | 418 } |
| 419 } | 419 } |
| 420 } | 420 } |
| 421 | 421 |
| 422 } // namespace runner | 422 } // namespace runner |
| 423 } // namespace mojo | 423 } // namespace mojo |
| OLD | NEW |