1 // Copyright (c) 2012 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_PLUGIN_PNACL_RESOURCES_H_
6 #define COMPONENTS_NACL_RENDERER_PLUGIN_PNACL_RESOURCES_H_
8 #include "components/nacl/renderer/ppb_nacl_private.h"
9 #include "native_client/src/include/nacl_macros.h"
10 #include "native_client/src/trusted/desc/nacl_desc_wrapper.h"
11 #include "ppapi/cpp/completion_callback.h"
17 // PNaCl tool files / resources, which are opened by the browser.
18 struct PnaclResourceEntry
{
19 // The name of the tool that corresponds to the opened file.
20 std::string tool_name
;
22 // File info for the executables, after they've been opened.
23 // Only valid after StartLoad() has been called, and until
24 // TakeFileInfo(ResourceType) is called.
25 PP_NaClFileInfo file_info
;
28 // Loads a list of resources, providing a way to get file descriptors for
29 // these resources. URLs for resources are resolved by the manifest
30 // and point to PNaCl component filesystem resources.
31 class PnaclResources
{
33 PnaclResources(Plugin
* plugin
, bool use_subzero
);
34 virtual ~PnaclResources();
36 // Read the resource info JSON file. This is the first step after
37 // construction; it has to be completed before StartLoad is called.
38 bool ReadResourceInfo();
40 // Start loading the resources.
43 enum ResourceType
{ LLC
, LD
, SUBZERO
, NUM_TYPES
};
45 const std::string
& GetUrl(ResourceType type
) const;
47 PP_NaClFileInfo
TakeFileInfo(ResourceType type
);
50 NACL_DISALLOW_COPY_AND_ASSIGN(PnaclResources
);
52 // The plugin requesting the resource loading.
56 PnaclResourceEntry resources_
[NUM_TYPES
+ 1];
60 #endif // COMPONENTS_NACL_RENDERER_PLUGIN_PNACL_RESOURCES_H_