Chromium Code Reviews| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 46 // 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. |
| 47 bool Init(const nacl::string& json, ErrorInfo* error_info); | 47 bool Init(const nacl::string& json, ErrorInfo* error_info); |
| 48 | 48 |
| 49 // 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 |
| 50 // manifest file. | 50 // manifest file. |
| 51 virtual bool GetProgramURL(nacl::string* full_url, | 51 virtual bool GetProgramURL(nacl::string* full_url, |
| 52 PnaclOptions* pnacl_options, | 52 PnaclOptions* pnacl_options, |
| 53 bool* uses_nonsfi_mode, | 53 bool* uses_nonsfi_mode, |
| 54 ErrorInfo* error_info) const; | 54 ErrorInfo* error_info) const; |
| 55 | 55 |
| 56 // Resolves a URL relative to the manifest base URL | |
| 57 virtual bool ResolveURL(const nacl::string& relative_url, | |
| 58 nacl::string* full_url, | |
| 59 ErrorInfo* error_info) const; | |
| 60 | |
| 61 // Gets the file names from the "files" section of the manifest. No | 56 // Gets the file names from the "files" section of the manifest. No |
| 62 // checking that the keys' values are proper ISA dictionaries -- it | 57 // checking that the keys' values are proper ISA dictionaries -- it |
| 63 // is assumed that other consistency checks take care of that, and | 58 // is assumed that other consistency checks take care of that, and |
| 64 // that the keys are appropriate for use with ResolveKey. | 59 // that the keys are appropriate for use with ResolveKey. |
| 65 virtual bool GetFileKeys(std::set<nacl::string>* keys) const; | 60 virtual bool GetFileKeys(std::set<nacl::string>* keys) const; |
| 66 | 61 |
| 67 // Resolves a key from the "files" section to a fully resolved URL, | 62 // Resolves a key from the "files" section to a fully resolved URL, |
| 68 // i.e., relative URL values are fully expanded relative to the | 63 // i.e., relative URL values are fully expanded relative to the |
| 69 // manifest's URL (via ResolveURL). | 64 // manifest's URL (via ResolveURL). |
| 70 // If there was an error, details are reported via error_info. | 65 // If there was an error, details are reported via error_info. |
| 71 virtual bool ResolveKey(const nacl::string& key, | 66 virtual bool ResolveKey(const nacl::string& key, |
| 72 nacl::string* full_url, | 67 nacl::string* full_url, |
| 73 PnaclOptions* pnacl_options, | 68 PnaclOptions* pnacl_options, |
| 74 ErrorInfo* error_info) const; | 69 ErrorInfo* error_info) const; |
| 75 | 70 |
| 76 private: | 71 private: |
| 77 NACL_DISALLOW_COPY_AND_ASSIGN(JsonManifest); | 72 NACL_DISALLOW_COPY_AND_ASSIGN(JsonManifest); |
| 78 | 73 |
| 74 // Resolves a URL relative to the manifest base URL | |
| 75 bool ResolveURL(const nacl::string& relative_url, | |
| 76 nacl::string* full_url, | |
| 77 ErrorInfo* error_info) const; | |
|
dmichael (off chromium)
2014/04/10 16:48:01
nit: This should probably also be moved in the bod
| |
| 78 | |
| 79 // Checks that |dictionary_| is a valid manifest, according to the schema. | 79 // Checks that |dictionary_| is a valid manifest, according to the schema. |
| 80 // Returns true on success, and sets |error_info| to a detailed message | 80 // Returns true on success, and sets |error_info| to a detailed message |
| 81 // if not. | 81 // if not. |
| 82 bool MatchesSchema(ErrorInfo* error_info); | 82 bool MatchesSchema(ErrorInfo* error_info); |
| 83 | 83 |
| 84 bool GetKeyUrl(const Json::Value& dictionary, | 84 bool GetKeyUrl(const Json::Value& dictionary, |
| 85 const nacl::string& key, | 85 const nacl::string& key, |
| 86 nacl::string* full_url, | 86 nacl::string* full_url, |
| 87 PnaclOptions* pnacl_options, | 87 PnaclOptions* pnacl_options, |
| 88 ErrorInfo* error_info) const; | 88 ErrorInfo* error_info) const; |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 99 nacl::string sandbox_isa_; | 99 nacl::string sandbox_isa_; |
| 100 bool nonsfi_enabled_; | 100 bool nonsfi_enabled_; |
| 101 bool pnacl_debug_; | 101 bool pnacl_debug_; |
| 102 | 102 |
| 103 Json::Value dictionary_; | 103 Json::Value dictionary_; |
| 104 }; | 104 }; |
| 105 | 105 |
| 106 } // namespace plugin | 106 } // namespace plugin |
| 107 | 107 |
| 108 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_JSON_MANIFEST_H_ | 108 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_JSON_MANIFEST_H_ |
| OLD | NEW |