| 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 29 matching lines...) Expand all Loading... |
| 40 virtual ~JsonManifest() { } | 40 virtual ~JsonManifest() { } |
| 41 | 41 |
| 42 // Initialize the manifest object for use by later lookups. The return | 42 // Initialize the manifest object for use by later lookups. The return |
| 43 // value is true if the manifest parses correctly and matches the schema. | 43 // value is true if the manifest parses correctly and matches the schema. |
| 44 bool Init(const nacl::string& json, ErrorInfo* error_info); | 44 bool Init(const nacl::string& json, ErrorInfo* error_info); |
| 45 | 45 |
| 46 // Gets the full program URL for the current sandbox ISA from the | 46 // Gets the full program URL for the current sandbox ISA from the |
| 47 // manifest file. Sets |pnacl_translate| to |true| if the program is | 47 // manifest file. Sets |pnacl_translate| to |true| if the program is |
| 48 // portable bitcode that must be translated. | 48 // portable bitcode that must be translated. |
| 49 virtual bool GetProgramURL(nacl::string* full_url, | 49 virtual bool GetProgramURL(nacl::string* full_url, |
| 50 nacl::string* cache_identity, |
| 50 ErrorInfo* error_info, | 51 ErrorInfo* error_info, |
| 51 bool* pnacl_translate) const; | 52 bool* pnacl_translate) const; |
| 52 | 53 |
| 53 // Resolves a URL relative to the manifest base URL | 54 // Resolves a URL relative to the manifest base URL |
| 54 virtual bool ResolveURL(const nacl::string& relative_url, | 55 virtual bool ResolveURL(const nacl::string& relative_url, |
| 55 nacl::string* full_url, | 56 nacl::string* full_url, |
| 56 ErrorInfo* error_info) const; | 57 ErrorInfo* error_info) const; |
| 57 | 58 |
| 58 // 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 |
| 59 // checking that the keys' values are proper ISA dictionaries -- it | 60 // checking that the keys' values are proper ISA dictionaries -- it |
| 60 // is assumed that other consistency checks take care of that, and | 61 // is assumed that other consistency checks take care of that, and |
| 61 // that the keys are appropriate for use with ResolveKey. | 62 // that the keys are appropriate for use with ResolveKey. |
| 62 virtual bool GetFileKeys(std::set<nacl::string>* keys) const; | 63 virtual bool GetFileKeys(std::set<nacl::string>* keys) const; |
| 63 | 64 |
| 64 // Resolves a key from the "files" section to a fully resolved URL, | 65 // Resolves a key from the "files" section to a fully resolved URL, |
| 65 // i.e., relative URL values are fully expanded relative to the | 66 // i.e., relative URL values are fully expanded relative to the |
| 66 // manifest's URL (via ResolveURL). |pnacl_translate| tells the caller | 67 // manifest's URL (via ResolveURL). |pnacl_translate| tells the caller |
| 67 // whether the resolution requires a pnacl translation step. | 68 // whether the resolution requires a pnacl translation step. |
| 68 // If there was an error, details are reported via error_info. | 69 // If there was an error, details are reported via error_info. |
| 69 virtual bool ResolveKey(const nacl::string& key, | 70 virtual bool ResolveKey(const nacl::string& key, |
| 70 nacl::string* full_url, | 71 nacl::string* full_url, |
| 72 nacl::string* cache_identity, |
| 71 ErrorInfo* error_info, | 73 ErrorInfo* error_info, |
| 72 bool* pnacl_translate) const; | 74 bool* pnacl_translate) const; |
| 73 | 75 |
| 74 private: | 76 private: |
| 75 NACL_DISALLOW_COPY_AND_ASSIGN(JsonManifest); | 77 NACL_DISALLOW_COPY_AND_ASSIGN(JsonManifest); |
| 76 | 78 |
| 77 // Checks that |dictionary_| is a valid manifest, according to the schema. | 79 // Checks that |dictionary_| is a valid manifest, according to the schema. |
| 78 // 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 |
| 79 // if not. | 81 // if not. |
| 80 bool MatchesSchema(ErrorInfo* error_info); | 82 bool MatchesSchema(ErrorInfo* error_info); |
| 81 | 83 |
| 82 const pp::URLUtil_Dev* url_util_; | 84 const pp::URLUtil_Dev* url_util_; |
| 83 nacl::string manifest_base_url_; | 85 nacl::string manifest_base_url_; |
| 84 nacl::string sandbox_isa_; | 86 nacl::string sandbox_isa_; |
| 85 // Determines whether portable programs are chosen in manifest files over | 87 // Determines whether portable programs are chosen in manifest files over |
| 86 // native programs. | 88 // native programs. |
| 87 bool prefer_portable_; | 89 bool prefer_portable_; |
| 88 | 90 |
| 89 Json::Value dictionary_; | 91 Json::Value dictionary_; |
| 90 }; | 92 }; |
| 91 | 93 |
| 92 | 94 |
| 93 } // namespace plugin | 95 } // namespace plugin |
| 94 | 96 |
| 95 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_JSON_MANIFEST_H_ | 97 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_JSON_MANIFEST_H_ |
| OLD | NEW |