| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "content/child/process_control_impl.h" | 5 #include "content/child/process_control_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 const mojo::String& name, | 23 const mojo::String& name, |
| 24 shell::mojom::ShellClientRequest request, | 24 shell::mojom::ShellClientRequest request, |
| 25 const LoadApplicationCallback& callback) { | 25 const LoadApplicationCallback& callback) { |
| 26 // Only register apps on first run. | 26 // Only register apps on first run. |
| 27 if (!has_registered_apps_) { | 27 if (!has_registered_apps_) { |
| 28 DCHECK(apps_.empty()); | 28 DCHECK(apps_.empty()); |
| 29 ApplicationMap apps; | 29 ApplicationMap apps; |
| 30 RegisterApplications(&apps); | 30 RegisterApplications(&apps); |
| 31 for (const auto& app : apps) { | 31 for (const auto& app : apps) { |
| 32 std::unique_ptr<EmbeddedApplicationRunner> runner( | 32 std::unique_ptr<EmbeddedApplicationRunner> runner( |
| 33 new EmbeddedApplicationRunner(app.second.application_factory, | 33 new EmbeddedApplicationRunner(app.first, app.second)); |
| 34 app.second.application_task_runner)); | |
| 35 runner->SetQuitClosure(base::Bind(&ProcessControlImpl::OnApplicationQuit, | 34 runner->SetQuitClosure(base::Bind(&ProcessControlImpl::OnApplicationQuit, |
| 36 base::Unretained(this))); | 35 base::Unretained(this))); |
| 37 apps_.insert(std::make_pair(app.first, std::move(runner))); | 36 apps_.insert(std::make_pair(app.first, std::move(runner))); |
| 38 } | 37 } |
| 39 has_registered_apps_ = true; | 38 has_registered_apps_ = true; |
| 40 } | 39 } |
| 41 | 40 |
| 42 auto it = apps_.find(name); | 41 auto it = apps_.find(name); |
| 43 if (it == apps_.end()) { | 42 if (it == apps_.end()) { |
| 44 callback.Run(false); | 43 callback.Run(false); |
| 45 OnLoadFailed(); | 44 OnLoadFailed(); |
| 46 return; | 45 return; |
| 47 } | 46 } |
| 48 | 47 |
| 49 callback.Run(true); | 48 callback.Run(true); |
| 50 it->second->BindShellClientRequest(std::move(request)); | 49 it->second->BindShellClientRequest(std::move(request)); |
| 51 } | 50 } |
| 52 | 51 |
| 53 } // namespace content | 52 } // namespace content |
| OLD | NEW |