OLD | NEW |
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 #include "ppapi/proxy/ppapi_proxy_export.h" |
15 #include "ppapi/proxy/proxy_completion_callback_factory.h" | 16 #include "ppapi/proxy/proxy_completion_callback_factory.h" |
16 #include "ppapi/utility/completion_callback_factory.h" | 17 #include "ppapi/utility/completion_callback_factory.h" |
17 | 18 |
18 namespace ppapi { | 19 namespace ppapi { |
19 | 20 |
20 class HostResource; | 21 class HostResource; |
21 struct PPB_FileRef_CreateInfo; | 22 struct PPB_FileRef_CreateInfo; |
22 | 23 |
23 namespace proxy { | 24 namespace proxy { |
24 | 25 |
25 class SerializedVarReturnValue; | 26 class SerializedVarReturnValue; |
26 | 27 |
27 class PPB_FileRef_Proxy : public InterfaceProxy { | 28 class PPAPI_PROXY_EXPORT PPB_FileRef_Proxy |
| 29 : public NON_EXPORTED_BASE(InterfaceProxy) { |
28 public: | 30 public: |
29 explicit PPB_FileRef_Proxy(Dispatcher* dispatcher); | 31 explicit PPB_FileRef_Proxy(Dispatcher* dispatcher); |
30 virtual ~PPB_FileRef_Proxy(); | 32 virtual ~PPB_FileRef_Proxy(); |
31 | 33 |
32 static PP_Resource CreateProxyResource(PP_Resource file_system, | 34 static PP_Resource CreateProxyResource(PP_Resource file_system, |
33 const char* path); | 35 const char* path); |
34 static PP_Resource CreateProxyResource( | 36 static PP_Resource CreateProxyResource( |
35 const PPB_FileRef_CreateInfo& serialized); | 37 const PPB_FileRef_CreateInfo& serialized); |
36 | 38 |
37 // InterfaceProxy implementation. | 39 // InterfaceProxy implementation. |
38 virtual bool OnMessageReceived(const IPC::Message& msg); | 40 virtual bool OnMessageReceived(const IPC::Message& msg); |
39 | 41 |
40 // Takes a resource in the host and converts it into a serialized file ref | 42 // Takes a resource in the host and converts it into a serialized file ref |
41 // "create info" for reconstitution in the plugin. This struct contains all | 43 // "create info" for reconstitution in the plugin. This struct contains all |
42 // the necessary information about the file ref. | 44 // the necessary information about the file ref. |
43 // | 45 // |
44 // This function is not static because it needs access to the particular | |
45 // dispatcher and host interface. | |
46 // | |
47 // Various PPAPI functions return file refs from various interfaces, so this | 46 // Various PPAPI functions return file refs from various interfaces, so this |
48 // function is public so anybody can send a file ref. | 47 // function is public so anybody can send a file ref. |
49 void SerializeFileRef(PP_Resource file_ref, | 48 static void SerializeFileRef(PP_Resource file_ref, |
50 PPB_FileRef_CreateInfo* result); | 49 PPB_FileRef_CreateInfo* result); |
51 | 50 |
52 // Creates a plugin resource from the given CreateInfo sent from the host. | 51 // Creates a plugin resource from the given CreateInfo sent from the host. |
53 // The value will be the result of calling SerializeFileRef on the host. | 52 // The value will be the result of calling SerializeFileRef on the host. |
54 // This represents passing the resource ownership to the plugin. This | 53 // This represents passing the resource ownership to the plugin. This |
55 // function also checks the validity of the result and returns 0 on failure. | 54 // function also checks the validity of the result and returns 0 on failure. |
56 // | 55 // |
57 // Various PPAPI functions return file refs from various interfaces, so this | 56 // Various PPAPI functions return file refs from various interfaces, so this |
58 // function is public so anybody can receive a file ref. | 57 // function is public so anybody can receive a file ref. |
59 static PP_Resource DeserializeFileRef( | 58 static PP_Resource DeserializeFileRef( |
60 const PPB_FileRef_CreateInfo& serialized); | 59 const PPB_FileRef_CreateInfo& serialized); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 | 93 |
95 ProxyCompletionCallbackFactory<PPB_FileRef_Proxy> callback_factory_; | 94 ProxyCompletionCallbackFactory<PPB_FileRef_Proxy> callback_factory_; |
96 | 95 |
97 DISALLOW_COPY_AND_ASSIGN(PPB_FileRef_Proxy); | 96 DISALLOW_COPY_AND_ASSIGN(PPB_FileRef_Proxy); |
98 }; | 97 }; |
99 | 98 |
100 } // namespace proxy | 99 } // namespace proxy |
101 } // namespace ppapi | 100 } // namespace ppapi |
102 | 101 |
103 #endif // PPAPI_PROXY_PPB_FILE_REF_PROXY_H_ | 102 #endif // PPAPI_PROXY_PPB_FILE_REF_PROXY_H_ |
OLD | NEW |