| 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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 } | 289 } |
| 290 | 290 |
| 291 GURL Context::ResolveMappings(const GURL& url) { | 291 GURL Context::ResolveMappings(const GURL& url) { |
| 292 return url_resolver_.ApplyMappings(url); | 292 return url_resolver_.ApplyMappings(url); |
| 293 } | 293 } |
| 294 | 294 |
| 295 GURL Context::ResolveMojoURL(const GURL& url) { | 295 GURL Context::ResolveMojoURL(const GURL& url) { |
| 296 return url_resolver_.ResolveMojoURL(url); | 296 return url_resolver_.ResolveMojoURL(url); |
| 297 } | 297 } |
| 298 | 298 |
| 299 bool Context::CreateFetcher( |
| 300 const GURL& url, |
| 301 const shell::Fetcher::FetchCallback& loader_callback) { |
| 302 return false; |
| 303 } |
| 304 |
| 299 void Context::OnShutdownComplete() { | 305 void Context::OnShutdownComplete() { |
| 300 DCHECK_EQ(base::MessageLoop::current()->task_runner(), | 306 DCHECK_EQ(base::MessageLoop::current()->task_runner(), |
| 301 task_runners_->shell_runner()); | 307 task_runners_->shell_runner()); |
| 302 base::MessageLoop::current()->Quit(); | 308 base::MessageLoop::current()->Quit(); |
| 303 } | 309 } |
| 304 | 310 |
| 305 void Context::Run(const GURL& url) { | 311 void Context::Run(const GURL& url) { |
| 306 ServiceProviderPtr services; | 312 ServiceProviderPtr services; |
| 307 ServiceProviderPtr exposed_services; | 313 ServiceProviderPtr exposed_services; |
| 308 | 314 |
| 309 app_urls_.insert(url); | 315 app_urls_.insert(url); |
| 310 application_manager_.ConnectToApplication( | 316 application_manager_.ConnectToApplication( |
| 311 url, GURL(), GetProxy(&services), exposed_services.Pass(), | 317 url, GURL(), GetProxy(&services), exposed_services.Pass(), |
| 312 base::Bind(&Context::OnApplicationEnd, base::Unretained(this), url)); | 318 base::Bind(&Context::OnApplicationEnd, base::Unretained(this), url)); |
| 313 } | 319 } |
| 314 | 320 |
| 315 void Context::OnApplicationEnd(const GURL& url) { | 321 void Context::OnApplicationEnd(const GURL& url) { |
| 316 if (app_urls_.find(url) != app_urls_.end()) { | 322 if (app_urls_.find(url) != app_urls_.end()) { |
| 317 app_urls_.erase(url); | 323 app_urls_.erase(url); |
| 318 if (app_urls_.empty() && base::MessageLoop::current()->is_running()) { | 324 if (app_urls_.empty() && base::MessageLoop::current()->is_running()) { |
| 319 DCHECK_EQ(base::MessageLoop::current()->task_runner(), | 325 DCHECK_EQ(base::MessageLoop::current()->task_runner(), |
| 320 task_runners_->shell_runner()); | 326 task_runners_->shell_runner()); |
| 321 base::MessageLoop::current()->Quit(); | 327 base::MessageLoop::current()->Quit(); |
| 322 } | 328 } |
| 323 } | 329 } |
| 324 } | 330 } |
| 325 | 331 |
| 326 } // namespace runner | 332 } // namespace runner |
| 327 } // namespace mojo | 333 } // namespace mojo |
| OLD | NEW |