Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(349)

Side by Side Diff: ppapi/proxy/ppb_file_ref_proxy.h

Issue 6519057: Implement proxying for FileRef and FileChooser.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
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.
4
5 #ifndef PPAPI_PROXY_PPB_FILE_REF_PROXY_H_
6 #define PPAPI_PROXY_PPB_FILE_REF_PROXY_H_
7
8 #include <string>
9
10 #include "base/basictypes.h"
11 #include "ppapi/c/pp_module.h"
12 #include "ppapi/c/pp_resource.h"
13 #include "ppapi/c/pp_time.h"
14 #include "ppapi/proxy/interface_proxy.h"
15
16 struct PPB_FileRef_Dev;
17
18 namespace pp {
19 namespace proxy {
20
21 class HostResource;
22 struct PPBFileRef_CreateInfo;
23
24 class PPB_FileRef_Proxy : public InterfaceProxy {
25 public:
26 PPB_FileRef_Proxy(Dispatcher* dispatcher, const void* target_interface);
27 virtual ~PPB_FileRef_Proxy();
28
29 static const Info* GetInfo();
30
31 const PPB_FileRef_Dev* ppb_file_ref_target() const {
32 return static_cast<const PPB_FileRef_Dev*>(target_interface());
33 }
34
35 // InterfaceProxy implementation.
36 virtual bool OnMessageReceived(const IPC::Message& msg);
37
38 // Takes a resource in the host and converts it into a serialized file ref
39 // "create info" for reconstitution in the plugin. This struct contains all
40 // the necessary information about the file ref.
41 //
42 // This function is not static because it needs access to the particular
43 // dispatcher and host interface.
44 //
45 // Various PPAPI functions return file refs from various interfaces, so this
46 // function is public so anybody can send a file ref.
47 void SerializeFileRef(PP_Resource file_ref,
48 PPBFileRef_CreateInfo* result);
49
50 // Creates a plugin resource from the given CreateInfo sent from the host.
51 // The value will be the result of calling SerializeFileRef on the host.
52 // This represents passing the resource ownership to the plugin. This
53 // function also checks the validity of the result and returns 0 on failure.
54 //
55 // Various PPAPI functions return file refs from various interfaces, so this
56 // function is public so anybody can receive a file ref.
57 static PP_Resource DeserializeFileRef(
58 const PPBFileRef_CreateInfo& serialized);
59
60 private:
61 // Message handlers.
62 void OnMsgCreate(const HostResource& file_system,
63 const std::string& path,
64 PPBFileRef_CreateInfo* result);
65 void OnMsgGetParent(const HostResource& host_resource,
66 PPBFileRef_CreateInfo* result);
67 void OnMsgMakeDirectory(const HostResource& host_resource,
68 PP_Bool make_ancestors,
69 uint32_t serialized_callback);
70 void OnMsgTouch(const HostResource& host_resource,
71 PP_Time last_access,
72 PP_Time last_modified,
73 uint32_t serialized_callback);
74 void OnMsgDelete(const HostResource& host_resource,
75 uint32_t serialized_callback);
76 void OnMsgRename(const HostResource& file_ref,
77 const HostResource& new_file_ref,
78 uint32_t serialized_callback);
79
80 DISALLOW_COPY_AND_ASSIGN(PPB_FileRef_Proxy);
81 };
82
83 } // namespace proxy
84 } // namespace pp
85
86 #endif // PPAPI_PROXY_PPB_FILE_REF_PROXY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698