1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "webkit/plugins/ppapi/resource_creation_impl.h"
#include "ppapi/c/pp_size.h"
#include "ppapi/shared_impl/ppb_audio_config_shared.h"
#include "ppapi/shared_impl/ppb_input_event_shared.h"
#include "ppapi/shared_impl/ppb_resource_array_shared.h"
#include "ppapi/shared_impl/var.h"
#include "webkit/plugins/ppapi/common.h"
#include "webkit/plugins/ppapi/ppb_audio_impl.h"
#include "webkit/plugins/ppapi/ppb_broker_impl.h"
#include "webkit/plugins/ppapi/ppb_buffer_impl.h"
#include "webkit/plugins/ppapi/ppb_directory_reader_impl.h"
#include "webkit/plugins/ppapi/ppb_file_ref_impl.h"
#include "webkit/plugins/ppapi/ppb_file_system_impl.h"
#include "webkit/plugins/ppapi/ppb_flash_message_loop_impl.h"
#include "webkit/plugins/ppapi/ppb_graphics_3d_impl.h"
#include "webkit/plugins/ppapi/ppb_host_resolver_private_impl.h"
#include "webkit/plugins/ppapi/ppb_image_data_impl.h"
#include "webkit/plugins/ppapi/ppb_network_monitor_private_impl.h"
#include "webkit/plugins/ppapi/ppb_scrollbar_impl.h"
#include "webkit/plugins/ppapi/ppb_tcp_server_socket_private_impl.h"
#include "webkit/plugins/ppapi/ppb_tcp_socket_private_impl.h"
#include "webkit/plugins/ppapi/ppb_url_loader_impl.h"
#include "webkit/plugins/ppapi/ppb_video_decoder_impl.h"
#include "webkit/plugins/ppapi/ppb_x509_certificate_private_impl.h"
#include "webkit/plugins/ppapi/resource_helper.h"
using ppapi::InputEventData;
using ppapi::PPB_InputEvent_Shared;
using ppapi::PPB_ResourceArray_Shared;
using ppapi::StringVar;
namespace webkit {
namespace ppapi {
ResourceCreationImpl::ResourceCreationImpl(PluginInstance* instance) {
}
ResourceCreationImpl::~ResourceCreationImpl() {
}
PP_Resource ResourceCreationImpl::CreateAudio(
PP_Instance instance,
PP_Resource config_id,
PPB_Audio_Callback audio_callback,
void* user_data) {
return PPB_Audio_Impl::Create(instance, config_id, audio_callback,
user_data);
}
PP_Resource ResourceCreationImpl::CreateAudioConfig(
PP_Instance instance,
PP_AudioSampleRate sample_rate,
uint32_t sample_frame_count) {
return ::ppapi::PPB_AudioConfig_Shared::Create(
::ppapi::OBJECT_IS_IMPL, instance, sample_rate, sample_frame_count);
}
PP_Resource ResourceCreationImpl::CreateAudioTrusted(
PP_Instance instance) {
return (new PPB_Audio_Impl(instance))->GetReference();
}
PP_Resource ResourceCreationImpl::CreateAudioInput(PP_Instance instance) {
return 0; // Not supported in-process.
}
PP_Resource ResourceCreationImpl::CreateBroker(PP_Instance instance) {
return (new PPB_Broker_Impl(instance))->GetReference();
}
PP_Resource ResourceCreationImpl::CreateBuffer(PP_Instance instance,
uint32_t size) {
return PPB_Buffer_Impl::Create(instance, size);
}
PP_Resource ResourceCreationImpl::CreateDirectoryReader(
PP_Resource directory_ref) {
return PPB_DirectoryReader_Impl::Create(directory_ref);
}
PP_Resource ResourceCreationImpl::CreateFileRef(PP_Resource file_system,
const char* path) {
PPB_FileRef_Impl* res = PPB_FileRef_Impl::CreateInternal(file_system, path);
return res ? res->GetReference() : 0;
}
PP_Resource ResourceCreationImpl::CreateFileSystem(
PP_Instance instance,
PP_FileSystemType type) {
return PPB_FileSystem_Impl::Create(instance, type);
}
PP_Resource ResourceCreationImpl::CreateFlashDeviceID(PP_Instance instance) {
return 0; // Not supported in-process.
}
PP_Resource ResourceCreationImpl::CreateFlashFontFile(
PP_Instance instance,
const PP_BrowserFont_Trusted_Description* description,
PP_PrivateFontCharset charset) {
return 0; // Not supported in-process.
}
PP_Resource ResourceCreationImpl::CreateFlashMenu(
PP_Instance instance,
const PP_Flash_Menu* menu_data) {
return 0; // Not supported in-process.
}
PP_Resource ResourceCreationImpl::CreateFlashMessageLoop(PP_Instance instance) {
return PPB_Flash_MessageLoop_Impl::Create(instance);
}
PP_Resource ResourceCreationImpl::CreateGraphics3D(
PP_Instance instance,
PP_Resource share_context,
const int32_t* attrib_list) {
return PPB_Graphics3D_Impl::Create(instance, share_context, attrib_list);
}
PP_Resource ResourceCreationImpl::CreateGraphics3DRaw(
PP_Instance instance,
PP_Resource share_context,
const int32_t* attrib_list) {
return PPB_Graphics3D_Impl::CreateRaw(instance, share_context, attrib_list);
}
PP_Resource ResourceCreationImpl::CreateHostResolverPrivate(
PP_Instance instance) {
return (new PPB_HostResolver_Private_Impl(instance))->GetReference();
}
PP_Resource ResourceCreationImpl::CreateImageData(PP_Instance instance,
PP_ImageDataFormat format,
const PP_Size& size,
PP_Bool init_to_zero) {
return PPB_ImageData_Impl::CreatePlatform(instance, format, size,
init_to_zero);
}
PP_Resource ResourceCreationImpl::CreateImageDataNaCl(PP_Instance instance,
PP_ImageDataFormat format,
const PP_Size& size,
PP_Bool init_to_zero) {
return PPB_ImageData_Impl::CreateNaCl(instance, format, size, init_to_zero);
}
PP_Resource ResourceCreationImpl::CreateIMEInputEvent(
PP_Instance instance,
PP_InputEvent_Type type,
PP_TimeTicks time_stamp,
struct PP_Var text,
uint32_t segment_number,
const uint32_t* segment_offsets,
int32_t target_segment,
uint32_t selection_start,
uint32_t selection_end) {
return PPB_InputEvent_Shared::CreateIMEInputEvent(
::ppapi::OBJECT_IS_IMPL, instance, type, time_stamp, text, segment_number,
segment_offsets, target_segment, selection_start, selection_end);
}
PP_Resource ResourceCreationImpl::CreateKeyboardInputEvent(
PP_Instance instance,
PP_InputEvent_Type type,
PP_TimeTicks time_stamp,
uint32_t modifiers,
uint32_t key_code,
struct PP_Var character_text) {
return PPB_InputEvent_Shared::CreateKeyboardInputEvent(
::ppapi::OBJECT_IS_IMPL, instance, type, time_stamp, modifiers, key_code,
character_text);
}
PP_Resource ResourceCreationImpl::CreateMouseInputEvent(
PP_Instance instance,
PP_InputEvent_Type type,
PP_TimeTicks time_stamp,
uint32_t modifiers,
PP_InputEvent_MouseButton mouse_button,
const PP_Point* mouse_position,
int32_t click_count,
const PP_Point* mouse_movement) {
return PPB_InputEvent_Shared::CreateMouseInputEvent(
::ppapi::OBJECT_IS_IMPL, instance, type, time_stamp, modifiers,
mouse_button, mouse_position, click_count, mouse_movement);
}
PP_Resource ResourceCreationImpl::CreateTouchInputEvent(
PP_Instance instance,
PP_InputEvent_Type type,
PP_TimeTicks time_stamp,
uint32_t modifiers) {
return PPB_InputEvent_Shared::CreateTouchInputEvent(
::ppapi::OBJECT_IS_IMPL, instance, type, time_stamp, modifiers);
}
PP_Resource ResourceCreationImpl::CreateNetworkMonitor(
PP_Instance instance,
PPB_NetworkMonitor_Callback callback,
void* user_data) {
return PPB_NetworkMonitor_Private_Impl::Create(instance, callback, user_data);
}
PP_Resource ResourceCreationImpl::CreateScrollbar(PP_Instance instance,
PP_Bool vertical) {
return PPB_Scrollbar_Impl::Create(instance, PP_ToBool(vertical));
}
PP_Resource ResourceCreationImpl::CreateTalk(PP_Instance /* instance */) {
// Not implemented in-process.
return 0;
}
PP_Resource ResourceCreationImpl::CreateResourceArray(
PP_Instance instance,
const PP_Resource elements[],
uint32_t size) {
PPB_ResourceArray_Shared* object = new PPB_ResourceArray_Shared(
::ppapi::OBJECT_IS_IMPL, instance, elements, size);
return object->GetReference();
}
PP_Resource ResourceCreationImpl::CreateTCPServerSocketPrivate(
PP_Instance instance) {
return PPB_TCPServerSocket_Private_Impl::CreateResource(instance);
}
PP_Resource ResourceCreationImpl::CreateTCPSocketPrivate(PP_Instance instance) {
return PPB_TCPSocket_Private_Impl::CreateResource(instance);
}
PP_Resource ResourceCreationImpl::CreateURLLoader(PP_Instance instance) {
return (new PPB_URLLoader_Impl(instance, false))->GetReference();
}
PP_Resource ResourceCreationImpl::CreateVideoCapture(PP_Instance instance) {
return 0; // VideoCapture is not supported in process now.
}
PP_Resource ResourceCreationImpl::CreateVideoDecoder(
PP_Instance instance,
PP_Resource graphics3d_id,
PP_VideoDecoder_Profile profile) {
return PPB_VideoDecoder_Impl::Create(instance, graphics3d_id, profile);
}
PP_Resource ResourceCreationImpl::CreateWheelInputEvent(
PP_Instance instance,
PP_TimeTicks time_stamp,
uint32_t modifiers,
const PP_FloatPoint* wheel_delta,
const PP_FloatPoint* wheel_ticks,
PP_Bool scroll_by_page) {
return PPB_InputEvent_Shared::CreateWheelInputEvent(
::ppapi::OBJECT_IS_IMPL, instance, time_stamp, modifiers,
wheel_delta, wheel_ticks, scroll_by_page);
}
PP_Resource ResourceCreationImpl::CreateX509CertificatePrivate(
PP_Instance instance) {
return PPB_X509Certificate_Private_Impl::CreateResource(instance);
}
} // namespace ppapi
} // namespace webkit
|