| 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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 application_manager_.set_native_runner_factory(runner_factory.Pass()); | 265 application_manager_.set_native_runner_factory(runner_factory.Pass()); |
| 266 application_manager_.set_disable_cache( | 266 application_manager_.set_disable_cache( |
| 267 base::CommandLine::ForCurrentProcess()->HasSwitch( | 267 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 268 switches::kDisableCache)); | 268 switches::kDisableCache)); |
| 269 | 269 |
| 270 InitContentHandlers(&application_manager_, command_line); | 270 InitContentHandlers(&application_manager_, command_line); |
| 271 InitNativeOptions(&application_manager_, command_line); | 271 InitNativeOptions(&application_manager_, command_line); |
| 272 | 272 |
| 273 ServiceProviderPtr tracing_service_provider_ptr; | 273 ServiceProviderPtr tracing_service_provider_ptr; |
| 274 new TracingServiceProvider(GetProxy(&tracing_service_provider_ptr)); | 274 new TracingServiceProvider(GetProxy(&tracing_service_provider_ptr)); |
| 275 application_manager_.ConnectToApplication( | 275 mojo::URLRequestPtr request(mojo::URLRequest::New()); |
| 276 GURL("mojo:tracing"), GURL(""), nullptr, | 276 request->url = mojo::String::From("mojo:tracing"); |
| 277 tracing_service_provider_ptr.Pass(), base::Closure()); | 277 application_manager_.ConnectToApplication(request.Pass(), GURL(""), nullptr, |
| 278 tracing_service_provider_ptr.Pass(), |
| 279 base::Closure()); |
| 278 | 280 |
| 279 return true; | 281 return true; |
| 280 } | 282 } |
| 281 | 283 |
| 282 void Context::Shutdown() { | 284 void Context::Shutdown() { |
| 283 TRACE_EVENT0("mojo_shell", "Context::Shutdown"); | 285 TRACE_EVENT0("mojo_shell", "Context::Shutdown"); |
| 284 DCHECK_EQ(base::MessageLoop::current()->task_runner(), | 286 DCHECK_EQ(base::MessageLoop::current()->task_runner(), |
| 285 task_runners_->shell_runner()); | 287 task_runners_->shell_runner()); |
| 286 embedder::ShutdownIPCSupport(); | 288 embedder::ShutdownIPCSupport(); |
| 287 // We'll quit when we get OnShutdownComplete(). | 289 // We'll quit when we get OnShutdownComplete(). |
| (...skipping 18 matching lines...) Expand all Loading... |
| 306 DCHECK_EQ(base::MessageLoop::current()->task_runner(), | 308 DCHECK_EQ(base::MessageLoop::current()->task_runner(), |
| 307 task_runners_->shell_runner()); | 309 task_runners_->shell_runner()); |
| 308 base::MessageLoop::current()->Quit(); | 310 base::MessageLoop::current()->Quit(); |
| 309 } | 311 } |
| 310 | 312 |
| 311 void Context::Run(const GURL& url) { | 313 void Context::Run(const GURL& url) { |
| 312 ServiceProviderPtr services; | 314 ServiceProviderPtr services; |
| 313 ServiceProviderPtr exposed_services; | 315 ServiceProviderPtr exposed_services; |
| 314 | 316 |
| 315 app_urls_.insert(url); | 317 app_urls_.insert(url); |
| 318 mojo::URLRequestPtr request(mojo::URLRequest::New()); |
| 319 request->url = mojo::String::From(url.spec()); |
| 316 application_manager_.ConnectToApplication( | 320 application_manager_.ConnectToApplication( |
| 317 url, GURL(), GetProxy(&services), exposed_services.Pass(), | 321 request.Pass(), GURL(), GetProxy(&services), exposed_services.Pass(), |
| 318 base::Bind(&Context::OnApplicationEnd, base::Unretained(this), url)); | 322 base::Bind(&Context::OnApplicationEnd, base::Unretained(this), url)); |
| 319 } | 323 } |
| 320 | 324 |
| 321 void Context::RunCommandLineApplication() { | 325 void Context::RunCommandLineApplication() { |
| 322 // If an app isn't specified (i.e. for an apptest), run the window manager. | 326 // If an app isn't specified (i.e. for an apptest), run the window manager. |
| 323 GURL app_url("mojo:window_manager"); | 327 GURL app_url("mojo:window_manager"); |
| 324 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 328 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 325 base::CommandLine::StringVector args = command_line->GetArgs(); | 329 base::CommandLine::StringVector args = command_line->GetArgs(); |
| 326 for (size_t i = 0; i < args.size(); ++i) { | 330 for (size_t i = 0; i < args.size(); ++i) { |
| 327 GURL possible_app(args[i]); | 331 GURL possible_app(args[i]); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 339 if (app_urls_.empty() && base::MessageLoop::current()->is_running()) { | 343 if (app_urls_.empty() && base::MessageLoop::current()->is_running()) { |
| 340 DCHECK_EQ(base::MessageLoop::current()->task_runner(), | 344 DCHECK_EQ(base::MessageLoop::current()->task_runner(), |
| 341 task_runners_->shell_runner()); | 345 task_runners_->shell_runner()); |
| 342 base::MessageLoop::current()->Quit(); | 346 base::MessageLoop::current()->Quit(); |
| 343 } | 347 } |
| 344 } | 348 } |
| 345 } | 349 } |
| 346 | 350 |
| 347 } // namespace runner | 351 } // namespace runner |
| 348 } // namespace mojo | 352 } // namespace mojo |
| OLD | NEW |