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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 if (ConnectToExistingInstance(¶ms)) | 92 if (ConnectToExistingInstance(¶ms)) |
93 return; | 93 return; |
94 | 94 |
95 std::string url = params->target().url().spec(); | 95 std::string url = params->target().url().spec(); |
96 shell_resolver_->ResolveMojoURL( | 96 shell_resolver_->ResolveMojoURL( |
97 url, | 97 url, |
98 base::Bind(&ApplicationManager::OnGotResolvedURL, | 98 base::Bind(&ApplicationManager::OnGotResolvedURL, |
99 weak_ptr_factory_.GetWeakPtr(), base::Passed(¶ms))); | 99 weak_ptr_factory_.GetWeakPtr(), base::Passed(¶ms))); |
100 } | 100 } |
101 | 101 |
| 102 mojom::ShellClientRequest ApplicationManager::InitInstanceForEmbedder( |
| 103 const GURL& url) { |
| 104 DCHECK(!embedder_instance_); |
| 105 |
| 106 mojo::shell::Identity target(url, std::string(), mojom::Connector::kUserRoot); |
| 107 target.SetFilter(GetPermissiveCapabilityFilter()); |
| 108 DCHECK(!GetApplicationInstance(target)); |
| 109 |
| 110 mojom::ShellClientRequest request; |
| 111 embedder_instance_ = CreateInstance(target, &request); |
| 112 DCHECK(embedder_instance_); |
| 113 |
| 114 return request; |
| 115 } |
| 116 |
102 void ApplicationManager::SetLoaderForURL(scoped_ptr<ApplicationLoader> loader, | 117 void ApplicationManager::SetLoaderForURL(scoped_ptr<ApplicationLoader> loader, |
103 const GURL& url) { | 118 const GURL& url) { |
104 URLToLoaderMap::iterator it = url_to_loader_.find(url); | 119 URLToLoaderMap::iterator it = url_to_loader_.find(url); |
105 if (it != url_to_loader_.end()) | 120 if (it != url_to_loader_.end()) |
106 delete it->second; | 121 delete it->second; |
107 url_to_loader_[url] = loader.release(); | 122 url_to_loader_[url] = loader.release(); |
108 } | 123 } |
109 | 124 |
110 void ApplicationManager::TerminateShellConnections() { | 125 void ApplicationManager::TerminateShellConnections() { |
111 STLDeleteValues(&identity_to_instance_); | 126 STLDeleteValues(&identity_to_instance_); |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 info->qualifier = instance->identity().qualifier(); | 391 info->qualifier = instance->identity().qualifier(); |
377 if (instance->identity().url().spec() == "mojo://shell/") | 392 if (instance->identity().url().spec() == "mojo://shell/") |
378 info->pid = base::Process::Current().Pid(); | 393 info->pid = base::Process::Current().Pid(); |
379 else | 394 else |
380 info->pid = instance->pid(); | 395 info->pid = instance->pid(); |
381 return info; | 396 return info; |
382 } | 397 } |
383 | 398 |
384 } // namespace shell | 399 } // namespace shell |
385 } // namespace mojo | 400 } // namespace mojo |
OLD | NEW |