1 // Copyright (c) 2012 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_RESOURCE_CREATION_PROXY_H_
6 #define PPAPI_PROXY_RESOURCE_CREATION_PROXY_H_
10 #include "base/basictypes.h"
11 #include "ipc/ipc_channel.h"
12 #include "ppapi/c/pp_bool.h"
13 #include "ppapi/c/pp_instance.h"
14 #include "ppapi/proxy/interface_proxy.h"
15 #include "ppapi/proxy/serialized_structs.h"
16 #include "ppapi/thunk/resource_creation_api.h"
29 class ResourceCreationProxy
: public InterfaceProxy
,
30 public thunk::ResourceCreationAPI
{
32 explicit ResourceCreationProxy(Dispatcher
* dispatcher
);
33 virtual ~ResourceCreationProxy();
35 // Factory function used for registration (normal code can just use the
37 static InterfaceProxy
* Create(Dispatcher
* dispatcher
);
39 // ResourceCreationAPI (called in plugin).
40 virtual PP_Resource
CreateFileIO(PP_Instance instance
) OVERRIDE
;
41 virtual PP_Resource
CreateFileRef(PP_Instance instance
,
42 PP_Resource file_system
,
43 const char* path
) OVERRIDE
;
44 virtual PP_Resource
CreateFileRef(
45 const PPB_FileRef_CreateInfo
& create_info
) OVERRIDE
;
46 virtual PP_Resource
CreateFileSystem(PP_Instance instance
,
47 PP_FileSystemType type
) OVERRIDE
;
48 virtual PP_Resource
CreateIMEInputEvent(PP_Instance instance
,
49 PP_InputEvent_Type type
,
50 PP_TimeTicks time_stamp
,
52 uint32_t segment_number
,
53 const uint32_t* segment_offsets
,
54 int32_t target_segment
,
55 uint32_t selection_start
,
56 uint32_t selection_end
) OVERRIDE
;
57 virtual PP_Resource
CreateKeyboardInputEvent(
59 PP_InputEvent_Type type
,
60 PP_TimeTicks time_stamp
,
63 PP_Var character_text
) OVERRIDE
;
64 virtual PP_Resource
CreateMouseInputEvent(
66 PP_InputEvent_Type type
,
67 PP_TimeTicks time_stamp
,
69 PP_InputEvent_MouseButton mouse_button
,
70 const PP_Point
* mouse_position
,
72 const PP_Point
* mouse_movement
) OVERRIDE
;
73 virtual PP_Resource
CreateTouchInputEvent(
75 PP_InputEvent_Type type
,
76 PP_TimeTicks time_stamp
,
77 uint32_t modifiers
) OVERRIDE
;
78 virtual PP_Resource
CreateResourceArray(PP_Instance instance
,
79 const PP_Resource elements
[],
80 uint32_t size
) OVERRIDE
;
81 virtual PP_Resource
CreateTrueTypeFont(
83 const PP_TrueTypeFontDesc_Dev
* desc
) OVERRIDE
;
84 virtual PP_Resource
CreateURLLoader(PP_Instance instance
) OVERRIDE
;
85 virtual PP_Resource
CreateURLRequestInfo(
86 PP_Instance instance
) OVERRIDE
;
87 virtual PP_Resource
CreateWheelInputEvent(
89 PP_TimeTicks time_stamp
,
91 const PP_FloatPoint
* wheel_delta
,
92 const PP_FloatPoint
* wheel_ticks
,
93 PP_Bool scroll_by_page
) OVERRIDE
;
95 virtual PP_Resource
CreateAudio(PP_Instance instance
,
96 PP_Resource config_id
,
97 PPB_Audio_Callback audio_callback
,
98 void* user_data
) OVERRIDE
;
99 virtual PP_Resource
CreateAudioTrusted(PP_Instance instance
) OVERRIDE
;
100 virtual PP_Resource
CreateAudioConfig(PP_Instance instance
,
101 PP_AudioSampleRate sample_rate
,
102 uint32_t sample_frame_count
) OVERRIDE
;
103 virtual PP_Resource
CreateFileChooser(PP_Instance instance
,
104 PP_FileChooserMode_Dev mode
,
105 const PP_Var
& accept_types
) OVERRIDE
;
106 virtual PP_Resource
CreateGraphics2D(PP_Instance pp_instance
,
108 PP_Bool is_always_opaque
) OVERRIDE
;
109 virtual PP_Resource
CreateGraphics3D(PP_Instance instance
,
110 PP_Resource share_context
,
111 const int32_t* attrib_list
) OVERRIDE
;
112 virtual PP_Resource
CreateGraphics3DRaw(
113 PP_Instance instance
,
114 PP_Resource share_context
,
115 const int32_t* attrib_list
) OVERRIDE
;
116 virtual PP_Resource
CreateHostResolver(PP_Instance instance
) OVERRIDE
;
117 virtual PP_Resource
CreateHostResolverPrivate(PP_Instance instance
) OVERRIDE
;
118 virtual PP_Resource
CreateImageData(PP_Instance instance
,
119 PP_ImageDataFormat format
,
121 PP_Bool init_to_zero
) OVERRIDE
;
122 virtual PP_Resource
CreateImageDataSimple(PP_Instance instance
,
123 PP_ImageDataFormat format
,
125 PP_Bool init_to_zero
) OVERRIDE
;
126 virtual PP_Resource
CreateNetAddressFromIPv4Address(
127 PP_Instance instance
,
128 const PP_NetAddress_IPv4
* ipv4_addr
) OVERRIDE
;
129 virtual PP_Resource
CreateNetAddressFromIPv6Address(
130 PP_Instance instance
,
131 const PP_NetAddress_IPv6
* ipv6_addr
) OVERRIDE
;
132 virtual PP_Resource
CreateNetAddressFromNetAddressPrivate(
133 PP_Instance instance
,
134 const PP_NetAddress_Private
& private_addr
) OVERRIDE
;
135 virtual PP_Resource
CreateNetworkMonitor(
136 PP_Instance instance
,
137 PPB_NetworkMonitor_Callback callback
,
138 void* user_data
) OVERRIDE
;
139 virtual PP_Resource
CreatePrinting(PP_Instance
) OVERRIDE
;
140 virtual PP_Resource
CreateTCPServerSocketPrivate(
141 PP_Instance instance
) OVERRIDE
;
142 virtual PP_Resource
CreateTCPSocket(PP_Instance instance
) OVERRIDE
;
143 virtual PP_Resource
CreateTCPSocketPrivate(PP_Instance instance
) OVERRIDE
;
144 virtual PP_Resource
CreateUDPSocket(PP_Instance instance
) OVERRIDE
;
145 virtual PP_Resource
CreateUDPSocketPrivate(PP_Instance instance
) OVERRIDE
;
146 virtual PP_Resource
CreateVideoDestination(PP_Instance instance
) OVERRIDE
;
147 virtual PP_Resource
CreateVideoSource(PP_Instance instance
) OVERRIDE
;
148 virtual PP_Resource
CreateWebSocket(PP_Instance instance
) OVERRIDE
;
149 virtual PP_Resource
CreateX509CertificatePrivate(
150 PP_Instance instance
) OVERRIDE
;
151 #if !defined(OS_NACL)
152 virtual PP_Resource
CreateAudioInput(PP_Instance instance
) OVERRIDE
;
153 virtual PP_Resource
CreateBroker(PP_Instance instance
) OVERRIDE
;
154 virtual PP_Resource
CreateBrowserFont(
155 PP_Instance instance
,
156 const PP_BrowserFont_Trusted_Description
* description
) OVERRIDE
;
157 virtual PP_Resource
CreateBuffer(PP_Instance instance
,
158 uint32_t size
) OVERRIDE
;
159 virtual PP_Resource
CreateFlashDRM(PP_Instance instance
) OVERRIDE
;
160 virtual PP_Resource
CreateFlashFontFile(
161 PP_Instance instance
,
162 const PP_BrowserFont_Trusted_Description
* description
,
163 PP_PrivateFontCharset charset
) OVERRIDE
;
164 virtual PP_Resource
CreateFlashMenu(PP_Instance instance
,
165 const PP_Flash_Menu
* menu_data
) OVERRIDE
;
166 virtual PP_Resource
CreateFlashMessageLoop(PP_Instance instance
) OVERRIDE
;
167 virtual PP_Resource
CreateScrollbar(PP_Instance instance
,
168 PP_Bool vertical
) OVERRIDE
;
169 virtual PP_Resource
CreateTalk(PP_Instance instance
) OVERRIDE
;
170 virtual PP_Resource
CreateVideoCapture(PP_Instance instance
) OVERRIDE
;
171 virtual PP_Resource
CreateVideoDecoder(
172 PP_Instance instance
,
173 PP_Resource context3d_id
,
174 PP_VideoDecoder_Profile profile
) OVERRIDE
;
175 #endif // !defined(OS_NACL)
177 virtual bool Send(IPC::Message
* msg
) OVERRIDE
;
178 virtual bool OnMessageReceived(const IPC::Message
& msg
) OVERRIDE
;
181 Connection
GetConnection();
182 DISALLOW_COPY_AND_ASSIGN(ResourceCreationProxy
);
188 #endif // PPAPI_PROXY_RESOURCE_CREATION_PROXY_H_