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 "shell/context.h" | 5 #include "shell/context.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/base_switches.h" | 9 #include "base/base_switches.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 return url_resolver_.ResolveMojoURL(url); | 340 return url_resolver_.ResolveMojoURL(url); |
341 } | 341 } |
342 | 342 |
343 void Context::OnShutdownComplete() { | 343 void Context::OnShutdownComplete() { |
344 DCHECK_EQ(base::MessageLoop::current()->task_runner(), | 344 DCHECK_EQ(base::MessageLoop::current()->task_runner(), |
345 task_runners_->shell_runner()); | 345 task_runners_->shell_runner()); |
346 base::MessageLoop::current()->Quit(); | 346 base::MessageLoop::current()->Quit(); |
347 } | 347 } |
348 | 348 |
349 void Context::OnSlaveDisconnect(mojo::embedder::SlaveInfo slave_info) { | 349 void Context::OnSlaveDisconnect(mojo::embedder::SlaveInfo slave_info) { |
350 // TODO(vtl): We don't make any proper slave processes yet, so this shouldn't | 350 // TODO(vtl): Do something, once we actually have |slave_info|. |
351 // be called yet. | |
352 NOTREACHED(); | |
353 } | 351 } |
354 | 352 |
355 void Context::Run(const GURL& url) { | 353 void Context::Run(const GURL& url) { |
356 ServiceProviderPtr services; | 354 ServiceProviderPtr services; |
357 ServiceProviderPtr exposed_services; | 355 ServiceProviderPtr exposed_services; |
358 | 356 |
359 app_urls_.insert(url); | 357 app_urls_.insert(url); |
360 application_manager_.ConnectToApplication( | 358 application_manager_.ConnectToApplication( |
361 url, GURL(), mojo::GetProxy(&services), exposed_services.Pass(), | 359 url, GURL(), mojo::GetProxy(&services), exposed_services.Pass(), |
362 base::Bind(&Context::OnApplicationEnd, base::Unretained(this), url)); | 360 base::Bind(&Context::OnApplicationEnd, base::Unretained(this), url)); |
363 } | 361 } |
364 | 362 |
365 void Context::OnApplicationEnd(const GURL& url) { | 363 void Context::OnApplicationEnd(const GURL& url) { |
366 if (app_urls_.find(url) != app_urls_.end()) { | 364 if (app_urls_.find(url) != app_urls_.end()) { |
367 app_urls_.erase(url); | 365 app_urls_.erase(url); |
368 if (app_urls_.empty() && base::MessageLoop::current()->is_running()) { | 366 if (app_urls_.empty() && base::MessageLoop::current()->is_running()) { |
369 DCHECK_EQ(base::MessageLoop::current()->task_runner(), | 367 DCHECK_EQ(base::MessageLoop::current()->task_runner(), |
370 task_runners_->shell_runner()); | 368 task_runners_->shell_runner()); |
371 base::MessageLoop::current()->Quit(); | 369 base::MessageLoop::current()->Quit(); |
372 } | 370 } |
373 } | 371 } |
374 } | 372 } |
375 | 373 |
376 } // namespace shell | 374 } // namespace shell |
OLD | NEW |