| 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::InitInstanceForEmbedder( |
| 102 const GURL& url) { |
| 103 DCHECK(!embedder_instance_); |
| 104 |
| 105 mojo::shell::Identity target(url, std::string(), mojom::Shell::kUserRoot, |
| 106 GetPermissiveCapabilityFilter()); |
| 107 DCHECK(!GetApplicationInstance(target)); |
| 108 |
| 109 mojom::ShellClientRequest request; |
| 110 embedder_instance_ = CreateInstance(target, &request); |
| 111 DCHECK(embedder_instance_); |
| 112 |
| 113 return request; |
| 114 } |
| 115 |
| 101 void ApplicationManager::SetLoaderForURL(scoped_ptr<ApplicationLoader> loader, | 116 void ApplicationManager::SetLoaderForURL(scoped_ptr<ApplicationLoader> loader, |
| 102 const GURL& url) { | 117 const GURL& url) { |
| 103 URLToLoaderMap::iterator it = url_to_loader_.find(url); | 118 URLToLoaderMap::iterator it = url_to_loader_.find(url); |
| 104 if (it != url_to_loader_.end()) | 119 if (it != url_to_loader_.end()) |
| 105 delete it->second; | 120 delete it->second; |
| 106 url_to_loader_[url] = loader.release(); | 121 url_to_loader_[url] = loader.release(); |
| 107 } | 122 } |
| 108 | 123 |
| 109 void ApplicationManager::TerminateShellConnections() { | 124 void ApplicationManager::TerminateShellConnections() { |
| 110 STLDeleteValues(&identity_to_instance_); | 125 STLDeleteValues(&identity_to_instance_); |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 info->qualifier = instance->identity().qualifier(); | 388 info->qualifier = instance->identity().qualifier(); |
| 374 if (instance->identity().url().spec() == "mojo://shell/") | 389 if (instance->identity().url().spec() == "mojo://shell/") |
| 375 info->pid = base::Process::Current().Pid(); | 390 info->pid = base::Process::Current().Pid(); |
| 376 else | 391 else |
| 377 info->pid = instance->pid(); | 392 info->pid = instance->pid(); |
| 378 return info; | 393 return info; |
| 379 } | 394 } |
| 380 | 395 |
| 381 } // namespace shell | 396 } // namespace shell |
| 382 } // namespace mojo | 397 } // namespace mojo |
| OLD | NEW |