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