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