| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/shell/application_manager.h" | 5 #include "mojo/shell/application_manager.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 if (ConnectToExistingInstance(¶ms)) | 91 if (ConnectToExistingInstance(¶ms)) |
| 92 return; | 92 return; |
| 93 | 93 |
| 94 std::string url = params->target().url().spec(); | 94 std::string url = params->target().url().spec(); |
| 95 shell_resolver_->ResolveMojoURL( | 95 shell_resolver_->ResolveMojoURL( |
| 96 url, | 96 url, |
| 97 base::Bind(&ApplicationManager::OnGotResolvedURL, | 97 base::Bind(&ApplicationManager::OnGotResolvedURL, |
| 98 weak_ptr_factory_.GetWeakPtr(), base::Passed(¶ms))); | 98 weak_ptr_factory_.GetWeakPtr(), base::Passed(¶ms))); |
| 99 } | 99 } |
| 100 | 100 |
| 101 mojom::ShellClientRequest ApplicationManager::CreateInstanceForURL( |
| 102 scoped_ptr<ConnectParams> params) { |
| 103 DCHECK(params->target().url().is_valid()); |
| 104 DCHECK(params->target().user_id() == mojom::Shell::kUserRoot); |
| 105 DCHECK(!GetApplicationInstance(params->target())); |
| 106 |
| 107 Identity target(params->target().url(), params->target().qualifier(), |
| 108 params->target().user_id(), params->target().filter()); |
| 109 |
| 110 mojom::ShellClientRequest request; |
| 111 ApplicationInstance* instance = CreateInstance(target, &request); |
| 112 instance->ConnectToClient(std::move(params)); |
| 113 |
| 114 return request; |
| 115 } |
| 116 |
| 101 void ApplicationManager::SetLoaderForURL(scoped_ptr<ApplicationLoader> loader, | 117 void ApplicationManager::SetLoaderForURL(scoped_ptr<ApplicationLoader> loader, |
| 102 const GURL& url) { | 118 const GURL& url) { |
| 103 URLToLoaderMap::iterator it = url_to_loader_.find(url); | 119 URLToLoaderMap::iterator it = url_to_loader_.find(url); |
| 104 if (it != url_to_loader_.end()) | 120 if (it != url_to_loader_.end()) |
| 105 delete it->second; | 121 delete it->second; |
| 106 url_to_loader_[url] = loader.release(); | 122 url_to_loader_[url] = loader.release(); |
| 107 } | 123 } |
| 108 | 124 |
| 109 void ApplicationManager::TerminateShellConnections() { | 125 void ApplicationManager::TerminateShellConnections() { |
| 110 STLDeleteValues(&identity_to_instance_); | 126 STLDeleteValues(&identity_to_instance_); |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 info->qualifier = instance->identity().qualifier(); | 389 info->qualifier = instance->identity().qualifier(); |
| 374 if (instance->identity().url().spec() == "mojo://shell/") | 390 if (instance->identity().url().spec() == "mojo://shell/") |
| 375 info->pid = base::Process::Current().Pid(); | 391 info->pid = base::Process::Current().Pid(); |
| 376 else | 392 else |
| 377 info->pid = instance->pid(); | 393 info->pid = instance->pid(); |
| 378 return info; | 394 return info; |
| 379 } | 395 } |
| 380 | 396 |
| 381 } // namespace shell | 397 } // namespace shell |
| 382 } // namespace mojo | 398 } // namespace mojo |
| OLD | NEW |