OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 #include "webkit/plugins/ppapi/resource_creation_impl.h" | 5 #include "webkit/plugins/ppapi/resource_creation_impl.h" |
6 | 6 |
7 #include "ppapi/c/pp_size.h" | 7 #include "ppapi/c/pp_size.h" |
8 #include "ppapi/shared_impl/ppb_audio_config_shared.h" | 8 #include "ppapi/shared_impl/ppb_audio_config_shared.h" |
9 #include "ppapi/shared_impl/private/ppb_browser_font_trusted_shared.h" | 9 #include "ppapi/shared_impl/private/ppb_browser_font_trusted_shared.h" |
10 #include "ppapi/shared_impl/ppb_input_event_shared.h" | 10 #include "ppapi/shared_impl/ppb_input_event_shared.h" |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
175 return (new PPB_HostResolver_Private_Impl(instance))->GetReference(); | 175 return (new PPB_HostResolver_Private_Impl(instance))->GetReference(); |
176 } | 176 } |
177 | 177 |
178 PP_Resource ResourceCreationImpl::CreateImageData(PP_Instance instance, | 178 PP_Resource ResourceCreationImpl::CreateImageData(PP_Instance instance, |
179 PP_ImageDataFormat format, | 179 PP_ImageDataFormat format, |
180 const PP_Size& size, | 180 const PP_Size& size, |
181 PP_Bool init_to_zero) { | 181 PP_Bool init_to_zero) { |
182 return PPB_ImageData_Impl::Create(instance, format, size, init_to_zero); | 182 return PPB_ImageData_Impl::Create(instance, format, size, init_to_zero); |
183 } | 183 } |
184 | 184 |
185 PP_Resource ResourceCreationImpl::CreateIMEInputEvent( | |
186 PP_Instance instance, | |
187 PP_InputEvent_Type type, | |
188 PP_TimeTicks time_stamp, | |
189 struct PP_Var text, | |
190 uint32_t segment_number, | |
191 const uint32_t* segment_offsets, | |
192 int32_t target_segment, | |
193 uint32_t selection_start, | |
194 uint32_t selection_end) { | |
195 if (type != PP_INPUTEVENT_TYPE_IME_COMPOSITION_START && | |
yzshen1
2012/05/15 18:03:48
Please put the implementation in ppb_input_event_s
kinaba
2012/05/16 10:13:57
Done. I also did the refactoring for other input e
yzshen1
2012/05/16 20:33:28
I don't know of any reason not to do that.
Thanks!
| |
196 type != PP_INPUTEVENT_TYPE_IME_COMPOSITION_UPDATE && | |
197 type != PP_INPUTEVENT_TYPE_IME_COMPOSITION_END && | |
198 type != PP_INPUTEVENT_TYPE_IME_TEXT) | |
199 return 0; | |
200 | |
201 InputEventData data; | |
202 data.event_type = type; | |
203 data.event_time_stamp = time_stamp; | |
204 if (text.type == PP_VARTYPE_STRING) { | |
205 StringVar* text_str = StringVar::FromPPVar(text); | |
206 if (!text_str) | |
207 return 0; | |
208 data.character_text = text_str->value(); | |
209 } | |
210 data.composition_target_segment = target_segment; | |
211 if (segment_number != 0) { | |
212 data.composition_segment_offsets.assign(&segment_offsets[0], | |
213 &segment_offsets[segment_number+1]); | |
214 } | |
215 data.composition_selection_start = selection_start; | |
216 data.composition_selection_end = selection_end; | |
217 | |
218 return (new PPB_InputEvent_Shared(::ppapi::OBJECT_IS_IMPL, | |
219 instance, data))->GetReference(); | |
220 } | |
221 | |
185 PP_Resource ResourceCreationImpl::CreateKeyboardInputEvent( | 222 PP_Resource ResourceCreationImpl::CreateKeyboardInputEvent( |
186 PP_Instance instance, | 223 PP_Instance instance, |
187 PP_InputEvent_Type type, | 224 PP_InputEvent_Type type, |
188 PP_TimeTicks time_stamp, | 225 PP_TimeTicks time_stamp, |
189 uint32_t modifiers, | 226 uint32_t modifiers, |
190 uint32_t key_code, | 227 uint32_t key_code, |
191 struct PP_Var character_text) { | 228 struct PP_Var character_text) { |
192 if (type != PP_INPUTEVENT_TYPE_RAWKEYDOWN && | 229 if (type != PP_INPUTEVENT_TYPE_RAWKEYDOWN && |
193 type != PP_INPUTEVENT_TYPE_KEYDOWN && | 230 type != PP_INPUTEVENT_TYPE_KEYDOWN && |
194 type != PP_INPUTEVENT_TYPE_KEYUP && | 231 type != PP_INPUTEVENT_TYPE_KEYUP && |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
342 instance, data))->GetReference(); | 379 instance, data))->GetReference(); |
343 } | 380 } |
344 | 381 |
345 PP_Resource ResourceCreationImpl::CreateX509CertificatePrivate( | 382 PP_Resource ResourceCreationImpl::CreateX509CertificatePrivate( |
346 PP_Instance instance) { | 383 PP_Instance instance) { |
347 return PPB_X509Certificate_Private_Impl::CreateResource(instance); | 384 return PPB_X509Certificate_Private_Impl::CreateResource(instance); |
348 } | 385 } |
349 | 386 |
350 } // namespace ppapi | 387 } // namespace ppapi |
351 } // namespace webkit | 388 } // namespace webkit |
OLD | NEW |