| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 * Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
| 4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 // Manifest processing for JSON manifests. | 7 // Manifest processing for JSON manifests. |
| 8 | 8 |
| 9 #ifndef NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_JSON_MANIFEST_H_ | 9 #ifndef NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_JSON_MANIFEST_H_ |
| 10 #define NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_JSON_MANIFEST_H_ | 10 #define NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_JSON_MANIFEST_H_ |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 namespace plugin { | 25 namespace plugin { |
| 26 | 26 |
| 27 class ErrorInfo; | 27 class ErrorInfo; |
| 28 class PnaclOptions; | 28 class PnaclOptions; |
| 29 | 29 |
| 30 class JsonManifest : public Manifest { | 30 class JsonManifest : public Manifest { |
| 31 public: | 31 public: |
| 32 JsonManifest(const pp::URLUtil_Dev* url_util, | 32 JsonManifest(const pp::URLUtil_Dev* url_util, |
| 33 const nacl::string& manifest_base_url, | 33 const nacl::string& manifest_base_url, |
| 34 const nacl::string& sandbox_isa, | 34 const nacl::string& sandbox_isa, |
| 35 bool nonsfi_enabled, |
| 35 bool pnacl_debug) | 36 bool pnacl_debug) |
| 36 : url_util_(url_util), | 37 : url_util_(url_util), |
| 37 manifest_base_url_(manifest_base_url), | 38 manifest_base_url_(manifest_base_url), |
| 38 sandbox_isa_(sandbox_isa), | 39 sandbox_isa_(sandbox_isa), |
| 40 nonsfi_enabled_(nonsfi_enabled), |
| 39 dictionary_(Json::nullValue), | 41 dictionary_(Json::nullValue), |
| 40 pnacl_debug_(pnacl_debug) { } | 42 pnacl_debug_(pnacl_debug) { } |
| 41 virtual ~JsonManifest() { } | 43 virtual ~JsonManifest() { } |
| 42 | 44 |
| 43 // Initialize the manifest object for use by later lookups. The return | 45 // Initialize the manifest object for use by later lookups. The return |
| 44 // value is true if the manifest parses correctly and matches the schema. | 46 // value is true if the manifest parses correctly and matches the schema. |
| 45 bool Init(const nacl::string& json, ErrorInfo* error_info); | 47 bool Init(const nacl::string& json, ErrorInfo* error_info); |
| 46 | 48 |
| 47 // Gets the full program URL for the current sandbox ISA from the | 49 // Gets the full program URL for the current sandbox ISA from the |
| 48 // manifest file. | 50 // manifest file. |
| 49 virtual bool GetProgramURL(nacl::string* full_url, | 51 virtual bool GetProgramURL(nacl::string* full_url, |
| 50 PnaclOptions* pnacl_options, | 52 PnaclOptions* pnacl_options, |
| 53 bool* uses_nonsfi_mode, |
| 51 ErrorInfo* error_info) const; | 54 ErrorInfo* error_info) const; |
| 52 | 55 |
| 53 // Resolves a URL relative to the manifest base URL | 56 // Resolves a URL relative to the manifest base URL |
| 54 virtual bool ResolveURL(const nacl::string& relative_url, | 57 virtual bool ResolveURL(const nacl::string& relative_url, |
| 55 nacl::string* full_url, | 58 nacl::string* full_url, |
| 56 ErrorInfo* error_info) const; | 59 ErrorInfo* error_info) const; |
| 57 | 60 |
| 58 // Gets the file names from the "files" section of the manifest. No | 61 // Gets the file names from the "files" section of the manifest. No |
| 59 // checking that the keys' values are proper ISA dictionaries -- it | 62 // checking that the keys' values are proper ISA dictionaries -- it |
| 60 // is assumed that other consistency checks take care of that, and | 63 // is assumed that other consistency checks take care of that, and |
| (...skipping 20 matching lines...) Expand all Loading... |
| 81 bool GetKeyUrl(const Json::Value& dictionary, | 84 bool GetKeyUrl(const Json::Value& dictionary, |
| 82 const nacl::string& key, | 85 const nacl::string& key, |
| 83 nacl::string* full_url, | 86 nacl::string* full_url, |
| 84 PnaclOptions* pnacl_options, | 87 PnaclOptions* pnacl_options, |
| 85 ErrorInfo* error_info) const; | 88 ErrorInfo* error_info) const; |
| 86 | 89 |
| 87 bool GetURLFromISADictionary(const Json::Value& dictionary, | 90 bool GetURLFromISADictionary(const Json::Value& dictionary, |
| 88 const nacl::string& parent_key, | 91 const nacl::string& parent_key, |
| 89 nacl::string* url, | 92 nacl::string* url, |
| 90 PnaclOptions* pnacl_options, | 93 PnaclOptions* pnacl_options, |
| 94 bool* uses_nonsfi_mode, |
| 91 ErrorInfo* error_info) const; | 95 ErrorInfo* error_info) const; |
| 92 | 96 |
| 93 const pp::URLUtil_Dev* url_util_; | 97 const pp::URLUtil_Dev* url_util_; |
| 94 nacl::string manifest_base_url_; | 98 nacl::string manifest_base_url_; |
| 95 nacl::string sandbox_isa_; | 99 nacl::string sandbox_isa_; |
| 100 bool nonsfi_enabled_; |
| 96 | 101 |
| 97 Json::Value dictionary_; | 102 Json::Value dictionary_; |
| 98 bool pnacl_debug_; // Search for a pnacl-debug entry. | 103 bool pnacl_debug_; // Search for a pnacl-debug entry. |
| 99 }; | 104 }; |
| 100 | 105 |
| 101 | |
| 102 } // namespace plugin | 106 } // namespace plugin |
| 103 | 107 |
| 104 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_JSON_MANIFEST_H_ | 108 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_JSON_MANIFEST_H_ |
| OLD | NEW |