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
12 #include "components/nacl/renderer/ppb_nacl_private.h"
13 #include "ppapi/c/pp_array_output.h"
14 #include "third_party/jsoncpp/source/include/json/value.h"
18 class NexeLoadManager
;
19 struct NaClResourcePrefetchRequest
;
28 JsonManifest(const std::string
& manifest_base_url
,
29 const std::string
& sandbox_isa
,
33 // Initialize the manifest object for use by later lookups. Returns
34 // true if the manifest parses correctly and matches the schema.
35 bool Init(const std::string
& json_manifest
, ErrorInfo
* error_info
);
37 // Gets the full program URL for the current sandbox ISA from the
39 bool GetProgramURL(std::string
* full_url
,
40 PP_PNaClOptions
* pnacl_options
,
41 bool* uses_nonsfi_mode
,
42 ErrorInfo
* error_info
) const;
44 // Gets all the keys and their URLs in the "files" section that are
46 void GetPrefetchableFiles(
47 std::vector
<NaClResourcePrefetchRequest
>* out_files
) const;
49 // Resolves a key from the "files" section to a fully resolved URL,
50 // i.e., relative URL values are fully expanded relative to the
51 // manifest's URL (via ResolveURL).
52 // If there was an error, details are reported via error_info.
53 bool ResolveKey(const std::string
& key
,
54 std::string
* full_url
,
55 PP_PNaClOptions
* pnacl_options
) const;
58 bool MatchesSchema(ErrorInfo
* error_info
);
59 bool GetKeyUrl(const Json::Value
& dictionary
,
60 const std::string
& key
,
61 std::string
* full_url
,
62 PP_PNaClOptions
* pnacl_options
) const;
63 bool GetURLFromISADictionary(const Json::Value
& dictionary
,
64 const std::string
& parent_key
,
66 PP_PNaClOptions
* pnacl_options
,
67 bool* uses_nonsfi_mode
,
68 ErrorInfo
* error_info
) const;
70 std::string manifest_base_url_
;
71 std::string sandbox_isa_
;
75 // The dictionary of manifest information parsed in Init().
76 Json::Value dictionary_
;
81 #endif // COMPONENTS_NACL_RENDERER_JSON_MANIFEST_H