| 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 interface class. | 7 // Manifest interface class. |
| 8 | 8 |
| 9 #ifndef NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_MANIFEST_H_ | 9 #ifndef NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_MANIFEST_H_ |
| 10 #define NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_MANIFEST_H_ | 10 #define NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_MANIFEST_H_ |
| 11 | 11 |
| 12 #include <map> | 12 #include <map> |
| 13 #include <set> | 13 #include <set> |
| 14 #include <string> | 14 #include <string> |
| 15 | 15 |
| 16 #include "native_client/src/include/nacl_macros.h" | 16 #include "native_client/src/include/nacl_macros.h" |
| 17 #include "native_client/src/include/nacl_string.h" | 17 #include "native_client/src/include/nacl_string.h" |
| 18 #include "third_party/jsoncpp/source/include/json/value.h" | 18 #include "third_party/jsoncpp/source/include/json/value.h" |
| 19 | 19 |
| 20 namespace pp { | 20 namespace pp { |
| 21 class URLUtil_Dev; | 21 class URLUtil_Dev; |
| 22 } // namespace pp | 22 } // namespace pp |
| 23 | 23 |
| 24 namespace plugin { | 24 namespace plugin { |
| 25 | 25 |
| 26 class ErrorInfo; | 26 class ErrorInfo; |
| 27 class PnaclOptions; |
| 27 | 28 |
| 28 class Manifest { | 29 class Manifest { |
| 29 public: | 30 public: |
| 30 Manifest() { } | 31 Manifest() { } |
| 31 virtual ~Manifest() { } | 32 virtual ~Manifest() { } |
| 32 | 33 |
| 33 // A convention in the interfaces below regarding permit_extension_url: | 34 // A convention in the interfaces below regarding permit_extension_url: |
| 34 // Some manifests (e.g., the pnacl coordinator manifest) need to access | 35 // Some manifests (e.g., the pnacl coordinator manifest) need to access |
| 35 // resources from an extension origin distinct from the plugin's origin | 36 // resources from an extension origin distinct from the plugin's origin |
| 36 // (e.g., the pnacl coordinator needs to load llc, ld, and some libraries). | 37 // (e.g., the pnacl coordinator needs to load llc, ld, and some libraries). |
| 37 // This out-parameter is true if this manifest lookup confers access to | 38 // This out-parameter is true if this manifest lookup confers access to |
| 38 // a resource in the extension origin. | 39 // a resource in the extension origin. |
| 39 | 40 |
| 40 // Gets the full program URL for the current sandbox ISA from the | 41 // Gets the full program URL for the current sandbox ISA from the |
| 41 // manifest file. Sets |pnacl_translate| to |true| if the program is | 42 // manifest file. Fills in |pnacl_options| if the program requires |
| 42 // requires pnacl translation. | 43 // PNaCl translation. |
| 43 virtual bool GetProgramURL(nacl::string* full_url, | 44 virtual bool GetProgramURL(nacl::string* full_url, |
| 44 nacl::string* cache_identity, | 45 PnaclOptions* pnacl_options, |
| 45 ErrorInfo* error_info, | 46 ErrorInfo* error_info) const = 0; |
| 46 bool* pnacl_translate) const = 0; | |
| 47 | 47 |
| 48 // Resolves a URL relative to the manifest base URL | 48 // Resolves a URL relative to the manifest base URL |
| 49 virtual bool ResolveURL(const nacl::string& relative_url, | 49 virtual bool ResolveURL(const nacl::string& relative_url, |
| 50 nacl::string* full_url, | 50 nacl::string* full_url, |
| 51 ErrorInfo* error_info) const = 0; | 51 ErrorInfo* error_info) const = 0; |
| 52 | 52 |
| 53 // Gets the file names from the "files" section of the manifest. No | 53 // Gets the file names from the "files" section of the manifest. No |
| 54 // checking that the keys' values are proper ISA dictionaries -- it | 54 // checking that the keys' values are proper ISA dictionaries -- it |
| 55 // is assumed that other consistency checks take care of that, and | 55 // is assumed that other consistency checks take care of that, and |
| 56 // that the keys are appropriate for use with ResolveKey. | 56 // that the keys are appropriate for use with ResolveKey. |
| 57 virtual bool GetFileKeys(std::set<nacl::string>* keys) const = 0; | 57 virtual bool GetFileKeys(std::set<nacl::string>* keys) const = 0; |
| 58 | 58 |
| 59 // Resolves a key from the "files" section to a fully resolved URL, | 59 // Resolves a key from the "files" section to a fully resolved URL, |
| 60 // i.e., relative URL values are fully expanded relative to the | 60 // i.e., relative URL values are fully expanded relative to the |
| 61 // manifest's URL (via ResolveURL). |pnacl_translate| tells | 61 // manifest's URL (via ResolveURL). Fills in |pnacl_options| if |
| 62 // the caller whether the resolution requires a pnacl translation step. | 62 // the resolved key requires a pnacl translation step to obtain |
| 63 // the final requested resource. |
| 63 // If there was an error, details are reported via error_info. | 64 // If there was an error, details are reported via error_info. |
| 64 virtual bool ResolveKey(const nacl::string& key, | 65 virtual bool ResolveKey(const nacl::string& key, |
| 65 nacl::string* full_url, | 66 nacl::string* full_url, |
| 66 nacl::string* cache_identity, | 67 PnaclOptions* pnacl_options, |
| 67 ErrorInfo* error_info, | 68 ErrorInfo* error_info) const = 0; |
| 68 bool* pnacl_translate) const = 0; | |
| 69 | 69 |
| 70 protected: | 70 protected: |
| 71 NACL_DISALLOW_COPY_AND_ASSIGN(Manifest); | 71 NACL_DISALLOW_COPY_AND_ASSIGN(Manifest); |
| 72 }; | 72 }; |
| 73 | 73 |
| 74 | 74 |
| 75 } // namespace plugin | 75 } // namespace plugin |
| 76 | 76 |
| 77 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_MANIFEST_H_ | 77 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_MANIFEST_H_ |
| OLD | NEW |