Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(117)

Side by Side Diff: ppapi/native_client/src/trusted/plugin/json_manifest.h

Issue 235983020: Pepper: Move PnaclOptions outside trusted plugin. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: another build fix Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_
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 "ppapi/native_client/src/trusted/plugin/manifest.h" 18 #include "ppapi/native_client/src/trusted/plugin/manifest.h"
19 #include "third_party/jsoncpp/source/include/json/value.h" 19 #include "third_party/jsoncpp/source/include/json/value.h"
20 20
21 struct PP_PNaClOptions;
22
21 namespace pp { 23 namespace pp {
22 class URLUtil_Dev; 24 class URLUtil_Dev;
23 } // namespace pp 25 } // namespace pp
24 26
25 namespace plugin { 27 namespace plugin {
26 28
27 class ErrorInfo; 29 class ErrorInfo;
28 class PnaclOptions;
29 30
30 class JsonManifest : public Manifest { 31 class JsonManifest : public Manifest {
31 public: 32 public:
32 JsonManifest(const pp::URLUtil_Dev* url_util, 33 JsonManifest(const pp::URLUtil_Dev* url_util,
33 const nacl::string& manifest_base_url, 34 const nacl::string& manifest_base_url,
34 const nacl::string& sandbox_isa, 35 const nacl::string& sandbox_isa,
35 bool nonsfi_enabled, 36 bool nonsfi_enabled,
36 bool pnacl_debug) 37 bool pnacl_debug)
37 : url_util_(url_util), 38 : url_util_(url_util),
38 manifest_base_url_(manifest_base_url), 39 manifest_base_url_(manifest_base_url),
39 sandbox_isa_(sandbox_isa), 40 sandbox_isa_(sandbox_isa),
40 nonsfi_enabled_(nonsfi_enabled), 41 nonsfi_enabled_(nonsfi_enabled),
41 pnacl_debug_(pnacl_debug), 42 pnacl_debug_(pnacl_debug),
42 dictionary_(Json::nullValue) { } 43 dictionary_(Json::nullValue) { }
43 virtual ~JsonManifest() { } 44 virtual ~JsonManifest() { }
44 45
45 // Initialize the manifest object for use by later lookups. The return 46 // Initialize the manifest object for use by later lookups. The return
46 // value is true if the manifest parses correctly and matches the schema. 47 // value is true if the manifest parses correctly and matches the schema.
47 bool Init(const nacl::string& json, ErrorInfo* error_info); 48 bool Init(const nacl::string& json, ErrorInfo* error_info);
48 49
49 // Gets the full program URL for the current sandbox ISA from the 50 // Gets the full program URL for the current sandbox ISA from the
50 // manifest file. 51 // manifest file.
51 virtual bool GetProgramURL(nacl::string* full_url, 52 virtual bool GetProgramURL(nacl::string* full_url,
52 PnaclOptions* pnacl_options, 53 PP_PNaClOptions* pnacl_options,
53 bool* uses_nonsfi_mode, 54 bool* uses_nonsfi_mode,
54 ErrorInfo* error_info) const; 55 ErrorInfo* error_info) const;
55 56
56 // Gets the file names from the "files" section of the manifest. No 57 // Gets the file names from the "files" section of the manifest. No
57 // checking that the keys' values are proper ISA dictionaries -- it 58 // checking that the keys' values are proper ISA dictionaries -- it
58 // is assumed that other consistency checks take care of that, and 59 // is assumed that other consistency checks take care of that, and
59 // that the keys are appropriate for use with ResolveKey. 60 // that the keys are appropriate for use with ResolveKey.
60 virtual bool GetFileKeys(std::set<nacl::string>* keys) const; 61 virtual bool GetFileKeys(std::set<nacl::string>* keys) const;
61 62
62 // Resolves a key from the "files" section to a fully resolved URL, 63 // Resolves a key from the "files" section to a fully resolved URL,
63 // i.e., relative URL values are fully expanded relative to the 64 // i.e., relative URL values are fully expanded relative to the
64 // manifest's URL (via ResolveURL). 65 // manifest's URL (via ResolveURL).
65 // If there was an error, details are reported via error_info. 66 // If there was an error, details are reported via error_info.
66 virtual bool ResolveKey(const nacl::string& key, 67 virtual bool ResolveKey(const nacl::string& key,
67 nacl::string* full_url, 68 nacl::string* full_url,
68 PnaclOptions* pnacl_options, 69 PP_PNaClOptions* pnacl_options,
69 ErrorInfo* error_info) const; 70 ErrorInfo* error_info) const;
70 71
71 private: 72 private:
72 NACL_DISALLOW_COPY_AND_ASSIGN(JsonManifest); 73 NACL_DISALLOW_COPY_AND_ASSIGN(JsonManifest);
73 74
74 // Resolves a URL relative to the manifest base URL 75 // Resolves a URL relative to the manifest base URL
75 bool ResolveURL(const nacl::string& relative_url, 76 bool ResolveURL(const nacl::string& relative_url,
76 nacl::string* full_url, 77 nacl::string* full_url,
77 ErrorInfo* error_info) const; 78 ErrorInfo* error_info) const;
78 79
79 // Checks that |dictionary_| is a valid manifest, according to the schema. 80 // Checks that |dictionary_| is a valid manifest, according to the schema.
80 // Returns true on success, and sets |error_info| to a detailed message 81 // Returns true on success, and sets |error_info| to a detailed message
81 // if not. 82 // if not.
82 bool MatchesSchema(ErrorInfo* error_info); 83 bool MatchesSchema(ErrorInfo* error_info);
83 84
84 bool GetKeyUrl(const Json::Value& dictionary, 85 bool GetKeyUrl(const Json::Value& dictionary,
85 const nacl::string& key, 86 const nacl::string& key,
86 nacl::string* full_url, 87 nacl::string* full_url,
87 PnaclOptions* pnacl_options, 88 PP_PNaClOptions* pnacl_options,
88 ErrorInfo* error_info) const; 89 ErrorInfo* error_info) const;
89 90
90 bool GetURLFromISADictionary(const Json::Value& dictionary, 91 bool GetURLFromISADictionary(const Json::Value& dictionary,
91 const nacl::string& parent_key, 92 const nacl::string& parent_key,
92 nacl::string* url, 93 nacl::string* url,
93 PnaclOptions* pnacl_options, 94 PP_PNaClOptions* pnacl_options,
94 bool* uses_nonsfi_mode, 95 bool* uses_nonsfi_mode,
95 ErrorInfo* error_info) const; 96 ErrorInfo* error_info) const;
96 97
97 const pp::URLUtil_Dev* url_util_; 98 const pp::URLUtil_Dev* url_util_;
98 nacl::string manifest_base_url_; 99 nacl::string manifest_base_url_;
99 nacl::string sandbox_isa_; 100 nacl::string sandbox_isa_;
100 bool nonsfi_enabled_; 101 bool nonsfi_enabled_;
101 bool pnacl_debug_; 102 bool pnacl_debug_;
102 103
103 Json::Value dictionary_; 104 Json::Value dictionary_;
104 }; 105 };
105 106
106 } // namespace plugin 107 } // namespace plugin
107 108
108 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_JSON_MANIFEST_H_ 109 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_JSON_MANIFEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698