OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2013 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 // CRX filesystem is a filesystem that allows an extension to read its own | |
6 // package directory tree. See ppapi/examples/crxfs for example. | |
7 // | |
8 // IMPLEMENTATION | |
9 // | |
10 // The implementation involves both browser and renderer. In order to provide | |
11 // readonly access to CRX filesystem (i.e. extension directory), we create an | |
12 // "isolated filesystem" points to currernt extension directory in browser. | |
teravest
2013/04/18 16:10:38
s/currernt/current/
victorhsieh
2013/04/18 19:28:38
Done.
| |
13 // Then browser grants read permission to renderer. | |
14 // | |
15 // The only purpose of renderer is make it accessible by FileRef, which runs in | |
16 // renderer at this time. | |
17 // | |
18 // When the plugin calls PPB_Ext_CrxFileSystem_Private_API.Open, the resource | |
19 // class ExtCrxFileSystemPrivateResource forwards the request to the browser | |
20 // host. Once the browser host successfully create the underlying "isolated | |
21 // filesystem", it replies to the resource with filesystem id and current | |
22 // extension id, which are then sent to renderer host for FileRef to access. | |
23 | |
24 #ifndef PPAPI_PROXY_EXT_CRX_FILE_SYSTEM_PRIVATE_RESOURCE_H_ | |
25 #define PPAPI_PROXY_EXT_CRX_FILE_SYSTEM_PRIVATE_RESOURCE_H_ | |
26 | |
27 #include <string> | |
28 | |
29 #include "base/memory/ref_counted.h" | |
30 #include "ppapi/proxy/connection.h" | |
31 #include "ppapi/proxy/plugin_resource.h" | |
32 #include "ppapi/proxy/ppapi_proxy_export.h" | |
33 #include "ppapi/thunk/ppb_ext_crx_file_system_private_api.h" | |
34 | |
35 namespace ppapi { | |
36 | |
37 class TrackedCallback; | |
38 | |
39 namespace proxy { | |
40 | |
41 class ResourceMessageReplyParams; | |
42 | |
43 class PPAPI_PROXY_EXPORT ExtCrxFileSystemPrivateResource | |
44 : public PluginResource, | |
45 public thunk::PPB_Ext_CrxFileSystem_Private_API { | |
46 public: | |
47 ExtCrxFileSystemPrivateResource(Connection connection, PP_Instance instance); | |
48 virtual ~ExtCrxFileSystemPrivateResource(); | |
49 | |
50 // Resource overrides. | |
51 virtual thunk::PPB_Ext_CrxFileSystem_Private_API* | |
52 AsPPB_Ext_CrxFileSystem_Private_API() OVERRIDE; | |
53 | |
54 // PPB_Ext_CrxFileSystem_Private_API implementation. | |
55 virtual int32_t Open(scoped_refptr<TrackedCallback> callback) OVERRIDE; | |
56 | |
57 private: | |
58 void OnBrowserOpenComplete(scoped_refptr<TrackedCallback> callback, | |
59 const ResourceMessageReplyParams& params, | |
60 const std::string& origin, | |
61 const std::string& fsid); | |
62 void OnRendererOpenComplete(scoped_refptr<TrackedCallback> callback, | |
63 const ResourceMessageReplyParams& params); | |
64 | |
65 DISALLOW_COPY_AND_ASSIGN(ExtCrxFileSystemPrivateResource); | |
66 }; | |
67 | |
68 } // namespace proxy | |
69 } // namespace ppapi | |
70 | |
71 #endif // PPAPI_PROXY_EXT_CRX_FILE_SYSTEM_PRIVATE_RESOURCE_H_ | |
OLD | NEW |