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

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

Issue 8764003: Implement a proxy for Pepper FileIO. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Homestarmy Created 9 years 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_io_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"
(...skipping 13 matching lines...) Expand all
24 24
25 class SerializedVarReturnValue; 25 class SerializedVarReturnValue;
26 26
27 class PPB_FileRef_Proxy : public InterfaceProxy { 27 class PPB_FileRef_Proxy : public InterfaceProxy {
28 public: 28 public:
29 explicit PPB_FileRef_Proxy(Dispatcher* dispatcher); 29 explicit PPB_FileRef_Proxy(Dispatcher* dispatcher);
30 virtual ~PPB_FileRef_Proxy(); 30 virtual ~PPB_FileRef_Proxy();
31 31
32 static PP_Resource CreateProxyResource(PP_Resource file_system, 32 static PP_Resource CreateProxyResource(PP_Resource file_system,
33 const char* path); 33 const char* path);
34 static PP_Resource CreateProxyResource(
35 const PPB_FileRef_CreateInfo& serialized);
34 36
35 // InterfaceProxy implementation. 37 // InterfaceProxy implementation.
36 virtual bool OnMessageReceived(const IPC::Message& msg); 38 virtual bool OnMessageReceived(const IPC::Message& msg);
37 39
38 // Takes a resource in the host and converts it into a serialized file ref 40 // 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 41 // "create info" for reconstitution in the plugin. This struct contains all
40 // the necessary information about the file ref. 42 // the necessary information about the file ref.
41 // 43 //
42 // This function is not static because it needs access to the particular 44 // This function is not static because it needs access to the particular
43 // dispatcher and host interface. 45 // dispatcher and host interface.
44 // 46 //
45 // Various PPAPI functions return file refs from various interfaces, so this 47 // Various PPAPI functions return file refs from various interfaces, so this
46 // function is public so anybody can send a file ref. 48 // function is public so anybody can send a file ref.
47 void SerializeFileRef(PP_Resource file_ref, 49 void SerializeFileRef(PP_Resource file_ref,
48 PPB_FileRef_CreateInfo* result); 50 PPB_FileRef_CreateInfo* result);
49 51
50 // Creates a plugin resource from the given CreateInfo sent from the host. 52 // 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. 53 // The value will be the result of calling SerializeFileRef on the host.
52 // This represents passing the resource ownership to the plugin. This 54 // This represents passing the resource ownership to the plugin. This
53 // function also checks the validity of the result and returns 0 on failure. 55 // function also checks the validity of the result and returns 0 on failure.
54 // 56 //
55 // Various PPAPI functions return file refs from various interfaces, so this 57 // Various PPAPI functions return file refs from various interfaces, so this
56 // function is public so anybody can receive a file ref. 58 // function is public so anybody can receive a file ref.
57 static PP_Resource DeserializeFileRef( 59 static PP_Resource DeserializeFileRef(
58 const PPB_FileRef_CreateInfo& serialized); 60 const PPB_FileRef_CreateInfo& serialized);
59 61
60 static const ApiID kApiID = API_ID_PPB_FILE_REF; 62 static const ApiID kApiID = API_ID_PPB_FILE_REF;
61 63
62 private: 64 private:
63 // Message handlers. 65 // Plugin -> host message handlers.
64 void OnMsgCreate(const HostResource& file_system, 66 void OnMsgCreate(const HostResource& file_system,
65 const std::string& path, 67 const std::string& path,
66 PPB_FileRef_CreateInfo* result); 68 PPB_FileRef_CreateInfo* result);
67 void OnMsgGetParent(const HostResource& host_resource, 69 void OnMsgGetParent(const HostResource& host_resource,
68 PPB_FileRef_CreateInfo* result); 70 PPB_FileRef_CreateInfo* result);
69 void OnMsgMakeDirectory(const HostResource& host_resource, 71 void OnMsgMakeDirectory(const HostResource& host_resource,
70 PP_Bool make_ancestors, 72 PP_Bool make_ancestors,
71 int callback_id); 73 int callback_id);
72 void OnMsgTouch(const HostResource& host_resource, 74 void OnMsgTouch(const HostResource& host_resource,
73 PP_Time last_access, 75 PP_Time last_access,
(...skipping 19 matching lines...) Expand all
93 pp::CompletionCallbackFactory<PPB_FileRef_Proxy, 95 pp::CompletionCallbackFactory<PPB_FileRef_Proxy,
94 ProxyNonThreadSafeRefCount> callback_factory_; 96 ProxyNonThreadSafeRefCount> callback_factory_;
95 97
96 DISALLOW_COPY_AND_ASSIGN(PPB_FileRef_Proxy); 98 DISALLOW_COPY_AND_ASSIGN(PPB_FileRef_Proxy);
97 }; 99 };
98 100
99 } // namespace proxy 101 } // namespace proxy
100 } // namespace ppapi 102 } // namespace ppapi
101 103
102 #endif // PPAPI_PROXY_PPB_FILE_REF_PROXY_H_ 104 #endif // PPAPI_PROXY_PPB_FILE_REF_PROXY_H_
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_file_io_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