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/shell.h" | 5 #include "mojo/shell/shell.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 DCHECK(it != shell_client_factories_.end()); | 522 DCHECK(it != shell_client_factories_.end()); |
523 shell_client_factories_.erase(it); | 523 shell_client_factories_.erase(it); |
524 } | 524 } |
525 | 525 |
526 void Shell::OnGotResolvedName(scoped_ptr<ConnectParams> params, | 526 void Shell::OnGotResolvedName(scoped_ptr<ConnectParams> params, |
527 const String& resolved_name, | 527 const String& resolved_name, |
528 const String& resolved_instance, | 528 const String& resolved_instance, |
529 mojom::CapabilityFilterPtr base_filter, | 529 mojom::CapabilityFilterPtr base_filter, |
530 const String& file_url) { | 530 const String& file_url) { |
531 std::string instance_name = params->target().instance(); | 531 std::string instance_name = params->target().instance(); |
532 if (instance_name == GetNamePath(params->target().name())) | 532 if (instance_name == GetNamePath(params->target().name()) && |
| 533 resolved_instance != GetNamePath(resolved_name)) { |
533 instance_name = resolved_instance; | 534 instance_name = resolved_instance; |
| 535 } |
534 Identity target(params->target().name(), params->target().user_id(), | 536 Identity target(params->target().name(), params->target().user_id(), |
535 instance_name); | 537 instance_name); |
536 params->set_target(target); | 538 params->set_target(target); |
537 | 539 |
538 // It's possible that when this manifest request was issued, another one was | 540 // It's possible that when this manifest request was issued, another one was |
539 // already in-progress and completed by the time this one did, and so the | 541 // already in-progress and completed by the time this one did, and so the |
540 // requested application may already be running. | 542 // requested application may already be running. |
541 if (ConnectToExistingInstance(¶ms)) | 543 if (ConnectToExistingInstance(¶ms)) |
542 return; | 544 return; |
543 | 545 |
(...skipping 11 matching lines...) Expand all Loading... |
555 if (LoadWithLoader(target, &request)) | 557 if (LoadWithLoader(target, &request)) |
556 return; | 558 return; |
557 | 559 |
558 CHECK(!file_url.is_null() && !base_filter.is_null()); | 560 CHECK(!file_url.is_null() && !base_filter.is_null()); |
559 | 561 |
560 if (target.name() != resolved_name) { | 562 if (target.name() != resolved_name) { |
561 // In cases where a package alias is resolved, we have to use the instance | 563 // In cases where a package alias is resolved, we have to use the instance |
562 // from the original request rather than for the package itself, which will | 564 // from the original request rather than for the package itself, which will |
563 // always be the same. | 565 // always be the same. |
564 CreateShellClient( | 566 CreateShellClient( |
565 source, Identity(resolved_name, target.user_id(), resolved_instance), | 567 source, Identity(resolved_name, target.user_id(), instance_name), |
566 target.name(), std::move(request)); | 568 target.name(), std::move(request)); |
567 } else { | 569 } else { |
568 bool start_sandboxed = false; | 570 bool start_sandboxed = false; |
569 native_runners_.push_back( | 571 native_runners_.push_back( |
570 instance->StartWithFileURL(file_url.To<GURL>(), std::move(request), | 572 instance->StartWithFileURL(file_url.To<GURL>(), std::move(request), |
571 start_sandboxed, | 573 start_sandboxed, |
572 native_runner_factory_.get())); | 574 native_runner_factory_.get())); |
573 } | 575 } |
574 } | 576 } |
575 | 577 |
(...skipping 17 matching lines...) Expand all Loading... |
593 for (auto it = native_runners_.begin(); it != native_runners_.end(); ++it) { | 595 for (auto it = native_runners_.begin(); it != native_runners_.end(); ++it) { |
594 if (it->get() == runner) { | 596 if (it->get() == runner) { |
595 native_runners_.erase(it); | 597 native_runners_.erase(it); |
596 return; | 598 return; |
597 } | 599 } |
598 } | 600 } |
599 } | 601 } |
600 | 602 |
601 } // namespace shell | 603 } // namespace shell |
602 } // namespace mojo | 604 } // namespace mojo |
OLD | NEW |