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

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

Issue 264943003: Pepper: Move manifest logic to components/nacl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix typo Created 6 years, 7 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
(Empty)
1 /*
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
4 * found in the LICENSE file.
5 */
6
7 // Manifest processing for JSON manifests.
8
9 #ifndef NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_JSON_MANIFEST_H_
10 #define NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_JSON_MANIFEST_H_
11
12 #include <map>
13 #include <set>
14 #include <string>
15
16 #include "native_client/src/include/nacl_macros.h"
17 #include "native_client/src/include/nacl_string.h"
18 #include "ppapi/native_client/src/trusted/plugin/manifest.h"
19 #include "third_party/jsoncpp/source/include/json/value.h"
20
21 struct PP_PNaClOptions;
22
23 namespace pp {
24 class URLUtil_Dev;
25 } // namespace pp
26
27 namespace plugin {
28
29 class ErrorInfo;
30
31 class JsonManifest : public Manifest {
32 public:
33 JsonManifest(const pp::URLUtil_Dev* url_util,
34 const nacl::string& manifest_base_url,
35 const nacl::string& sandbox_isa,
36 bool nonsfi_enabled,
37 bool pnacl_debug)
38 : url_util_(url_util),
39 manifest_base_url_(manifest_base_url),
40 sandbox_isa_(sandbox_isa),
41 nonsfi_enabled_(nonsfi_enabled),
42 pnacl_debug_(pnacl_debug),
43 dictionary_(Json::nullValue) { }
44 virtual ~JsonManifest() { }
45
46 // Initialize the manifest object for use by later lookups. The return
47 // value is true if the manifest parses correctly and matches the schema.
48 bool Init(const nacl::string& json, ErrorInfo* error_info);
49
50 // Gets the full program URL for the current sandbox ISA from the
51 // manifest file.
52 virtual bool GetProgramURL(nacl::string* full_url,
53 PP_PNaClOptions* pnacl_options,
54 bool* uses_nonsfi_mode,
55 ErrorInfo* error_info) const;
56
57 // Resolves a key from the "files" section to a fully resolved URL,
58 // i.e., relative URL values are fully expanded relative to the
59 // manifest's URL (via ResolveURL).
60 virtual bool ResolveKey(const nacl::string& key,
61 nacl::string* full_url,
62 PP_PNaClOptions* pnacl_options) const;
63
64 private:
65 NACL_DISALLOW_COPY_AND_ASSIGN(JsonManifest);
66
67 // Resolves a URL relative to the manifest base URL
68 bool ResolveURL(const nacl::string& relative_url,
69 nacl::string* full_url,
70 ErrorInfo* error_info) const;
71
72 // Checks that |dictionary_| is a valid manifest, according to the schema.
73 // Returns true on success, and sets |error_info| to a detailed message
74 // if not.
75 bool MatchesSchema(ErrorInfo* error_info);
76
77 bool GetKeyUrl(const Json::Value& dictionary,
78 const nacl::string& key,
79 nacl::string* full_url,
80 PP_PNaClOptions* pnacl_options) const;
81
82 bool GetURLFromISADictionary(const Json::Value& dictionary,
83 const nacl::string& parent_key,
84 nacl::string* url,
85 PP_PNaClOptions* pnacl_options,
86 bool* uses_nonsfi_mode,
87 ErrorInfo* error_info) const;
88
89 const pp::URLUtil_Dev* url_util_;
90 nacl::string manifest_base_url_;
91 nacl::string sandbox_isa_;
92 bool nonsfi_enabled_;
93 bool pnacl_debug_;
94
95 Json::Value dictionary_;
96 };
97
98 } // namespace plugin
99
100 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_JSON_MANIFEST_H_
OLDNEW
« no previous file with comments | « ppapi/c/private/ppb_nacl_private.h ('k') | ppapi/native_client/src/trusted/plugin/json_manifest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698