| 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 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 705 Identity source = params->source(); | 705 Identity source = params->source(); |
| 706 // |capabilities_ptr| can be null when there is no manifest, e.g. for URL | 706 // |capabilities_ptr| can be null when there is no manifest, e.g. for URL |
| 707 // types not resolvable by the resolver. | 707 // types not resolvable by the resolver. |
| 708 CapabilitySpec capabilities = GetPermissiveCapabilities(); | 708 CapabilitySpec capabilities = GetPermissiveCapabilities(); |
| 709 if (!capabilities_ptr.is_null()) | 709 if (!capabilities_ptr.is_null()) |
| 710 capabilities = capabilities_ptr.To<CapabilitySpec>(); | 710 capabilities = capabilities_ptr.To<CapabilitySpec>(); |
| 711 | 711 |
| 712 // Clients that request "all_users" class from the shell are allowed to | 712 // Clients that request "all_users" class from the shell are allowed to |
| 713 // field connection requests from any user. They also run with a synthetic | 713 // field connection requests from any user. They also run with a synthetic |
| 714 // user id generated here. The user id provided via Connect() is ignored. | 714 // user id generated here. The user id provided via Connect() is ignored. |
| 715 // Additionally apps with the "all_users" class are not tied to the lifetime |
| 716 // of the app that connected to them, instead they are owned by the shell. |
| 717 Identity source_identity_for_creation; |
| 715 if (HasClass(capabilities, kCapabilityClass_AllUsers)) { | 718 if (HasClass(capabilities, kCapabilityClass_AllUsers)) { |
| 716 singletons_.insert(target.name()); | 719 singletons_.insert(target.name()); |
| 717 target.set_user_id(base::GenerateGUID()); | 720 target.set_user_id(base::GenerateGUID()); |
| 721 source_identity_for_creation = CreateShellIdentity(); |
| 722 } else { |
| 723 source_identity_for_creation = params->source(); |
| 718 } | 724 } |
| 719 | 725 |
| 720 mojom::ClientProcessConnectionPtr client_process_connection = | 726 mojom::ClientProcessConnectionPtr client_process_connection = |
| 721 params->TakeClientProcessConnection(); | 727 params->TakeClientProcessConnection(); |
| 722 Instance* instance = CreateInstance(params->source(), target, capabilities); | 728 Instance* instance = CreateInstance(source_identity_for_creation, |
| 729 target, capabilities); |
| 723 | 730 |
| 724 // Below are various paths through which a new Instance can be bound to a | 731 // Below are various paths through which a new Instance can be bound to a |
| 725 // ShellClient proxy. | 732 // ShellClient proxy. |
| 726 if (client.is_bound()) { | 733 if (client.is_bound()) { |
| 727 // If a ShellClientPtr was provided, there's no more work to do: someone | 734 // If a ShellClientPtr was provided, there's no more work to do: someone |
| 728 // is already holding a corresponding ShellClientRequest. | 735 // is already holding a corresponding ShellClientRequest. |
| 729 instance->StartWithClient(std::move(client)); | 736 instance->StartWithClient(std::move(client)); |
| 730 } else if (!client_process_connection.is_null()) { | 737 } else if (!client_process_connection.is_null()) { |
| 731 // Likewise if a ClientProcessConnection was given via Connect(), it | 738 // Likewise if a ClientProcessConnection was given via Connect(), it |
| 732 // provides the ShellClient proxy to use. | 739 // provides the ShellClient proxy to use. |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 779 for (auto it = native_runners_.begin(); it != native_runners_.end(); ++it) { | 786 for (auto it = native_runners_.begin(); it != native_runners_.end(); ++it) { |
| 780 if (it->get() == runner) { | 787 if (it->get() == runner) { |
| 781 native_runners_.erase(it); | 788 native_runners_.erase(it); |
| 782 return; | 789 return; |
| 783 } | 790 } |
| 784 } | 791 } |
| 785 } | 792 } |
| 786 | 793 |
| 787 } // namespace shell | 794 } // namespace shell |
| 788 } // namespace mojo | 795 } // namespace mojo |
| OLD | NEW |