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 ~ResourceCreationProxy() override
;
35 // Factory function used for registration (normal code can just use the
37 static InterfaceProxy
* Create(Dispatcher
* dispatcher
);
39 // ResourceCreationAPI (called in plugin).
40 PP_Resource
CreateFileIO(PP_Instance instance
) override
;
41 PP_Resource
CreateFileRef(
43 const FileRefCreateInfo
& create_info
) override
;
44 PP_Resource
CreateFileSystem(PP_Instance instance
,
45 PP_FileSystemType type
) override
;
46 PP_Resource
CreateIMEInputEvent(PP_Instance instance
,
47 PP_InputEvent_Type type
,
48 PP_TimeTicks time_stamp
,
50 uint32_t segment_number
,
51 const uint32_t* segment_offsets
,
52 int32_t target_segment
,
53 uint32_t selection_start
,
54 uint32_t selection_end
) override
;
55 PP_Resource
CreateKeyboardInputEvent_1_0(
57 PP_InputEvent_Type type
,
58 PP_TimeTicks time_stamp
,
61 PP_Var character_text
) override
;
62 PP_Resource
CreateKeyboardInputEvent_1_2(
64 PP_InputEvent_Type type
,
65 PP_TimeTicks time_stamp
,
68 PP_Var character_text
,
69 PP_Var code
) override
;
70 PP_Resource
CreateMouseInputEvent(
72 PP_InputEvent_Type type
,
73 PP_TimeTicks time_stamp
,
75 PP_InputEvent_MouseButton mouse_button
,
76 const PP_Point
* mouse_position
,
78 const PP_Point
* mouse_movement
) override
;
79 PP_Resource
CreateTouchInputEvent(
81 PP_InputEvent_Type type
,
82 PP_TimeTicks time_stamp
,
83 uint32_t modifiers
) override
;
84 PP_Resource
CreateTrueTypeFont(
86 const PP_TrueTypeFontDesc_Dev
* desc
) override
;
87 PP_Resource
CreateURLLoader(PP_Instance instance
) override
;
88 PP_Resource
CreateURLRequestInfo(PP_Instance instance
) override
;
89 PP_Resource
CreateWheelInputEvent(
91 PP_TimeTicks time_stamp
,
93 const PP_FloatPoint
* wheel_delta
,
94 const PP_FloatPoint
* wheel_ticks
,
95 PP_Bool scroll_by_page
) override
;
96 PP_Resource
CreateAudio1_0(PP_Instance instance
,
97 PP_Resource config_id
,
98 PPB_Audio_Callback_1_0 audio_callback
,
99 void* user_data
) override
;
100 PP_Resource
CreateAudio(PP_Instance instance
,
101 PP_Resource config_id
,
102 PPB_Audio_Callback audio_callback
,
103 void* user_data
) override
;
104 PP_Resource
CreateAudioTrusted(PP_Instance instance
) override
;
105 PP_Resource
CreateAudioConfig(PP_Instance instance
,
106 PP_AudioSampleRate sample_rate
,
107 uint32_t sample_frame_count
) override
;
108 PP_Resource
CreateCameraDevicePrivate(PP_Instance instance
) override
;
109 PP_Resource
CreateCompositor(PP_Instance instance
) override
;
110 PP_Resource
CreateFileChooser(PP_Instance instance
,
111 PP_FileChooserMode_Dev mode
,
112 const PP_Var
& accept_types
) override
;
113 PP_Resource
CreateGraphics2D(PP_Instance pp_instance
,
115 PP_Bool is_always_opaque
) override
;
116 PP_Resource
CreateGraphics3D(PP_Instance instance
,
117 PP_Resource share_context
,
118 const int32_t* attrib_list
) override
;
119 PP_Resource
CreateGraphics3DRaw(
120 PP_Instance instance
,
121 PP_Resource share_context
,
122 const int32_t* attrib_list
,
123 gpu::Capabilities
* capabilities
,
124 base::SharedMemoryHandle
* shared_state
) override
;
125 PP_Resource
CreateHostResolver(PP_Instance instance
) override
;
126 PP_Resource
CreateHostResolverPrivate(PP_Instance instance
) override
;
127 PP_Resource
CreateImageData(PP_Instance instance
,
128 PP_ImageDataFormat format
,
130 PP_Bool init_to_zero
) override
;
131 PP_Resource
CreateImageDataSimple(PP_Instance instance
,
132 PP_ImageDataFormat format
,
134 PP_Bool init_to_zero
) override
;
135 PP_Resource
CreateMediaStreamVideoTrack(PP_Instance instance
) override
;
136 PP_Resource
CreateNetAddressFromIPv4Address(
137 PP_Instance instance
,
138 const PP_NetAddress_IPv4
* ipv4_addr
) override
;
139 PP_Resource
CreateNetAddressFromIPv6Address(
140 PP_Instance instance
,
141 const PP_NetAddress_IPv6
* ipv6_addr
) override
;
142 PP_Resource
CreateNetAddressFromNetAddressPrivate(
143 PP_Instance instance
,
144 const PP_NetAddress_Private
& private_addr
) override
;
145 PP_Resource
CreateNetworkMonitor(PP_Instance instance
) override
;
146 PP_Resource
CreateOutputProtectionPrivate(PP_Instance instance
) override
;
147 PP_Resource
CreatePrinting(PP_Instance
) override
;
148 PP_Resource
CreateTCPServerSocketPrivate(PP_Instance instance
) override
;
149 PP_Resource
CreateTCPSocket1_0(PP_Instance instance
) override
;
150 PP_Resource
CreateTCPSocket(PP_Instance instance
) override
;
151 PP_Resource
CreateTCPSocketPrivate(PP_Instance instance
) override
;
152 PP_Resource
CreateUDPSocket(PP_Instance instance
) override
;
153 PP_Resource
CreateUDPSocketPrivate(PP_Instance instance
) override
;
154 PP_Resource
CreateVideoDecoder(PP_Instance instance
) override
;
155 PP_Resource
CreateVideoDestination(PP_Instance instance
) override
;
156 PP_Resource
CreateVideoEncoder(PP_Instance instance
) override
;
157 PP_Resource
CreateVideoSource(PP_Instance instance
) override
;
158 PP_Resource
CreateWebSocket(PP_Instance instance
) override
;
159 PP_Resource
CreateX509CertificatePrivate(PP_Instance instance
) override
;
160 #if !defined(OS_NACL)
161 PP_Resource
CreateAudioInput(PP_Instance instance
) override
;
162 PP_Resource
CreateBroker(PP_Instance instance
) override
;
163 PP_Resource
CreateBrowserFont(
164 PP_Instance instance
,
165 const PP_BrowserFont_Trusted_Description
* description
) override
;
166 PP_Resource
CreateBuffer(PP_Instance instance
, uint32_t size
) override
;
167 PP_Resource
CreateFlashDRM(PP_Instance instance
) override
;
168 PP_Resource
CreateFlashFontFile(
169 PP_Instance instance
,
170 const PP_BrowserFont_Trusted_Description
* description
,
171 PP_PrivateFontCharset charset
) override
;
172 PP_Resource
CreateFlashMenu(PP_Instance instance
,
173 const PP_Flash_Menu
* menu_data
) override
;
174 PP_Resource
CreateFlashMessageLoop(PP_Instance instance
) override
;
175 PP_Resource
CreatePlatformVerificationPrivate(PP_Instance instance
) override
;
176 PP_Resource
CreateScrollbar(PP_Instance instance
,
177 PP_Bool vertical
) override
;
178 PP_Resource
CreateVideoCapture(PP_Instance instance
) override
;
179 PP_Resource
CreateVideoDecoderDev(
180 PP_Instance instance
,
181 PP_Resource context3d_id
,
182 PP_VideoDecoder_Profile profile
) override
;
183 #endif // !defined(OS_NACL)
185 bool Send(IPC::Message
* msg
) override
;
186 bool OnMessageReceived(const IPC::Message
& msg
) override
;
189 Connection
GetConnection();
190 DISALLOW_COPY_AND_ASSIGN(ResourceCreationProxy
);
196 #endif // PPAPI_PROXY_RESOURCE_CREATION_PROXY_H_