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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/stl_util.h" | 11 #include "base/stl_util.h" |
12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
13 #include "base/trace_event/trace_event.h" | 13 #include "base/trace_event/trace_event.h" |
14 #include "mojo/application/public/interfaces/content_handler.mojom.h" | 14 #include "mojo/application/public/interfaces/content_handler.mojom.h" |
15 #include "mojo/public/cpp/bindings/binding.h" | 15 #include "mojo/public/cpp/bindings/binding.h" |
16 #include "mojo/shell/application_fetcher.h" | |
17 #include "mojo/shell/application_instance.h" | 16 #include "mojo/shell/application_instance.h" |
18 #include "mojo/shell/content_handler_connection.h" | 17 #include "mojo/shell/content_handler_connection.h" |
19 #include "mojo/shell/fetcher.h" | 18 #include "mojo/shell/fetcher.h" |
| 19 #include "mojo/shell/local_fetcher.h" |
| 20 #include "mojo/shell/network_fetcher.h" |
20 #include "mojo/shell/query_util.h" | 21 #include "mojo/shell/query_util.h" |
21 #include "mojo/shell/switches.h" | 22 #include "mojo/shell/switches.h" |
| 23 #include "mojo/shell/update_fetcher.h" |
22 | 24 |
23 namespace mojo { | 25 namespace mojo { |
24 namespace shell { | 26 namespace shell { |
25 | 27 |
26 namespace { | 28 namespace { |
27 | 29 |
28 // Used by TestAPI. | 30 // Used by TestAPI. |
29 bool has_created_instance = false; | 31 bool has_created_instance = false; |
30 | 32 |
31 void OnEmptyOnConnectCallback(uint32_t content_handler_id) {} | 33 void OnEmptyOnConnectCallback(uint32_t content_handler_id) {} |
(...skipping 11 matching lines...) Expand all Loading... |
43 bool ApplicationManager::TestAPI::HasCreatedInstance() { | 45 bool ApplicationManager::TestAPI::HasCreatedInstance() { |
44 return has_created_instance; | 46 return has_created_instance; |
45 } | 47 } |
46 | 48 |
47 bool ApplicationManager::TestAPI::HasRunningInstanceForURL( | 49 bool ApplicationManager::TestAPI::HasRunningInstanceForURL( |
48 const GURL& url) const { | 50 const GURL& url) const { |
49 return manager_->identity_to_instance_.find(Identity(url)) != | 51 return manager_->identity_to_instance_.find(Identity(url)) != |
50 manager_->identity_to_instance_.end(); | 52 manager_->identity_to_instance_.end(); |
51 } | 53 } |
52 | 54 |
53 ApplicationManager::ApplicationManager(scoped_ptr<ApplicationFetcher> fetcher) | 55 ApplicationManager::ApplicationManager(Delegate* delegate) |
54 : fetcher_(fetcher.Pass()), | 56 : delegate_(delegate), |
| 57 disable_cache_(false), |
55 content_handler_id_counter_(0u), | 58 content_handler_id_counter_(0u), |
56 weak_ptr_factory_(this) { | 59 weak_ptr_factory_(this) {} |
57 fetcher_->SetApplicationManager(this); | |
58 } | |
59 | 60 |
60 ApplicationManager::~ApplicationManager() { | 61 ApplicationManager::~ApplicationManager() { |
61 URLToContentHandlerMap url_to_content_handler(url_to_content_handler_); | 62 URLToContentHandlerMap url_to_content_handler(url_to_content_handler_); |
62 for (auto& pair : url_to_content_handler) | 63 for (auto& pair : url_to_content_handler) |
63 pair.second->CloseConnection(); | 64 pair.second->CloseConnection(); |
64 TerminateShellConnections(); | 65 TerminateShellConnections(); |
65 STLDeleteValues(&url_to_loader_); | 66 STLDeleteValues(&url_to_loader_); |
66 STLDeleteValues(&scheme_to_loader_); | 67 STLDeleteValues(&scheme_to_loader_); |
67 } | 68 } |
68 | 69 |
(...skipping 27 matching lines...) Expand all Loading... |
96 scoped_ptr<ConnectToApplicationParams> params) { | 97 scoped_ptr<ConnectToApplicationParams> params) { |
97 GURL original_url = params->app_url(); | 98 GURL original_url = params->app_url(); |
98 URLRequestPtr original_url_request = params->TakeAppURLRequest(); | 99 URLRequestPtr original_url_request = params->TakeAppURLRequest(); |
99 | 100 |
100 TRACE_EVENT_INSTANT1("mojo_shell", "ApplicationManager::ConnectToApplication", | 101 TRACE_EVENT_INSTANT1("mojo_shell", "ApplicationManager::ConnectToApplication", |
101 TRACE_EVENT_SCOPE_THREAD, "original_url", | 102 TRACE_EVENT_SCOPE_THREAD, "original_url", |
102 original_url.spec()); | 103 original_url.spec()); |
103 DCHECK(original_url.is_valid()); | 104 DCHECK(original_url.is_valid()); |
104 DCHECK(original_url_request); | 105 DCHECK(original_url_request); |
105 | 106 |
106 GURL resolved_url = fetcher_->ResolveURL(original_url); | 107 // We check both the mapped and resolved urls for existing instances because |
| 108 // external applications can be registered for the unresolved mojo:foo urls. |
| 109 |
| 110 GURL mapped_url = delegate_->ResolveMappings(original_url); |
| 111 params->SetURLInfo(mapped_url); |
| 112 if (ConnectToRunningApplication(¶ms)) |
| 113 return; |
| 114 |
| 115 GURL resolved_url = delegate_->ResolveMojoURL(mapped_url); |
107 params->SetURLInfo(resolved_url); | 116 params->SetURLInfo(resolved_url); |
108 if (ConnectToRunningApplication(¶ms)) | 117 if (ConnectToRunningApplication(¶ms)) |
109 return; | 118 return; |
110 | 119 |
111 // The application is not running, let's compute the parameters. | 120 // The application is not running, let's compute the parameters. |
112 // NOTE: Set URL info using |original_url_request| instead of |original_url| | 121 // NOTE: Set URL info using |original_url_request| instead of |original_url| |
113 // because it may contain more information (e.g., it is a POST request). | 122 // because it may contain more information (e.g., it is a POST request). |
114 params->SetURLInfo(original_url_request.Pass()); | 123 params->SetURLInfo(original_url_request.Pass()); |
115 ApplicationLoader* loader = GetLoaderForURL(resolved_url); | 124 if (ConnectToApplicationWithLoader(¶ms, mapped_url, |
116 if (loader) { | 125 GetLoaderForURL(mapped_url))) { |
117 ConnectToApplicationWithLoader(¶ms, resolved_url, loader); | |
118 return; | 126 return; |
119 } | 127 } |
120 | 128 |
| 129 if (ConnectToApplicationWithLoader(¶ms, resolved_url, |
| 130 GetLoaderForURL(resolved_url))) { |
| 131 return; |
| 132 } |
| 133 |
| 134 if (ConnectToApplicationWithLoader(¶ms, resolved_url, |
| 135 default_loader_.get())) { |
| 136 return; |
| 137 } |
| 138 |
121 original_url_request = params->TakeAppURLRequest(); | 139 original_url_request = params->TakeAppURLRequest(); |
122 auto callback = | 140 auto callback = |
123 base::Bind(&ApplicationManager::HandleFetchCallback, | 141 base::Bind(&ApplicationManager::HandleFetchCallback, |
124 weak_ptr_factory_.GetWeakPtr(), base::Passed(¶ms)); | 142 weak_ptr_factory_.GetWeakPtr(), base::Passed(¶ms)); |
125 fetcher_->FetchRequest(original_url_request.Pass(), callback); | 143 |
| 144 if (delegate_->CreateFetcher( |
| 145 resolved_url, |
| 146 base::Bind(callback, NativeApplicationCleanup::DONT_DELETE))) { |
| 147 return; |
| 148 } |
| 149 |
| 150 if (resolved_url.SchemeIsFile()) { |
| 151 // LocalFetcher uses the network service to infer MIME types from URLs. |
| 152 // Skip this for mojo URLs to avoid recursively loading the network service. |
| 153 if (!network_service_ && !original_url.SchemeIs("mojo")) |
| 154 ConnectToService(GURL("mojo:network_service"), &network_service_); |
| 155 new LocalFetcher( |
| 156 network_service_.get(), resolved_url, |
| 157 GetBaseURLAndQuery(resolved_url, nullptr), |
| 158 base::Bind(callback, NativeApplicationCleanup::DONT_DELETE)); |
| 159 return; |
| 160 } |
| 161 |
| 162 if (mapped_url.SchemeIs("mojo") && |
| 163 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 164 switches::kUseUpdater)) { |
| 165 ConnectToService(GURL("mojo:updater"), &updater_); |
| 166 new UpdateFetcher( |
| 167 mapped_url, updater_.get(), |
| 168 base::Bind(callback, NativeApplicationCleanup::DONT_DELETE)); |
| 169 return; |
| 170 } |
| 171 |
| 172 if (!url_loader_factory_) |
| 173 ConnectToService(GURL("mojo:network_service"), &url_loader_factory_); |
| 174 |
| 175 const NativeApplicationCleanup cleanup = |
| 176 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 177 switches::kDontDeleteOnDownload) |
| 178 ? NativeApplicationCleanup::DONT_DELETE |
| 179 : NativeApplicationCleanup::DELETE; |
| 180 |
| 181 if (original_url.SchemeIs("mojo")) { |
| 182 // Use the resolved mojo URL in the request to support origin mapping, etc. |
| 183 URLRequestPtr resolved_url_request(URLRequest::New()); |
| 184 resolved_url_request->url = resolved_url.spec(); |
| 185 new NetworkFetcher(disable_cache_, resolved_url_request.Pass(), |
| 186 url_loader_factory_.get(), |
| 187 base::Bind(callback, cleanup)); |
| 188 return; |
| 189 } |
| 190 |
| 191 new NetworkFetcher(disable_cache_, original_url_request.Pass(), |
| 192 url_loader_factory_.get(), base::Bind(callback, cleanup)); |
126 } | 193 } |
127 | 194 |
128 bool ApplicationManager::ConnectToRunningApplication( | 195 bool ApplicationManager::ConnectToRunningApplication( |
129 scoped_ptr<ConnectToApplicationParams>* params) { | 196 scoped_ptr<ConnectToApplicationParams>* params) { |
130 ApplicationInstance* instance = GetApplicationInstance( | 197 ApplicationInstance* instance = GetApplicationInstance( |
131 Identity((*params)->app_url(), (*params)->qualifier())); | 198 Identity((*params)->app_url(), (*params)->qualifier())); |
132 if (!instance) | 199 if (!instance) |
133 return false; | 200 return false; |
134 | 201 |
135 instance->ConnectToClient(params->Pass()); | 202 instance->ConnectToClient(params->Pass()); |
136 return true; | 203 return true; |
137 } | 204 } |
138 | 205 |
139 void ApplicationManager::ConnectToApplicationWithLoader( | 206 bool ApplicationManager::ConnectToApplicationWithLoader( |
140 scoped_ptr<ConnectToApplicationParams>* params, | 207 scoped_ptr<ConnectToApplicationParams>* params, |
141 const GURL& resolved_url, | 208 const GURL& resolved_url, |
142 ApplicationLoader* loader) { | 209 ApplicationLoader* loader) { |
| 210 if (!loader) |
| 211 return false; |
| 212 |
143 if (!(*params)->app_url().SchemeIs("mojo")) | 213 if (!(*params)->app_url().SchemeIs("mojo")) |
144 (*params)->SetURLInfo(resolved_url); | 214 (*params)->SetURLInfo(resolved_url); |
145 | 215 |
146 loader->Load(resolved_url, RegisterInstance(params->Pass(), nullptr)); | 216 loader->Load(resolved_url, RegisterInstance(params->Pass(), nullptr)); |
| 217 return true; |
147 } | 218 } |
148 | 219 |
149 InterfaceRequest<Application> ApplicationManager::RegisterInstance( | 220 InterfaceRequest<Application> ApplicationManager::RegisterInstance( |
150 scoped_ptr<ConnectToApplicationParams> params, | 221 scoped_ptr<ConnectToApplicationParams> params, |
151 ApplicationInstance** resulting_instance) { | 222 ApplicationInstance** resulting_instance) { |
152 Identity app_identity(params->app_url(), params->qualifier()); | 223 Identity app_identity(params->app_url(), params->qualifier()); |
153 | 224 |
154 ApplicationPtr application; | 225 ApplicationPtr application; |
155 InterfaceRequest<Application> application_request = GetProxy(&application); | 226 InterfaceRequest<Application> application_request = GetProxy(&application); |
156 ApplicationInstance* instance = new ApplicationInstance( | 227 ApplicationInstance* instance = new ApplicationInstance( |
(...skipping 13 matching lines...) Expand all Loading... |
170 ApplicationInstance* ApplicationManager::GetApplicationInstance( | 241 ApplicationInstance* ApplicationManager::GetApplicationInstance( |
171 const Identity& identity) const { | 242 const Identity& identity) const { |
172 const auto& instance_it = identity_to_instance_.find(identity); | 243 const auto& instance_it = identity_to_instance_.find(identity); |
173 if (instance_it != identity_to_instance_.end()) | 244 if (instance_it != identity_to_instance_.end()) |
174 return instance_it->second; | 245 return instance_it->second; |
175 return nullptr; | 246 return nullptr; |
176 } | 247 } |
177 | 248 |
178 void ApplicationManager::HandleFetchCallback( | 249 void ApplicationManager::HandleFetchCallback( |
179 scoped_ptr<ConnectToApplicationParams> params, | 250 scoped_ptr<ConnectToApplicationParams> params, |
| 251 NativeApplicationCleanup cleanup, |
180 scoped_ptr<Fetcher> fetcher) { | 252 scoped_ptr<Fetcher> fetcher) { |
181 if (!fetcher) { | 253 if (!fetcher) { |
182 // Network error. Drop |params| to tell the requestor. | 254 // Network error. Drop |params| to tell the requestor. |
183 params->connect_callback().Run(Shell::kInvalidContentHandlerID); | 255 params->connect_callback().Run(Shell::kInvalidContentHandlerID); |
184 return; | 256 return; |
185 } | 257 } |
186 | 258 |
187 GURL redirect_url = fetcher->GetRedirectURL(); | 259 GURL redirect_url = fetcher->GetRedirectURL(); |
188 if (!redirect_url.is_empty()) { | 260 if (!redirect_url.is_empty()) { |
189 // And around we go again... Whee! | 261 // And around we go again... Whee! |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 params->set_connect_callback(EmptyConnectCallback()); | 293 params->set_connect_callback(EmptyConnectCallback()); |
222 ApplicationInstance* app = nullptr; | 294 ApplicationInstance* app = nullptr; |
223 InterfaceRequest<Application> request(RegisterInstance(params.Pass(), &app)); | 295 InterfaceRequest<Application> request(RegisterInstance(params.Pass(), &app)); |
224 | 296 |
225 // For resources that are loaded with content handlers, we group app instances | 297 // For resources that are loaded with content handlers, we group app instances |
226 // by site. | 298 // by site. |
227 | 299 |
228 // If the response begins with a #!mojo <content-handler-url>, use it. | 300 // If the response begins with a #!mojo <content-handler-url>, use it. |
229 GURL content_handler_url; | 301 GURL content_handler_url; |
230 std::string shebang; | 302 std::string shebang; |
231 // TODO(beng): it seems like some delegate should/would want to have a say in | |
232 // configuring the qualifier also. | |
233 bool enable_multi_process = base::CommandLine::ForCurrentProcess()->HasSwitch( | 303 bool enable_multi_process = base::CommandLine::ForCurrentProcess()->HasSwitch( |
234 switches::kEnableMultiprocess); | 304 switches::kEnableMultiprocess); |
235 | 305 |
236 if (fetcher->PeekContentHandler(&shebang, &content_handler_url)) { | 306 if (fetcher->PeekContentHandler(&shebang, &content_handler_url)) { |
237 URLResponsePtr response(fetcher->AsURLResponse( | 307 URLResponsePtr response(fetcher->AsURLResponse( |
238 blocking_pool_, static_cast<int>(shebang.size()))); | 308 blocking_pool_, static_cast<int>(shebang.size()))); |
239 std::string site = | 309 std::string site = |
240 enable_multi_process ? response->site.To<std::string>() : std::string(); | 310 enable_multi_process ? response->site.To<std::string>() : std::string(); |
241 LoadWithContentHandler(originator_identity, originator_filter, | 311 LoadWithContentHandler(originator_identity, originator_filter, |
242 content_handler_url, site, filter, connect_callback, | 312 content_handler_url, site, filter, connect_callback, |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 else if (app_url == GURL("mojo://html_viewer/")) | 378 else if (app_url == GURL("mojo://html_viewer/")) |
309 start_sandboxed = true; | 379 start_sandboxed = true; |
310 } | 380 } |
311 | 381 |
312 connect_callback.Run(Shell::kInvalidContentHandlerID); | 382 connect_callback.Run(Shell::kInvalidContentHandlerID); |
313 | 383 |
314 fetcher->AsPath(blocking_pool_, | 384 fetcher->AsPath(blocking_pool_, |
315 base::Bind(&ApplicationManager::RunNativeApplication, | 385 base::Bind(&ApplicationManager::RunNativeApplication, |
316 weak_ptr_factory_.GetWeakPtr(), | 386 weak_ptr_factory_.GetWeakPtr(), |
317 base::Passed(request.Pass()), start_sandboxed, | 387 base::Passed(request.Pass()), start_sandboxed, |
318 options, base::Passed(fetcher.Pass()))); | 388 options, cleanup, base::Passed(fetcher.Pass()))); |
319 } | 389 } |
320 | 390 |
321 void ApplicationManager::RunNativeApplication( | 391 void ApplicationManager::RunNativeApplication( |
322 InterfaceRequest<Application> application_request, | 392 InterfaceRequest<Application> application_request, |
323 bool start_sandboxed, | 393 bool start_sandboxed, |
324 const NativeRunnerFactory::Options& options, | 394 const NativeRunnerFactory::Options& options, |
| 395 NativeApplicationCleanup cleanup, |
325 scoped_ptr<Fetcher> fetcher, | 396 scoped_ptr<Fetcher> fetcher, |
326 const base::FilePath& path, | 397 const base::FilePath& path, |
327 bool path_exists) { | 398 bool path_exists) { |
328 // We only passed fetcher to keep it alive. Done with it now. | 399 // We only passed fetcher to keep it alive. Done with it now. |
329 fetcher.reset(); | 400 fetcher.reset(); |
330 | 401 |
331 DCHECK(application_request.is_pending()); | 402 DCHECK(application_request.is_pending()); |
332 | 403 |
333 if (!path_exists) { | 404 if (!path_exists) { |
334 LOG(ERROR) << "Library not started because library path '" << path.value() | 405 LOG(ERROR) << "Library not started because library path '" << path.value() |
335 << "' does not exist."; | 406 << "' does not exist."; |
336 return; | 407 return; |
337 } | 408 } |
338 | 409 |
339 TRACE_EVENT1("mojo_shell", "ApplicationManager::RunNativeApplication", "path", | 410 TRACE_EVENT1("mojo_shell", "ApplicationManager::RunNativeApplication", "path", |
340 path.AsUTF8Unsafe()); | 411 path.AsUTF8Unsafe()); |
341 NativeRunner* runner = native_runner_factory_->Create(options).release(); | 412 NativeRunner* runner = native_runner_factory_->Create(options).release(); |
342 native_runners_.push_back(runner); | 413 native_runners_.push_back(runner); |
343 runner->Start(path, start_sandboxed, NativeApplicationCleanup::DONT_DELETE, | 414 runner->Start(path, start_sandboxed, cleanup, application_request.Pass(), |
344 application_request.Pass(), | |
345 base::Bind(&ApplicationManager::CleanupRunner, | 415 base::Bind(&ApplicationManager::CleanupRunner, |
346 weak_ptr_factory_.GetWeakPtr(), runner)); | 416 weak_ptr_factory_.GetWeakPtr(), runner)); |
347 } | 417 } |
348 | 418 |
349 void ApplicationManager::RegisterContentHandler( | 419 void ApplicationManager::RegisterContentHandler( |
350 const std::string& mime_type, | 420 const std::string& mime_type, |
351 const GURL& content_handler_url) { | 421 const GURL& content_handler_url) { |
352 DCHECK(content_handler_url.is_valid()) | 422 DCHECK(content_handler_url.is_valid()) |
353 << "Content handler URL is invalid for mime type " << mime_type; | 423 << "Content handler URL is invalid for mime type " << mime_type; |
354 mime_type_to_url_[mime_type] = content_handler_url; | 424 mime_type_to_url_[mime_type] = content_handler_url; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 if (it != scheme_to_loader_.end()) | 477 if (it != scheme_to_loader_.end()) |
408 delete it->second; | 478 delete it->second; |
409 scheme_to_loader_[scheme] = loader.release(); | 479 scheme_to_loader_[scheme] = loader.release(); |
410 } | 480 } |
411 | 481 |
412 void ApplicationManager::SetNativeOptionsForURL( | 482 void ApplicationManager::SetNativeOptionsForURL( |
413 const NativeRunnerFactory::Options& options, | 483 const NativeRunnerFactory::Options& options, |
414 const GURL& url) { | 484 const GURL& url) { |
415 DCHECK(!url.has_query()); // Precondition. | 485 DCHECK(!url.has_query()); // Precondition. |
416 // Apply mappings and resolution to get the resolved URL. | 486 // Apply mappings and resolution to get the resolved URL. |
417 GURL resolved_url = fetcher_->ResolveURL(url); | 487 GURL resolved_url = |
| 488 delegate_->ResolveMojoURL(delegate_->ResolveMappings(url)); |
418 DCHECK(!resolved_url.has_query()); // Still shouldn't have query. | 489 DCHECK(!resolved_url.has_query()); // Still shouldn't have query. |
419 // TODO(vtl): We should probably also remove/disregard the query string (and | 490 // TODO(vtl): We should probably also remove/disregard the query string (and |
420 // maybe canonicalize in other ways). | 491 // maybe canonicalize in other ways). |
421 DVLOG(2) << "Storing native options for resolved URL " << resolved_url | 492 DVLOG(2) << "Storing native options for resolved URL " << resolved_url |
422 << " (original URL " << url << ")"; | 493 << " (original URL " << url << ")"; |
423 url_to_native_options_[resolved_url] = options; | 494 url_to_native_options_[resolved_url] = options; |
424 } | 495 } |
425 | 496 |
426 ApplicationLoader* ApplicationManager::GetLoaderForURL(const GURL& url) { | 497 ApplicationLoader* ApplicationManager::GetLoaderForURL(const GURL& url) { |
427 auto url_it = url_to_loader_.find(GetBaseURLAndQuery(url, nullptr)); | 498 auto url_it = url_to_loader_.find(GetBaseURLAndQuery(url, nullptr)); |
428 if (url_it != url_to_loader_.end()) | 499 if (url_it != url_to_loader_.end()) |
429 return url_it->second; | 500 return url_it->second; |
430 auto scheme_it = scheme_to_loader_.find(url.scheme()); | 501 auto scheme_it = scheme_to_loader_.find(url.scheme()); |
431 if (scheme_it != scheme_to_loader_.end()) | 502 if (scheme_it != scheme_to_loader_.end()) |
432 return scheme_it->second; | 503 return scheme_it->second; |
433 return default_loader_.get(); | 504 return nullptr; |
434 } | 505 } |
435 | 506 |
436 void ApplicationManager::OnApplicationInstanceError( | 507 void ApplicationManager::OnApplicationInstanceError( |
437 ApplicationInstance* instance) { | 508 ApplicationInstance* instance) { |
438 // Called from ~ApplicationInstance, so we do not need to call Destroy here. | 509 // Called from ~ApplicationInstance, so we do not need to call Destroy here. |
439 const Identity identity = instance->identity(); | 510 const Identity identity = instance->identity(); |
440 base::Closure on_application_end = instance->on_application_end(); | 511 base::Closure on_application_end = instance->on_application_end(); |
441 // Remove the shell. | 512 // Remove the shell. |
442 auto it = identity_to_instance_.find(identity); | 513 auto it = identity_to_instance_.find(identity); |
443 DCHECK(it != identity_to_instance_.end()); | 514 DCHECK(it != identity_to_instance_.end()); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 services->ConnectToService(interface_name, pipe.handle1.Pass()); | 546 services->ConnectToService(interface_name, pipe.handle1.Pass()); |
476 return pipe.handle0.Pass(); | 547 return pipe.handle0.Pass(); |
477 } | 548 } |
478 | 549 |
479 Shell::ConnectToApplicationCallback EmptyConnectCallback() { | 550 Shell::ConnectToApplicationCallback EmptyConnectCallback() { |
480 return base::Bind(&OnEmptyOnConnectCallback); | 551 return base::Bind(&OnEmptyOnConnectCallback); |
481 } | 552 } |
482 | 553 |
483 } // namespace shell | 554 } // namespace shell |
484 } // namespace mojo | 555 } // namespace mojo |
OLD | NEW |