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_REF_PROXY_H_ | 5 #ifndef PPAPI_PROXY_PPB_FILE_REF_PROXY_H_ |
6 #define PPAPI_PROXY_PPB_FILE_REF_PROXY_H_ | 6 #define PPAPI_PROXY_PPB_FILE_REF_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_module.h" | 11 #include "ppapi/c/pp_module.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/cpp/completion_callback.h" |
14 #include "ppapi/proxy/interface_proxy.h" | 15 #include "ppapi/proxy/interface_proxy.h" |
| 16 #include "ppapi/proxy/proxy_non_thread_safe_ref_count.h" |
15 | 17 |
16 struct PPB_FileRef_Dev; | 18 struct PPB_FileRef_Dev; |
17 | 19 |
18 namespace ppapi { | 20 namespace ppapi { |
19 | 21 |
20 class HostResource; | 22 class HostResource; |
21 struct PPB_FileRef_CreateInfo; | 23 struct PPB_FileRef_CreateInfo; |
22 | 24 |
23 namespace proxy { | 25 namespace proxy { |
24 | 26 |
(...skipping 27 matching lines...) Expand all Loading... |
52 // | 54 // |
53 // Various PPAPI functions return file refs from various interfaces, so this | 55 // Various PPAPI functions return file refs from various interfaces, so this |
54 // function is public so anybody can receive a file ref. | 56 // function is public so anybody can receive a file ref. |
55 static PP_Resource DeserializeFileRef( | 57 static PP_Resource DeserializeFileRef( |
56 const PPB_FileRef_CreateInfo& serialized); | 58 const PPB_FileRef_CreateInfo& serialized); |
57 | 59 |
58 static const InterfaceID kInterfaceID = INTERFACE_ID_PPB_FILE_REF; | 60 static const InterfaceID kInterfaceID = INTERFACE_ID_PPB_FILE_REF; |
59 | 61 |
60 private: | 62 private: |
61 // Message handlers. | 63 // Message handlers. |
62 void OnMsgCreate(const ppapi::HostResource& file_system, | 64 void OnMsgCreate(const HostResource& file_system, |
63 const std::string& path, | 65 const std::string& path, |
64 PPB_FileRef_CreateInfo* result); | 66 PPB_FileRef_CreateInfo* result); |
65 void OnMsgGetParent(const ppapi::HostResource& host_resource, | 67 void OnMsgGetParent(const HostResource& host_resource, |
66 PPB_FileRef_CreateInfo* result); | 68 PPB_FileRef_CreateInfo* result); |
67 void OnMsgMakeDirectory(const ppapi::HostResource& host_resource, | 69 void OnMsgMakeDirectory(const HostResource& host_resource, |
68 PP_Bool make_ancestors, | 70 PP_Bool make_ancestors, |
69 uint32_t serialized_callback); | 71 int callback_id); |
70 void OnMsgTouch(const ppapi::HostResource& host_resource, | 72 void OnMsgTouch(const HostResource& host_resource, |
71 PP_Time last_access, | 73 PP_Time last_access, |
72 PP_Time last_modified, | 74 PP_Time last_modified, |
73 uint32_t serialized_callback); | 75 int callback_id); |
74 void OnMsgDelete(const ppapi::HostResource& host_resource, | 76 void OnMsgDelete(const HostResource& host_resource, |
75 uint32_t serialized_callback); | 77 int callback_id); |
76 void OnMsgRename(const ppapi::HostResource& file_ref, | 78 void OnMsgRename(const HostResource& file_ref, |
77 const ppapi::HostResource& new_file_ref, | 79 const HostResource& new_file_ref, |
78 uint32_t serialized_callback); | 80 int callback_id); |
| 81 |
| 82 // Host -> Plugin message handlers. |
| 83 void OnMsgCallbackComplete(const HostResource& host_resource, |
| 84 int callback_id, |
| 85 int32_t result); |
| 86 |
| 87 void OnCallbackCompleteInHost(int32_t result, |
| 88 const HostResource& host_resource, |
| 89 int callback_id); |
| 90 |
| 91 pp::CompletionCallbackFactory<PPB_FileRef_Proxy, |
| 92 ProxyNonThreadSafeRefCount> callback_factory_; |
79 | 93 |
80 DISALLOW_COPY_AND_ASSIGN(PPB_FileRef_Proxy); | 94 DISALLOW_COPY_AND_ASSIGN(PPB_FileRef_Proxy); |
81 }; | 95 }; |
82 | 96 |
83 } // namespace proxy | 97 } // namespace proxy |
84 } // namespace ppapi | 98 } // namespace ppapi |
85 | 99 |
86 #endif // PPAPI_PROXY_PPB_FILE_REF_PROXY_H_ | 100 #endif // PPAPI_PROXY_PPB_FILE_REF_PROXY_H_ |
OLD | NEW |