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 "ppapi/c/pp_errors.h" | 5 #include "ppapi/c/pp_errors.h" |
6 #include "ppapi/thunk/thunk.h" | 6 #include "ppapi/thunk/thunk.h" |
7 #include "ppapi/thunk/enter.h" | 7 #include "ppapi/thunk/enter.h" |
8 #include "ppapi/thunk/ppb_input_event_api.h" | 8 #include "ppapi/thunk/ppb_input_event_api.h" |
9 #include "ppapi/thunk/ppb_instance_api.h" | 9 #include "ppapi/thunk/ppb_instance_api.h" |
10 #include "ppapi/thunk/resource_creation_api.h" | 10 #include "ppapi/thunk/resource_creation_api.h" |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 return enter.object()->GetUsbKeyCode(); | 286 return enter.object()->GetUsbKeyCode(); |
287 } | 287 } |
288 | 288 |
289 const PPB_KeyboardInputEvent_Dev g_ppb_keyboard_input_event_dev_thunk = { | 289 const PPB_KeyboardInputEvent_Dev g_ppb_keyboard_input_event_dev_thunk = { |
290 &SetUsbKeyCode, | 290 &SetUsbKeyCode, |
291 &GetUsbKeyCode, | 291 &GetUsbKeyCode, |
292 }; | 292 }; |
293 | 293 |
294 // Composition ----------------------------------------------------------------- | 294 // Composition ----------------------------------------------------------------- |
295 | 295 |
| 296 PP_Resource CreateIMEInputEvent(PP_Instance instance, |
| 297 PP_InputEvent_Type type, |
| 298 PP_TimeTicks time_stamp, |
| 299 PP_Var text, |
| 300 uint32_t segment_number, |
| 301 const uint32_t segment_offsets[], |
| 302 int32_t target_segment, |
| 303 uint32_t selection_start, |
| 304 uint32_t selection_end) { |
| 305 EnterResourceCreation enter(instance); |
| 306 if (enter.failed()) |
| 307 return 0; |
| 308 return enter.functions()->CreateIMEInputEvent(instance, type, time_stamp, |
| 309 text, segment_number, |
| 310 segment_offsets, |
| 311 target_segment, |
| 312 selection_start, |
| 313 selection_end); |
| 314 } |
| 315 |
296 PP_Bool IsIMEInputEvent(PP_Resource resource) { | 316 PP_Bool IsIMEInputEvent(PP_Resource resource) { |
297 if (!IsInputEvent(resource)) | 317 if (!IsInputEvent(resource)) |
298 return PP_FALSE; // Prevent warning log in GetType. | 318 return PP_FALSE; // Prevent warning log in GetType. |
299 PP_InputEvent_Type type = GetType(resource); | 319 PP_InputEvent_Type type = GetType(resource); |
300 return PP_FromBool(type == PP_INPUTEVENT_TYPE_IME_COMPOSITION_START || | 320 return PP_FromBool(type == PP_INPUTEVENT_TYPE_IME_COMPOSITION_START || |
301 type == PP_INPUTEVENT_TYPE_IME_COMPOSITION_UPDATE || | 321 type == PP_INPUTEVENT_TYPE_IME_COMPOSITION_UPDATE || |
302 type == PP_INPUTEVENT_TYPE_IME_COMPOSITION_END || | 322 type == PP_INPUTEVENT_TYPE_IME_COMPOSITION_END || |
303 type == PP_INPUTEVENT_TYPE_IME_TEXT); | 323 type == PP_INPUTEVENT_TYPE_IME_TEXT); |
304 } | 324 } |
305 | 325 |
(...skipping 27 matching lines...) Expand all Loading... |
333 if (enter.failed()) { | 353 if (enter.failed()) { |
334 if (start) | 354 if (start) |
335 *start = 0; | 355 *start = 0; |
336 if (end) | 356 if (end) |
337 *end = 0; | 357 *end = 0; |
338 return; | 358 return; |
339 } | 359 } |
340 enter.object()->GetIMESelection(start, end); | 360 enter.object()->GetIMESelection(start, end); |
341 } | 361 } |
342 | 362 |
343 const PPB_IMEInputEvent_Dev g_ppb_ime_input_event_thunk = { | 363 const PPB_IMEInputEvent_Dev_0_1 g_ppb_ime_input_event_0_1_thunk = { |
344 &IsIMEInputEvent, | 364 &IsIMEInputEvent, |
345 &GetIMEText, | 365 &GetIMEText, |
346 &GetIMESegmentNumber, | 366 &GetIMESegmentNumber, |
| 367 &GetIMESegmentOffset, |
| 368 &GetIMETargetSegment, |
| 369 &GetIMESelection |
| 370 }; |
| 371 |
| 372 const PPB_IMEInputEvent_Dev_0_2 g_ppb_ime_input_event_0_2_thunk = { |
| 373 &CreateIMEInputEvent, |
| 374 &IsIMEInputEvent, |
| 375 &GetIMEText, |
| 376 &GetIMESegmentNumber, |
347 &GetIMESegmentOffset, | 377 &GetIMESegmentOffset, |
348 &GetIMETargetSegment, | 378 &GetIMETargetSegment, |
349 &GetIMESelection | 379 &GetIMESelection |
350 }; | 380 }; |
351 | 381 |
352 } // namespace | 382 } // namespace |
353 | 383 |
354 const PPB_InputEvent_1_0* GetPPB_InputEvent_1_0_Thunk() { | 384 const PPB_InputEvent_1_0* GetPPB_InputEvent_1_0_Thunk() { |
355 return &g_ppb_input_event_thunk; | 385 return &g_ppb_input_event_thunk; |
356 } | 386 } |
(...skipping 13 matching lines...) Expand all Loading... |
370 const PPB_KeyboardInputEvent_Dev_0_1* | 400 const PPB_KeyboardInputEvent_Dev_0_1* |
371 GetPPB_KeyboardInputEvent_Dev_0_1_Thunk() { | 401 GetPPB_KeyboardInputEvent_Dev_0_1_Thunk() { |
372 return &g_ppb_keyboard_input_event_dev_thunk; | 402 return &g_ppb_keyboard_input_event_dev_thunk; |
373 } | 403 } |
374 | 404 |
375 const PPB_WheelInputEvent_1_0* GetPPB_WheelInputEvent_1_0_Thunk() { | 405 const PPB_WheelInputEvent_1_0* GetPPB_WheelInputEvent_1_0_Thunk() { |
376 return &g_ppb_wheel_input_event_thunk; | 406 return &g_ppb_wheel_input_event_thunk; |
377 } | 407 } |
378 | 408 |
379 const PPB_IMEInputEvent_Dev_0_1* GetPPB_IMEInputEvent_Dev_0_1_Thunk() { | 409 const PPB_IMEInputEvent_Dev_0_1* GetPPB_IMEInputEvent_Dev_0_1_Thunk() { |
380 return &g_ppb_ime_input_event_thunk; | 410 return &g_ppb_ime_input_event_0_1_thunk; |
| 411 } |
| 412 |
| 413 const PPB_IMEInputEvent_Dev_0_2* GetPPB_IMEInputEvent_Dev_0_2_Thunk() { |
| 414 return &g_ppb_ime_input_event_0_2_thunk; |
381 } | 415 } |
382 | 416 |
383 } // namespace thunk | 417 } // namespace thunk |
384 } // namespace ppapi | 418 } // namespace ppapi |
OLD | NEW |