OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_FILE_SYSTEM_HOST_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_FILE_SYSTEM_HOST_H_ |
6 #define CONTENT_RENDERER_PEPPER_PEPPER_FILE_SYSTEM_HOST_H_ | 6 #define CONTENT_RENDERER_PEPPER_PEPPER_FILE_SYSTEM_HOST_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
11 #include "ppapi/c/pp_file_info.h" | 11 #include "ppapi/c/pp_file_info.h" |
12 #include "ppapi/host/file_system_registry.h" | |
12 #include "ppapi/host/host_message_context.h" | 13 #include "ppapi/host/host_message_context.h" |
13 #include "ppapi/host/resource_host.h" | 14 #include "ppapi/host/resource_host.h" |
14 | 15 |
15 namespace content { | 16 namespace content { |
16 | 17 |
17 class RendererPpapiHost; | 18 class RendererPpapiHost; |
18 | 19 |
19 class PepperFileSystemHost : | 20 class PepperFileSystemHost : |
20 public ppapi::host::ResourceHost, | 21 public ppapi::host::ResourceHost, |
22 public ppapi::host::FileSystemRegistry::FileSystemPeeker, | |
21 public base::SupportsWeakPtr<PepperFileSystemHost> { | 23 public base::SupportsWeakPtr<PepperFileSystemHost> { |
22 public: | 24 public: |
23 PepperFileSystemHost(RendererPpapiHost* host, | 25 PepperFileSystemHost(RendererPpapiHost* host, |
24 PP_Instance instance, | 26 PP_Instance instance, |
25 PP_Resource resource, | 27 PP_Resource resource, |
26 PP_FileSystemType type); | 28 PP_FileSystemType type); |
27 virtual ~PepperFileSystemHost(); | 29 virtual ~PepperFileSystemHost(); |
28 | 30 |
29 // ppapi::host::ResourceHost override. | 31 // ppapi::host::ResourceHost override. |
30 virtual int32_t OnResourceMessageReceived( | 32 virtual int32_t OnResourceMessageReceived( |
31 const IPC::Message& msg, | 33 const IPC::Message& msg, |
32 ppapi::host::HostMessageContext* context) OVERRIDE; | 34 ppapi::host::HostMessageContext* context) OVERRIDE; |
33 | 35 |
34 // Supports FileRefs direct access on the host side. | 36 // PepperFileSystemRegistry::FileSystemPeeker override. |
35 PP_FileSystemType GetType() const { return type_; } | 37 virtual PP_FileSystemType GetType() const OVERRIDE; |
36 bool IsOpened() const { return opened_; } | 38 virtual bool IsOpened() const OVERRIDE; |
37 GURL GetRootUrl() const { return root_url_; } | 39 virtual const GURL& GetRootUrl() const OVERRIDE; |
38 | 40 |
39 // It's public only to allow PlatformCallbackAdaptor to access. | 41 // It's public only to allow PlatformCallbackAdaptor to access. |
40 void OpenFileSystemReply(int32_t pp_error, | 42 void OpenFileSystemReply(int32_t pp_error, |
41 const GURL& root); | 43 const GURL& root); |
42 | 44 |
43 private: | 45 private: |
44 int32_t OnHostMsgOpen(ppapi::host::HostMessageContext* context, | 46 int32_t OnHostMsgOpen(ppapi::host::HostMessageContext* context, |
45 int64_t expected_size); | 47 int64_t expected_size); |
48 int32_t OnHostMsgInitIsolatedFileSystem( | |
49 ppapi::host::HostMessageContext* context, | |
50 const std::string& root_url); | |
yzshen1
2013/05/02 23:22:01
fsid please.
victorhsieh
2013/05/03 17:26:58
Done.
| |
46 | 51 |
47 RendererPpapiHost* renderer_ppapi_host_; | 52 RendererPpapiHost* renderer_ppapi_host_; |
48 ppapi::host::ReplyMessageContext reply_context_; | 53 ppapi::host::ReplyMessageContext reply_context_; |
49 base::WeakPtrFactory<PepperFileSystemHost> weak_factory_; | 54 base::WeakPtrFactory<PepperFileSystemHost> weak_factory_; |
50 | 55 |
51 PP_FileSystemType type_; | 56 PP_FileSystemType type_; |
52 bool opened_; // whether open is successful. | 57 bool opened_; // whether open is successful. |
53 GURL root_url_; | 58 GURL root_url_; |
54 bool called_open_; // whether open has been called. | 59 bool called_open_; // whether open has been called. |
55 | 60 |
56 DISALLOW_COPY_AND_ASSIGN(PepperFileSystemHost); | 61 DISALLOW_COPY_AND_ASSIGN(PepperFileSystemHost); |
57 }; | 62 }; |
58 | 63 |
59 } // namespace content | 64 } // namespace content |
60 | 65 |
61 #endif // CONTENT_RENDERER_PEPPER_PEPPER_FILE_SYSTEM_HOST_H_ | 66 #endif // CONTENT_RENDERER_PEPPER_PEPPER_FILE_SYSTEM_HOST_H_ |
OLD | NEW |