OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/nacl/renderer/ppb_nacl_private_impl.h" | 5 #include "components/nacl/renderer/ppb_nacl_private_impl.h" |
6 | 6 |
7 #include <numeric> | 7 #include <numeric> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1100 | 1100 |
1101 bool ManifestResolveKey(PP_Instance instance, | 1101 bool ManifestResolveKey(PP_Instance instance, |
1102 bool is_helper_process, | 1102 bool is_helper_process, |
1103 const std::string& key, | 1103 const std::string& key, |
1104 std::string* full_url, | 1104 std::string* full_url, |
1105 PP_PNaClOptions* pnacl_options) { | 1105 PP_PNaClOptions* pnacl_options) { |
1106 // For "helper" processes (llc and ld, for PNaCl translation), we resolve | 1106 // For "helper" processes (llc and ld, for PNaCl translation), we resolve |
1107 // keys manually as there is no existing .nmf file to parse. | 1107 // keys manually as there is no existing .nmf file to parse. |
1108 if (is_helper_process) { | 1108 if (is_helper_process) { |
1109 pnacl_options->translate = PP_FALSE; | 1109 pnacl_options->translate = PP_FALSE; |
1110 // We can only resolve keys in the files/ namespace. | |
1111 const std::string kFilesPrefix = "files/"; | |
1112 if (key.find(kFilesPrefix) == std::string::npos) { | |
1113 nacl::NexeLoadManager* load_manager = GetNexeLoadManager(instance); | |
1114 if (load_manager) | |
1115 load_manager->ReportLoadError(PP_NACL_ERROR_MANIFEST_RESOLVE_URL, | |
1116 "key did not start with files/"); | |
1117 return false; | |
1118 } | |
1119 std::string key_basename = key.substr(kFilesPrefix.length()); | |
1120 *full_url = std::string(kPNaClTranslatorBaseUrl) + GetSandboxArch() + "/" + | 1110 *full_url = std::string(kPNaClTranslatorBaseUrl) + GetSandboxArch() + "/" + |
1121 key_basename; | 1111 key; |
1122 return true; | 1112 return true; |
1123 } | 1113 } |
1124 | 1114 |
1125 JsonManifest* manifest = GetJsonManifest(instance); | 1115 JsonManifest* manifest = GetJsonManifest(instance); |
1126 if (manifest == NULL) | 1116 if (manifest == NULL) |
1127 return false; | 1117 return false; |
1128 | 1118 |
1129 return manifest->ResolveKey(key, full_url, pnacl_options); | 1119 return manifest->ResolveKey(key, full_url, pnacl_options); |
1130 } | 1120 } |
1131 | 1121 |
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1737 &StreamPexe | 1727 &StreamPexe |
1738 }; | 1728 }; |
1739 | 1729 |
1740 } // namespace | 1730 } // namespace |
1741 | 1731 |
1742 const PPB_NaCl_Private* GetNaClPrivateInterface() { | 1732 const PPB_NaCl_Private* GetNaClPrivateInterface() { |
1743 return &nacl_interface; | 1733 return &nacl_interface; |
1744 } | 1734 } |
1745 | 1735 |
1746 } // namespace nacl | 1736 } // namespace nacl |
OLD | NEW |