ozone: evdev: Sync caps lock LED state to evdev
[chromium-blink-merge.git] / components / nacl / renderer / json_manifest.h
blobdbe54d5a61abdc9dfa7174fdbaeb1d912e7e8aa1
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.
5 #ifndef COMPONENTS_NACL_RENDERER_JSON_MANIFEST_H
6 #define COMPONENTS_NACL_RENDERER_JSON_MANIFEST_H
8 #include <set>
9 #include <string>
11 #include "components/nacl/renderer/ppb_nacl_private.h"
12 #include "ppapi/c/pp_array_output.h"
13 #include "third_party/jsoncpp/source/include/json/value.h"
15 namespace nacl {
16 class JsonManifest;
17 class NexeLoadManager;
19 class JsonManifest {
20 public:
21 struct ErrorInfo {
22 PP_NaClError error;
23 std::string string;
26 JsonManifest(const std::string& manifest_base_url,
27 const std::string& sandbox_isa,
28 bool nonsfi_enabled,
29 bool pnacl_debug);
31 // Initialize the manifest object for use by later lookups. Returns
32 // true if the manifest parses correctly and matches the schema.
33 bool Init(const std::string& json_manifest, ErrorInfo* error_info);
35 // Gets the full program URL for the current sandbox ISA from the
36 // manifest file.
37 bool GetProgramURL(std::string* full_url,
38 PP_PNaClOptions* pnacl_options,
39 bool* uses_nonsfi_mode,
40 ErrorInfo* error_info) const;
42 // Resolves a key from the "files" section to a fully resolved URL,
43 // i.e., relative URL values are fully expanded relative to the
44 // manifest's URL (via ResolveURL).
45 // If there was an error, details are reported via error_info.
46 bool ResolveKey(const std::string& key,
47 std::string* full_url,
48 PP_PNaClOptions* pnacl_options) const;
50 private:
51 bool MatchesSchema(ErrorInfo* error_info);
52 bool GetKeyUrl(const Json::Value& dictionary,
53 const std::string& key,
54 std::string* full_url,
55 PP_PNaClOptions* pnacl_options) const;
56 bool GetURLFromISADictionary(const Json::Value& dictionary,
57 const std::string& parent_key,
58 std::string* url,
59 PP_PNaClOptions* pnacl_options,
60 bool* uses_nonsfi_mode,
61 ErrorInfo* error_info) const;
63 std::string manifest_base_url_;
64 std::string sandbox_isa_;
65 bool nonsfi_enabled_;
66 bool pnacl_debug_;
68 // The dictionary of manifest information parsed in Init().
69 Json::Value dictionary_;
72 } // namespace nacl
74 #endif // COMPONENTS_NACL_RENDERER_JSON_MANIFEST_H