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