Updates version of android sdk and api installed and creates ARM and x86 AVD's.
[chromium-blink-merge.git] / ppapi / proxy / ppb_file_io_proxy.h
blob86d822c1a3c476da1deaf86317ffe7f4614ced70
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_non_thread_safe_ref_count.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 pp::CompletionCallbackFactory<PPB_FileIO_Proxy,
86 ProxyNonThreadSafeRefCount> callback_factory_;
88 DISALLOW_COPY_AND_ASSIGN(PPB_FileIO_Proxy);
91 } // namespace proxy
92 } // namespace ppapi
94 #endif // PPAPI_PROXY_PPB_FILE_IO_PROXY_H_