| 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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 return enter.object()->GetCharacterText(); | 264 return enter.object()->GetCharacterText(); |
| 265 } | 265 } |
| 266 | 266 |
| 267 const PPB_KeyboardInputEvent g_ppb_keyboard_input_event_thunk = { | 267 const PPB_KeyboardInputEvent g_ppb_keyboard_input_event_thunk = { |
| 268 &CreateKeyboardInputEvent, | 268 &CreateKeyboardInputEvent, |
| 269 &IsKeyboardInputEvent, | 269 &IsKeyboardInputEvent, |
| 270 &GetKeyCode, | 270 &GetKeyCode, |
| 271 &GetCharacterText | 271 &GetCharacterText |
| 272 }; | 272 }; |
| 273 | 273 |
| 274 // _Dev interface. |
| 275 |
| 276 PP_Bool SetUsbScanCode(PP_Resource key_event, uint32_t usb_scan_code) { |
| 277 EnterInputEvent enter(key_event, true); |
| 278 if (enter.failed()) |
| 279 return PP_FALSE; |
| 280 return enter.object()->SetUsbScanCode(usb_scan_code); |
| 281 } |
| 282 |
| 283 uint32_t GetUsbScanCode(PP_Resource key_event) { |
| 284 EnterInputEvent enter(key_event, true); |
| 285 if (enter.failed()) |
| 286 return 0; |
| 287 return enter.object()->GetUsbScanCode(); |
| 288 } |
| 289 |
| 290 const PPB_KeyboardInputEvent_Dev g_ppb_keyboard_input_event_dev_thunk = { |
| 291 &SetUsbScanCode, |
| 292 &GetUsbScanCode, |
| 293 }; |
| 294 |
| 274 // Composition ----------------------------------------------------------------- | 295 // Composition ----------------------------------------------------------------- |
| 275 | 296 |
| 276 PP_Bool IsIMEInputEvent(PP_Resource resource) { | 297 PP_Bool IsIMEInputEvent(PP_Resource resource) { |
| 277 if (!IsInputEvent(resource)) | 298 if (!IsInputEvent(resource)) |
| 278 return PP_FALSE; // Prevent warning log in GetType. | 299 return PP_FALSE; // Prevent warning log in GetType. |
| 279 PP_InputEvent_Type type = GetType(resource); | 300 PP_InputEvent_Type type = GetType(resource); |
| 280 return PP_FromBool(type == PP_INPUTEVENT_TYPE_IME_COMPOSITION_START || | 301 return PP_FromBool(type == PP_INPUTEVENT_TYPE_IME_COMPOSITION_START || |
| 281 type == PP_INPUTEVENT_TYPE_IME_COMPOSITION_UPDATE || | 302 type == PP_INPUTEVENT_TYPE_IME_COMPOSITION_UPDATE || |
| 282 type == PP_INPUTEVENT_TYPE_IME_COMPOSITION_END || | 303 type == PP_INPUTEVENT_TYPE_IME_COMPOSITION_END || |
| 283 type == PP_INPUTEVENT_TYPE_IME_TEXT); | 304 type == PP_INPUTEVENT_TYPE_IME_TEXT); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 } | 361 } |
| 341 | 362 |
| 342 const PPB_MouseInputEvent_1_1* GetPPB_MouseInputEvent_1_1_Thunk() { | 363 const PPB_MouseInputEvent_1_1* GetPPB_MouseInputEvent_1_1_Thunk() { |
| 343 return &g_ppb_mouse_input_event_1_1_thunk; | 364 return &g_ppb_mouse_input_event_1_1_thunk; |
| 344 } | 365 } |
| 345 | 366 |
| 346 const PPB_KeyboardInputEvent_1_0* GetPPB_KeyboardInputEvent_1_0_Thunk() { | 367 const PPB_KeyboardInputEvent_1_0* GetPPB_KeyboardInputEvent_1_0_Thunk() { |
| 347 return &g_ppb_keyboard_input_event_thunk; | 368 return &g_ppb_keyboard_input_event_thunk; |
| 348 } | 369 } |
| 349 | 370 |
| 371 const PPB_KeyboardInputEvent_Dev_0_1* |
| 372 GetPPB_KeyboardInputEvent_Dev_0_1_Thunk() { |
| 373 return &g_ppb_keyboard_input_event_dev_thunk; |
| 374 } |
| 375 |
| 350 const PPB_WheelInputEvent_1_0* GetPPB_WheelInputEvent_1_0_Thunk() { | 376 const PPB_WheelInputEvent_1_0* GetPPB_WheelInputEvent_1_0_Thunk() { |
| 351 return &g_ppb_wheel_input_event_thunk; | 377 return &g_ppb_wheel_input_event_thunk; |
| 352 } | 378 } |
| 353 | 379 |
| 354 const PPB_IMEInputEvent_Dev_0_1* GetPPB_IMEInputEvent_Dev_0_1_Thunk() { | 380 const PPB_IMEInputEvent_Dev_0_1* GetPPB_IMEInputEvent_Dev_0_1_Thunk() { |
| 355 return &g_ppb_ime_input_event_thunk; | 381 return &g_ppb_ime_input_event_thunk; |
| 356 } | 382 } |
| 357 | 383 |
| 358 } // namespace thunk | 384 } // namespace thunk |
| 359 } // namespace ppapi | 385 } // namespace ppapi |
| OLD | NEW |