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

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

Issue 7887001: s patch tries to remove most of the manual registration for Pepper interfaces, and replaces it wi... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 3 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
« no previous file with comments | « ppapi/proxy/ppb_file_chooser_proxy.cc ('k') | ppapi/proxy/ppb_file_ref_proxy.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/proxy/interface_proxy.h" 14 #include "ppapi/proxy/interface_proxy.h"
15 15
16 struct PPB_FileRef_Dev; 16 struct PPB_FileRef_Dev;
17 17
18 namespace ppapi { 18 namespace ppapi {
19 19
20 class HostResource; 20 class HostResource;
21 struct PPB_FileRef_CreateInfo; 21 struct PPB_FileRef_CreateInfo;
22 22
23 namespace proxy { 23 namespace proxy {
24 24
25 class PPB_FileRef_Proxy : public InterfaceProxy { 25 class PPB_FileRef_Proxy : public InterfaceProxy {
26 public: 26 public:
27 PPB_FileRef_Proxy(Dispatcher* dispatcher, const void* target_interface); 27 PPB_FileRef_Proxy(Dispatcher* dispatcher);
28 virtual ~PPB_FileRef_Proxy(); 28 virtual ~PPB_FileRef_Proxy();
29 29
30 static const Info* GetInfo();
31
32 static PP_Resource CreateProxyResource(PP_Resource file_system, 30 static PP_Resource CreateProxyResource(PP_Resource file_system,
33 const char* path); 31 const char* path);
34 32
35 // InterfaceProxy implementation. 33 // InterfaceProxy implementation.
36 virtual bool OnMessageReceived(const IPC::Message& msg); 34 virtual bool OnMessageReceived(const IPC::Message& msg);
37 35
38 // Takes a resource in the host and converts it into a serialized file ref 36 // 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 37 // "create info" for reconstitution in the plugin. This struct contains all
40 // the necessary information about the file ref. 38 // the necessary information about the file ref.
41 // 39 //
42 // This function is not static because it needs access to the particular 40 // This function is not static because it needs access to the particular
43 // dispatcher and host interface. 41 // dispatcher and host interface.
44 // 42 //
45 // Various PPAPI functions return file refs from various interfaces, so this 43 // Various PPAPI functions return file refs from various interfaces, so this
46 // function is public so anybody can send a file ref. 44 // function is public so anybody can send a file ref.
47 void SerializeFileRef(PP_Resource file_ref, 45 void SerializeFileRef(PP_Resource file_ref,
48 PPB_FileRef_CreateInfo* result); 46 PPB_FileRef_CreateInfo* result);
49 47
50 // Creates a plugin resource from the given CreateInfo sent from the host. 48 // 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. 49 // The value will be the result of calling SerializeFileRef on the host.
52 // This represents passing the resource ownership to the plugin. This 50 // This represents passing the resource ownership to the plugin. This
53 // function also checks the validity of the result and returns 0 on failure. 51 // function also checks the validity of the result and returns 0 on failure.
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
58 static const InterfaceID kInterfaceID = INTERFACE_ID_PPB_FILE_REF;
59
60 private: 60 private:
61 // Message handlers. 61 // Message handlers.
62 void OnMsgCreate(const ppapi::HostResource& file_system, 62 void OnMsgCreate(const ppapi::HostResource& file_system,
63 const std::string& path, 63 const std::string& path,
64 PPB_FileRef_CreateInfo* result); 64 PPB_FileRef_CreateInfo* result);
65 void OnMsgGetParent(const ppapi::HostResource& host_resource, 65 void OnMsgGetParent(const ppapi::HostResource& host_resource,
66 PPB_FileRef_CreateInfo* result); 66 PPB_FileRef_CreateInfo* result);
67 void OnMsgMakeDirectory(const ppapi::HostResource& host_resource, 67 void OnMsgMakeDirectory(const ppapi::HostResource& host_resource,
68 PP_Bool make_ancestors, 68 PP_Bool make_ancestors,
69 uint32_t serialized_callback); 69 uint32_t serialized_callback);
70 void OnMsgTouch(const ppapi::HostResource& host_resource, 70 void OnMsgTouch(const ppapi::HostResource& host_resource,
71 PP_Time last_access, 71 PP_Time last_access,
72 PP_Time last_modified, 72 PP_Time last_modified,
73 uint32_t serialized_callback); 73 uint32_t serialized_callback);
74 void OnMsgDelete(const ppapi::HostResource& host_resource, 74 void OnMsgDelete(const ppapi::HostResource& host_resource,
75 uint32_t serialized_callback); 75 uint32_t serialized_callback);
76 void OnMsgRename(const ppapi::HostResource& file_ref, 76 void OnMsgRename(const ppapi::HostResource& file_ref,
77 const ppapi::HostResource& new_file_ref, 77 const ppapi::HostResource& new_file_ref,
78 uint32_t serialized_callback); 78 uint32_t serialized_callback);
79 79
80 DISALLOW_COPY_AND_ASSIGN(PPB_FileRef_Proxy); 80 DISALLOW_COPY_AND_ASSIGN(PPB_FileRef_Proxy);
81 }; 81 };
82 82
83 } // namespace proxy 83 } // namespace proxy
84 } // namespace ppapi 84 } // namespace ppapi
85 85
86 #endif // PPAPI_PROXY_PPB_FILE_REF_PROXY_H_ 86 #endif // PPAPI_PROXY_PPB_FILE_REF_PROXY_H_
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_file_chooser_proxy.cc ('k') | ppapi/proxy/ppb_file_ref_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698