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 // 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 |is_portable| to |true| if the program is | 47 // manifest file. Sets |is_portable| to |true| if the program is |
48 // portable bitcode. | 48 // portable bitcode. |
49 virtual bool GetProgramURL(nacl::string* full_url, | 49 virtual bool GetProgramURL(nacl::string* full_url, |
50 ErrorInfo* error_info, | 50 ErrorInfo* error_info, |
51 bool* is_portable) const; | 51 bool* is_portable) const; |
52 | 52 |
53 // Resolves a URL relative to the manifest base URL | 53 // Resolves a URL relative to the manifest base URL |
54 virtual bool ResolveURL(const nacl::string& relative_url, | 54 virtual bool ResolveURL(const nacl::string& relative_url, |
55 nacl::string* full_url, | 55 nacl::string* full_url, |
56 bool* permit_extension_url, | |
57 ErrorInfo* error_info) const; | 56 ErrorInfo* error_info) const; |
58 | 57 |
59 // Gets the file names from the "files" section of the manifest. No | 58 // Gets the file names from the "files" section of the manifest. No |
60 // checking that the keys' values are proper ISA dictionaries -- it | 59 // checking that the keys' values are proper ISA dictionaries -- it |
61 // is assumed that other consistency checks take care of that, and | 60 // is assumed that other consistency checks take care of that, and |
62 // that the keys are appropriate for use with ResolveKey. | 61 // that the keys are appropriate for use with ResolveKey. |
63 virtual bool GetFileKeys(std::set<nacl::string>* keys) const; | 62 virtual bool GetFileKeys(std::set<nacl::string>* keys) const; |
64 | 63 |
65 // Resolves a key from the "files" section to a fully resolved URL, | 64 // Resolves a key from the "files" section to a fully resolved URL, |
66 // i.e., relative URL values are fully expanded relative to the | 65 // i.e., relative URL values are fully expanded relative to the |
67 // manifest's URL (via ResolveURL). If there was an error, details | 66 // manifest's URL (via ResolveURL). If there was an error, details |
68 // are reported via error_info, and is_portable, if non-NULL, tells | 67 // are reported via error_info, and is_portable, if non-NULL, tells |
69 // the caller whether the resolution used the portable | 68 // the caller whether the resolution used the portable |
70 // representation or an ISA-specific version of the file. | 69 // representation or an ISA-specific version of the file. |
71 virtual bool ResolveKey(const nacl::string& key, | 70 virtual bool ResolveKey(const nacl::string& key, |
72 nacl::string* full_url, | 71 nacl::string* full_url, |
73 bool* permit_extension_url, | |
74 ErrorInfo* error_info, | 72 ErrorInfo* error_info, |
75 bool* is_portable) const; | 73 bool* is_portable) const; |
76 | 74 |
77 private: | 75 private: |
78 NACL_DISALLOW_COPY_AND_ASSIGN(JsonManifest); | 76 NACL_DISALLOW_COPY_AND_ASSIGN(JsonManifest); |
79 | 77 |
80 // Checks that |dictionary_| is a valid manifest, according to the schema. | 78 // Checks that |dictionary_| is a valid manifest, according to the schema. |
81 // Returns true on success, and sets |error_info| to a detailed message | 79 // Returns true on success, and sets |error_info| to a detailed message |
82 // if not. | 80 // if not. |
83 bool MatchesSchema(ErrorInfo* error_info); | 81 bool MatchesSchema(ErrorInfo* error_info); |
84 | 82 |
85 const pp::URLUtil_Dev* url_util_; | 83 const pp::URLUtil_Dev* url_util_; |
86 nacl::string manifest_base_url_; | 84 nacl::string manifest_base_url_; |
87 nacl::string sandbox_isa_; | 85 nacl::string sandbox_isa_; |
88 // Determines whether portable programs are chosen in manifest files over | 86 // Determines whether portable programs are chosen in manifest files over |
89 // native programs. | 87 // native programs. |
90 bool prefer_portable_; | 88 bool prefer_portable_; |
91 | 89 |
92 Json::Value dictionary_; | 90 Json::Value dictionary_; |
93 }; | 91 }; |
94 | 92 |
95 | 93 |
96 } // namespace plugin | 94 } // namespace plugin |
97 | 95 |
98 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_JSON_MANIFEST_H_ | 96 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_JSON_MANIFEST_H_ |
OLD | NEW |