Refactor android test results logging.
[chromium-blink-merge.git] / ppapi / proxy / ppb_file_io_proxy.h
blob10e531382be826a0c0e227c9e13181e3756b3a27
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
3 // found in the LICENSE file.
5 #ifndef PPAPI_PROXY_PPB_FILE_IO_PROXY_H_
6 #define PPAPI_PROXY_PPB_FILE_IO_PROXY_H_
8 #include <string>
10 #include "base/basictypes.h"
11 #include "ppapi/c/pp_file_info.h"
12 #include "ppapi/proxy/interface_proxy.h"
13 #include "ppapi/proxy/proxy_completion_callback_factory.h"
14 #include "ppapi/utility/completion_callback_factory.h"
16 namespace ppapi {
18 class HostResource;
19 namespace proxy {
21 class PPB_FileIO_Proxy : public InterfaceProxy {
22 public:
23 explicit PPB_FileIO_Proxy(Dispatcher* dispatcher);
24 virtual ~PPB_FileIO_Proxy();
26 static PP_Resource CreateProxyResource(PP_Instance instance);
28 // InterfaceProxy implementation.
29 virtual bool OnMessageReceived(const IPC::Message& msg);
31 static const ApiID kApiID = API_ID_PPB_FILE_IO;
33 private:
34 // Plugin -> Host message handlers.
35 void OnHostMsgCreate(PP_Instance instance, HostResource* result);
36 void OnHostMsgOpen(const HostResource& host_resource,
37 const HostResource& file_ref_resource,
38 int32_t open_flags);
39 void OnHostMsgClose(const HostResource& host_resource);
40 void OnHostMsgQuery(const HostResource& host_resource);
41 void OnHostMsgTouch(const HostResource& host_resource,
42 PP_Time last_access_time,
43 PP_Time last_modified_time);
44 void OnHostMsgRead(const HostResource& host_resource,
45 int64_t offset,
46 int32_t bytes_to_read);
47 void OnHostMsgWrite(const HostResource& host_resource,
48 int64_t offset,
49 const std::string& data);
50 void OnHostMsgSetLength(const HostResource& host_resource,
51 int64_t length);
52 void OnHostMsgFlush(const HostResource& host_resource);
53 void OnHostMsgWillWrite(const HostResource& host_resource,
54 int64_t offset,
55 int32_t bytes_to_write);
56 void OnHostMsgWillSetLength(const HostResource& host_resource,
57 int64_t length);
59 // Host -> Plugin message handlers.
60 void OnPluginMsgGeneralComplete(const HostResource& host_resource,
61 int32_t result);
62 void OnPluginMsgOpenFileComplete(const HostResource& host_resource,
63 int32_t result);
64 void OnPluginMsgQueryComplete(const HostResource& host_resource,
65 int32_t result,
66 const PP_FileInfo& info);
67 void OnPluginMsgReadComplete(const HostResource& host_resource,
68 int32_t result,
69 const std::string& data);
70 void OnPluginMsgWriteComplete(const HostResource& host_resource,
71 int32_t result);
73 // Host-side callback handlers. These convert the callbacks to an IPC message
74 // to the plugin.
75 void GeneralCallbackCompleteInHost(int32_t pp_error,
76 const HostResource& host_resource);
77 void OpenFileCallbackCompleteInHost(int32_t pp_error,
78 const HostResource& host_resource);
79 void QueryCallbackCompleteInHost(int32_t pp_error,
80 const HostResource& host_resource,
81 PP_FileInfo* info);
82 void ReadCallbackCompleteInHost(int32_t pp_error,
83 const HostResource& host_resource,
84 std::string* data);
85 ProxyCompletionCallbackFactory<PPB_FileIO_Proxy> callback_factory_;
87 DISALLOW_COPY_AND_ASSIGN(PPB_FileIO_Proxy);
90 } // namespace proxy
91 } // namespace ppapi
93 #endif // PPAPI_PROXY_PPB_FILE_IO_PROXY_H_