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); | |
32 virtual ~PPB_Flash_File_ModuleLocal_Proxy(); | 31 virtual ~PPB_Flash_File_ModuleLocal_Proxy(); |
33 | 32 |
34 static const Info* GetInfo(); | 33 static const Info* GetInfo(); |
35 | 34 |
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 | |
40 // InterfaceProxy implementation. | 35 // InterfaceProxy implementation. |
41 virtual bool OnMessageReceived(const IPC::Message& msg); | 36 virtual bool OnMessageReceived(const IPC::Message& msg); |
42 | 37 |
43 private: | 38 private: |
44 // Message handlers. | 39 // Message handlers. |
45 void OnMsgOpenFile(PP_Instance instance, | 40 void OnMsgOpenFile(PP_Instance instance, |
46 const std::string& path, | 41 const std::string& path, |
47 int32_t mode, | 42 int32_t mode, |
48 IPC::PlatformFileForTransit* file_handle, | 43 IPC::PlatformFileForTransit* file_handle, |
49 int32_t* result); | 44 int32_t* result); |
50 void OnMsgRenameFile(PP_Instance instance, | 45 void OnMsgRenameFile(PP_Instance instance, |
51 const std::string& path_from, | 46 const std::string& path_from, |
52 const std::string& path_to, | 47 const std::string& path_to, |
53 int32_t* result); | 48 int32_t* result); |
54 void OnMsgDeleteFileOrDir(PP_Instance instance, | 49 void OnMsgDeleteFileOrDir(PP_Instance instance, |
55 const std::string& path, | 50 const std::string& path, |
56 PP_Bool recursive, | 51 PP_Bool recursive, |
57 int32_t* result); | 52 int32_t* result); |
58 void OnMsgCreateDir(PP_Instance instance, | 53 void OnMsgCreateDir(PP_Instance instance, |
59 const std::string& path, | 54 const std::string& path, |
60 int32_t* result); | 55 int32_t* result); |
61 void OnMsgQueryFile(PP_Instance instance, | 56 void OnMsgQueryFile(PP_Instance instance, |
62 const std::string& path, | 57 const std::string& path, |
63 PP_FileInfo* info, | 58 PP_FileInfo* info, |
64 int32_t* result); | 59 int32_t* result); |
65 void OnMsgGetDirContents(PP_Instance instance, | 60 void OnMsgGetDirContents(PP_Instance instance, |
66 const std::string& path, | 61 const std::string& path, |
67 std::vector<SerializedDirEntry>* entries, | 62 std::vector<SerializedDirEntry>* entries, |
68 int32_t* result); | 63 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); |
69 }; | 71 }; |
70 | 72 |
71 class PPB_Flash_File_FileRef_Proxy : public InterfaceProxy { | 73 class PPB_Flash_File_FileRef_Proxy : public InterfaceProxy { |
72 public: | 74 public: |
73 PPB_Flash_File_FileRef_Proxy(Dispatcher* dispatcher, | 75 PPB_Flash_File_FileRef_Proxy(Dispatcher* dispatcher); |
74 const void* target_interface); | |
75 virtual ~PPB_Flash_File_FileRef_Proxy(); | 76 virtual ~PPB_Flash_File_FileRef_Proxy(); |
76 | 77 |
77 static const Info* GetInfo(); | 78 static const Info* GetInfo(); |
78 | 79 |
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 | |
83 // InterfaceProxy implementation. | 80 // InterfaceProxy implementation. |
84 virtual bool OnMessageReceived(const IPC::Message& msg); | 81 virtual bool OnMessageReceived(const IPC::Message& msg); |
85 | 82 |
86 private: | 83 private: |
87 // Message handlers. | 84 // Message handlers. |
88 void OnMsgOpenFile(const ppapi::HostResource& host_resource, | 85 void OnMsgOpenFile(const ppapi::HostResource& host_resource, |
89 int32_t mode, | 86 int32_t mode, |
90 IPC::PlatformFileForTransit* file_handle, | 87 IPC::PlatformFileForTransit* file_handle, |
91 int32_t* result); | 88 int32_t* result); |
92 void OnMsgQueryFile(const ppapi::HostResource& host_resource, | 89 void OnMsgQueryFile(const ppapi::HostResource& host_resource, |
93 PP_FileInfo* info, | 90 PP_FileInfo* info, |
94 int32_t* result); | 91 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); |
95 }; | 99 }; |
96 | 100 |
97 } // namespace proxy | 101 } // namespace proxy |
98 } // namespace ppapi | 102 } // namespace ppapi |
99 | 103 |
100 #endif // PPAPI_PPB_FLASH_FILE_PROXY_H_ | 104 #endif // PPAPI_PPB_FLASH_FILE_PROXY_H_ |
OLD | NEW |