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_PROXY_PPB_FILE_SYSTEM_PROXY_H_ | 5 #ifndef PPAPI_PROXY_PPB_FILE_SYSTEM_PROXY_H_ |
6 #define PPAPI_PROXY_PPB_FILE_SYSTEM_PROXY_H_ | 6 #define PPAPI_PROXY_PPB_FILE_SYSTEM_PROXY_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "ppapi/c/pp_instance.h" | 11 #include "ppapi/c/pp_instance.h" |
12 #include "ppapi/c/pp_resource.h" | 12 #include "ppapi/c/pp_resource.h" |
13 #include "ppapi/c/pp_time.h" | 13 #include "ppapi/c/pp_time.h" |
14 #include "ppapi/c/ppb_file_system.h" | 14 #include "ppapi/c/ppb_file_system.h" |
15 #include "ppapi/cpp/completion_callback.h" | 15 #include "ppapi/cpp/completion_callback.h" |
16 #include "ppapi/proxy/interface_proxy.h" | 16 #include "ppapi/proxy/interface_proxy.h" |
17 #include "ppapi/proxy/proxy_non_thread_safe_ref_count.h" | 17 #include "ppapi/proxy/proxy_non_thread_safe_ref_count.h" |
18 | 18 |
19 struct PPB_FileSystem_Dev; | 19 struct PPB_FileSystem_Dev; |
20 | 20 |
21 namespace ppapi { | 21 namespace ppapi { |
22 | 22 |
23 class HostResource; | 23 class HostResource; |
24 | 24 |
25 namespace proxy { | 25 namespace proxy { |
26 | 26 |
27 class PPB_FileSystem_Proxy : public InterfaceProxy { | 27 class PPB_FileSystem_Proxy : public InterfaceProxy { |
28 public: | 28 public: |
29 PPB_FileSystem_Proxy(Dispatcher* dispatcher); | 29 PPB_FileSystem_Proxy(Dispatcher* dispatcher, const void* target_interface); |
30 virtual ~PPB_FileSystem_Proxy(); | 30 virtual ~PPB_FileSystem_Proxy(); |
31 | 31 |
32 static const Info* GetInfo(); | 32 static const Info* GetInfo(); |
33 | 33 |
34 static PP_Resource CreateProxyResource(PP_Instance instance, | 34 static PP_Resource CreateProxyResource(PP_Instance instance, |
35 PP_FileSystemType type); | 35 PP_FileSystemType type); |
36 | 36 |
37 // InterfaceProxy implementation. | 37 // InterfaceProxy implementation. |
38 virtual bool OnMessageReceived(const IPC::Message& msg); | 38 virtual bool OnMessageReceived(const IPC::Message& msg); |
39 | 39 |
40 static const InterfaceID kInterfaceID = INTERFACE_ID_PPB_FILE_SYSTEM; | |
41 | |
42 private: | 40 private: |
43 // Message handlers. | 41 // Message handlers. |
44 void OnMsgCreate(PP_Instance instance, | 42 void OnMsgCreate(PP_Instance instance, |
45 int type, | 43 int type, |
46 ppapi::HostResource* result); | 44 ppapi::HostResource* result); |
47 void OnMsgOpen(const ppapi::HostResource& filesystem, | 45 void OnMsgOpen(const ppapi::HostResource& filesystem, |
48 int64_t expected_size); | 46 int64_t expected_size); |
49 | 47 |
50 void OnMsgOpenComplete(const ppapi::HostResource& filesystem, | 48 void OnMsgOpenComplete(const ppapi::HostResource& filesystem, |
51 int32_t result); | 49 int32_t result); |
52 | 50 |
53 void OpenCompleteInHost(int32_t result, | 51 void OpenCompleteInHost(int32_t result, |
54 const ppapi::HostResource& host_resource); | 52 const ppapi::HostResource& host_resource); |
55 | 53 |
56 pp::CompletionCallbackFactory<PPB_FileSystem_Proxy, | 54 pp::CompletionCallbackFactory<PPB_FileSystem_Proxy, |
57 ProxyNonThreadSafeRefCount> callback_factory_; | 55 ProxyNonThreadSafeRefCount> callback_factory_; |
58 | 56 |
59 DISALLOW_COPY_AND_ASSIGN(PPB_FileSystem_Proxy); | 57 DISALLOW_COPY_AND_ASSIGN(PPB_FileSystem_Proxy); |
60 }; | 58 }; |
61 | 59 |
62 } // namespace proxy | 60 } // namespace proxy |
63 } // namespace ppapi | 61 } // namespace ppapi |
64 | 62 |
65 #endif // PPAPI_PROXY_PPB_FILE_SYSTEM_PROXY_H_ | 63 #endif // PPAPI_PROXY_PPB_FILE_SYSTEM_PROXY_H_ |
OLD | NEW |