OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef COMPONENTS_NACL_RENDERER_JSON_MANIFEST_H | |
6 #define COMPONENTS_NACL_RENDERER_JSON_MANIFEST_H | |
7 | |
8 #include <set> | |
9 #include <string> | |
bbudge
2014/05/01 23:32:33
Blank line after this.
teravest
2014/05/02 14:23:15
Done.
| |
10 #include "ppapi/c/pp_array_output.h" | |
11 #include "ppapi/c/private/ppb_nacl_private.h" | |
12 #include "third_party/jsoncpp/source/include/json/value.h" | |
13 | |
14 namespace nacl { | |
15 class NexeLoadManager; | |
16 | |
17 class JsonManifest { | |
18 public: | |
19 struct ErrorInfo { | |
20 PP_NaClError error; | |
21 std::string string; | |
22 }; | |
23 | |
24 JsonManifest(const std::string& manifest_base_url, | |
25 const std::string& sandbox_isa, | |
26 bool nonsfi_enabled, | |
27 bool pnacl_debug); | |
28 | |
29 // Initialize the manifest object for use by later lookups. The return | |
30 // value is true if the manifest parses correctly and matches the schema. | |
31 bool Init(const std::string& json_manifest, | |
32 ErrorInfo* error_info); | |
bbudge
2014/05/01 23:32:33
Is this from clang format? Seems like it would fit
teravest
2014/05/02 14:23:15
Joined to one line, and changed to use your commen
| |
33 | |
34 // Gets the full program URL for the current sandbox ISA from the | |
35 // manifest file. | |
36 bool GetProgramURL(std::string* full_url, | |
37 PP_PNaClOptions* pnacl_options, | |
38 bool* uses_nonsfi_mode, | |
39 ErrorInfo* error_info) const; | |
40 | |
41 // Resolves a key from the "files" section to a fully resolved URL, | |
42 // i.e., relative URL values are fully expanded relative to the | |
43 // manifest's URL (via ResolveURL). | |
44 // If there was an error, details are reported via error_info. | |
45 bool ResolveKey(const std::string& key, | |
46 std::string* full_url, | |
47 PP_PNaClOptions* pnacl_options) const; | |
48 | |
49 private: | |
50 bool MatchesSchema(ErrorInfo* error_info); | |
51 bool GetKeyUrl(const Json::Value& dictionary, | |
52 const std::string& key, | |
53 std::string* full_url, | |
54 PP_PNaClOptions* pnacl_options) const; | |
55 bool GetURLFromISADictionary(const Json::Value& dictionary, | |
56 const std::string& parent_key, | |
57 std::string* url, | |
58 PP_PNaClOptions* pnacl_options, | |
59 bool* uses_nonsfi_mode, | |
60 ErrorInfo* error_info) const; | |
61 | |
62 std::string manifest_base_url_; | |
63 std::string sandbox_isa_; | |
64 bool nonsfi_enabled_; | |
65 bool pnacl_debug_; | |
66 | |
67 // The dictionary of manifest information parsed in Init(). | |
68 Json::Value dictionary_; | |
69 }; | |
70 | |
71 } // namespace nacl | |
72 | |
73 #endif // COMPONENTS_NACL_RENDERER_JSON_MANIFEST_H | |
OLD | NEW |