| 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 12 matching lines...) Expand all Loading... |
| 23 } // namespace pp | 23 } // namespace pp |
| 24 | 24 |
| 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 : url_util_(url_util), | 36 : url_util_(url_util), |
| 36 manifest_base_url_(manifest_base_url), | 37 manifest_base_url_(manifest_base_url), |
| 37 sandbox_isa_(sandbox_isa), | 38 sandbox_isa_(sandbox_isa), |
| 39 nonsfi_enabled_(nonsfi_enabled), |
| 38 dictionary_(Json::nullValue) { } | 40 dictionary_(Json::nullValue) { } |
| 39 virtual ~JsonManifest() { } | 41 virtual ~JsonManifest() { } |
| 40 | 42 |
| 41 // Initialize the manifest object for use by later lookups. The return | 43 // Initialize the manifest object for use by later lookups. The return |
| 42 // value is true if the manifest parses correctly and matches the schema. | 44 // value is true if the manifest parses correctly and matches the schema. |
| 43 bool Init(const nacl::string& json, ErrorInfo* error_info); | 45 bool Init(const nacl::string& json, ErrorInfo* error_info); |
| 44 | 46 |
| 45 // Gets the full program URL for the current sandbox ISA from the | 47 // Gets the full program URL for the current sandbox ISA from the |
| 46 // manifest file. | 48 // manifest file. |
| 47 virtual bool GetProgramURL(nacl::string* full_url, | 49 virtual bool GetProgramURL(nacl::string* full_url, |
| 48 PnaclOptions* pnacl_options, | 50 PnaclOptions* pnacl_options, |
| 51 bool* nonsfi_enabled, |
| 49 ErrorInfo* error_info) const; | 52 ErrorInfo* error_info) const; |
| 50 | 53 |
| 51 // Resolves a URL relative to the manifest base URL | 54 // Resolves a URL relative to the manifest base URL |
| 52 virtual bool ResolveURL(const nacl::string& relative_url, | 55 virtual bool ResolveURL(const nacl::string& relative_url, |
| 53 nacl::string* full_url, | 56 nacl::string* full_url, |
| 54 ErrorInfo* error_info) const; | 57 ErrorInfo* error_info) const; |
| 55 | 58 |
| 56 // Gets the file names from the "files" section of the manifest. No | 59 // Gets the file names from the "files" section of the manifest. No |
| 57 // checking that the keys' values are proper ISA dictionaries -- it | 60 // checking that the keys' values are proper ISA dictionaries -- it |
| 58 // is assumed that other consistency checks take care of that, and | 61 // is assumed that other consistency checks take care of that, and |
| (...skipping 20 matching lines...) Expand all Loading... |
| 79 bool GetKeyUrl(const Json::Value& dictionary, | 82 bool GetKeyUrl(const Json::Value& dictionary, |
| 80 const nacl::string& key, | 83 const nacl::string& key, |
| 81 nacl::string* full_url, | 84 nacl::string* full_url, |
| 82 PnaclOptions* pnacl_options, | 85 PnaclOptions* pnacl_options, |
| 83 ErrorInfo* error_info) const; | 86 ErrorInfo* error_info) const; |
| 84 | 87 |
| 85 bool GetURLFromISADictionary(const Json::Value& dictionary, | 88 bool GetURLFromISADictionary(const Json::Value& dictionary, |
| 86 const nacl::string& parent_key, | 89 const nacl::string& parent_key, |
| 87 nacl::string* url, | 90 nacl::string* url, |
| 88 PnaclOptions* pnacl_options, | 91 PnaclOptions* pnacl_options, |
| 92 bool* nonsfi_enabled, |
| 89 ErrorInfo* error_info) const; | 93 ErrorInfo* error_info) const; |
| 90 | 94 |
| 91 const pp::URLUtil_Dev* url_util_; | 95 const pp::URLUtil_Dev* url_util_; |
| 92 nacl::string manifest_base_url_; | 96 nacl::string manifest_base_url_; |
| 93 nacl::string sandbox_isa_; | 97 nacl::string sandbox_isa_; |
| 98 bool nonsfi_enabled_; |
| 94 | 99 |
| 95 Json::Value dictionary_; | 100 Json::Value dictionary_; |
| 96 }; | 101 }; |
| 97 | 102 |
| 98 | |
| 99 } // namespace plugin | 103 } // namespace plugin |
| 100 | 104 |
| 101 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_JSON_MANIFEST_H_ | 105 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_JSON_MANIFEST_H_ |
| OLD | NEW |