OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 PPAPI_PPB_FLASH_FILE_PROXY_H_ | 5 #ifndef PPAPI_PPB_FLASH_FILE_PROXY_H_ |
6 #define PPAPI_PPB_FLASH_FILE_PROXY_H_ | 6 #define PPAPI_PPB_FLASH_FILE_PROXY_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "ipc/ipc_platform_file.h" | 11 #include "ipc/ipc_platform_file.h" |
12 #include "ppapi/c/pp_instance.h" | 12 #include "ppapi/c/pp_instance.h" |
13 #include "ppapi/c/pp_module.h" | 13 #include "ppapi/c/pp_module.h" |
14 #include "ppapi/proxy/interface_proxy.h" | 14 #include "ppapi/proxy/interface_proxy.h" |
15 | 15 |
16 struct PP_FileInfo; | 16 struct PP_FileInfo; |
17 struct PPB_Flash_File_FileRef; | 17 struct PPB_Flash_File_FileRef; |
18 struct PPB_Flash_File_ModuleLocal; | 18 struct PPB_Flash_File_ModuleLocal; |
19 | 19 |
20 namespace ppapi { | 20 namespace ppapi { |
21 | 21 |
22 class HostResource; | 22 class HostResource; |
23 | 23 |
24 namespace proxy { | 24 namespace proxy { |
25 | 25 |
26 struct SerializedDirEntry; | 26 struct SerializedDirEntry; |
27 | 27 |
28 class PPB_Flash_File_ModuleLocal_Proxy : public InterfaceProxy { | 28 class PPB_Flash_File_ModuleLocal_Proxy : public InterfaceProxy { |
29 public: | 29 public: |
30 PPB_Flash_File_ModuleLocal_Proxy(Dispatcher* dispatcher); | 30 PPB_Flash_File_ModuleLocal_Proxy(Dispatcher* dispatcher, |
| 31 const void* target_interface); |
31 virtual ~PPB_Flash_File_ModuleLocal_Proxy(); | 32 virtual ~PPB_Flash_File_ModuleLocal_Proxy(); |
32 | 33 |
33 static const Info* GetInfo(); | 34 static const Info* GetInfo(); |
34 | 35 |
| 36 const PPB_Flash_File_ModuleLocal* ppb_flash_file_module_local_target() const { |
| 37 return static_cast<const PPB_Flash_File_ModuleLocal*>(target_interface()); |
| 38 } |
| 39 |
35 // InterfaceProxy implementation. | 40 // InterfaceProxy implementation. |
36 virtual bool OnMessageReceived(const IPC::Message& msg); | 41 virtual bool OnMessageReceived(const IPC::Message& msg); |
37 | 42 |
38 private: | 43 private: |
39 // Message handlers. | 44 // Message handlers. |
40 void OnMsgOpenFile(PP_Instance instance, | 45 void OnMsgOpenFile(PP_Instance instance, |
41 const std::string& path, | 46 const std::string& path, |
42 int32_t mode, | 47 int32_t mode, |
43 IPC::PlatformFileForTransit* file_handle, | 48 IPC::PlatformFileForTransit* file_handle, |
44 int32_t* result); | 49 int32_t* result); |
45 void OnMsgRenameFile(PP_Instance instance, | 50 void OnMsgRenameFile(PP_Instance instance, |
46 const std::string& path_from, | 51 const std::string& path_from, |
47 const std::string& path_to, | 52 const std::string& path_to, |
48 int32_t* result); | 53 int32_t* result); |
49 void OnMsgDeleteFileOrDir(PP_Instance instance, | 54 void OnMsgDeleteFileOrDir(PP_Instance instance, |
50 const std::string& path, | 55 const std::string& path, |
51 PP_Bool recursive, | 56 PP_Bool recursive, |
52 int32_t* result); | 57 int32_t* result); |
53 void OnMsgCreateDir(PP_Instance instance, | 58 void OnMsgCreateDir(PP_Instance instance, |
54 const std::string& path, | 59 const std::string& path, |
55 int32_t* result); | 60 int32_t* result); |
56 void OnMsgQueryFile(PP_Instance instance, | 61 void OnMsgQueryFile(PP_Instance instance, |
57 const std::string& path, | 62 const std::string& path, |
58 PP_FileInfo* info, | 63 PP_FileInfo* info, |
59 int32_t* result); | 64 int32_t* result); |
60 void OnMsgGetDirContents(PP_Instance instance, | 65 void OnMsgGetDirContents(PP_Instance instance, |
61 const std::string& path, | 66 const std::string& path, |
62 std::vector<SerializedDirEntry>* entries, | 67 std::vector<SerializedDirEntry>* entries, |
63 int32_t* result); | 68 int32_t* result); |
64 | |
65 // When this proxy is in the host side, this value caches the interface | |
66 // pointer so we don't have to retrieve it from the dispatcher each time. | |
67 // In the plugin, this value is always NULL. | |
68 const PPB_Flash_File_ModuleLocal* ppb_flash_file_module_local_impl_; | |
69 | |
70 DISALLOW_COPY_AND_ASSIGN(PPB_Flash_File_ModuleLocal_Proxy); | |
71 }; | 69 }; |
72 | 70 |
73 class PPB_Flash_File_FileRef_Proxy : public InterfaceProxy { | 71 class PPB_Flash_File_FileRef_Proxy : public InterfaceProxy { |
74 public: | 72 public: |
75 PPB_Flash_File_FileRef_Proxy(Dispatcher* dispatcher); | 73 PPB_Flash_File_FileRef_Proxy(Dispatcher* dispatcher, |
| 74 const void* target_interface); |
76 virtual ~PPB_Flash_File_FileRef_Proxy(); | 75 virtual ~PPB_Flash_File_FileRef_Proxy(); |
77 | 76 |
78 static const Info* GetInfo(); | 77 static const Info* GetInfo(); |
79 | 78 |
| 79 const PPB_Flash_File_FileRef* ppb_flash_file_module_local_target() const { |
| 80 return static_cast<const PPB_Flash_File_FileRef*>(target_interface()); |
| 81 } |
| 82 |
80 // InterfaceProxy implementation. | 83 // InterfaceProxy implementation. |
81 virtual bool OnMessageReceived(const IPC::Message& msg); | 84 virtual bool OnMessageReceived(const IPC::Message& msg); |
82 | 85 |
83 private: | 86 private: |
84 // Message handlers. | 87 // Message handlers. |
85 void OnMsgOpenFile(const ppapi::HostResource& host_resource, | 88 void OnMsgOpenFile(const ppapi::HostResource& host_resource, |
86 int32_t mode, | 89 int32_t mode, |
87 IPC::PlatformFileForTransit* file_handle, | 90 IPC::PlatformFileForTransit* file_handle, |
88 int32_t* result); | 91 int32_t* result); |
89 void OnMsgQueryFile(const ppapi::HostResource& host_resource, | 92 void OnMsgQueryFile(const ppapi::HostResource& host_resource, |
90 PP_FileInfo* info, | 93 PP_FileInfo* info, |
91 int32_t* result); | 94 int32_t* result); |
92 | |
93 // When this proxy is in the host side, this value caches the interface | |
94 // pointer so we don't have to retrieve it from the dispatcher each time. | |
95 // In the plugin, this value is always NULL. | |
96 const PPB_Flash_File_FileRef* ppb_flash_file_fileref_impl_; | |
97 | |
98 DISALLOW_COPY_AND_ASSIGN(PPB_Flash_File_FileRef_Proxy); | |
99 }; | 95 }; |
100 | 96 |
101 } // namespace proxy | 97 } // namespace proxy |
102 } // namespace ppapi | 98 } // namespace ppapi |
103 | 99 |
104 #endif // PPAPI_PPB_FLASH_FILE_PROXY_H_ | 100 #endif // PPAPI_PPB_FLASH_FILE_PROXY_H_ |
OLD | NEW |