OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 modifiers, key_code, | 203 modifiers, key_code, |
204 character_text); | 204 character_text); |
205 } | 205 } |
206 | 206 |
207 PP_Bool IsKeyboardInputEvent(PP_Resource resource) { | 207 PP_Bool IsKeyboardInputEvent(PP_Resource resource) { |
208 if (!IsInputEvent(resource)) | 208 if (!IsInputEvent(resource)) |
209 return PP_FALSE; // Prevent warning log in GetType. | 209 return PP_FALSE; // Prevent warning log in GetType. |
210 PP_InputEvent_Type type = GetType(resource); | 210 PP_InputEvent_Type type = GetType(resource); |
211 return PP_FromBool(type == PP_INPUTEVENT_TYPE_KEYDOWN || | 211 return PP_FromBool(type == PP_INPUTEVENT_TYPE_KEYDOWN || |
212 type == PP_INPUTEVENT_TYPE_KEYUP || | 212 type == PP_INPUTEVENT_TYPE_KEYUP || |
| 213 type == PP_INPUTEVENT_TYPE_RAWKEYDOWN || |
213 type == PP_INPUTEVENT_TYPE_CHAR); | 214 type == PP_INPUTEVENT_TYPE_CHAR); |
214 } | 215 } |
215 | 216 |
216 uint32_t GetKeyCode(PP_Resource key_event) { | 217 uint32_t GetKeyCode(PP_Resource key_event) { |
217 EnterInputEvent enter(key_event, true); | 218 EnterInputEvent enter(key_event, true); |
218 if (enter.failed()) | 219 if (enter.failed()) |
219 return 0; | 220 return 0; |
220 return enter.object()->GetKeyCode(); | 221 return enter.object()->GetKeyCode(); |
221 } | 222 } |
222 | 223 |
(...skipping 24 matching lines...) Expand all Loading... |
247 const PPB_KeyboardInputEvent* GetPPB_KeyboardInputEvent_Thunk() { | 248 const PPB_KeyboardInputEvent* GetPPB_KeyboardInputEvent_Thunk() { |
248 return &g_ppb_keyboard_input_event_thunk; | 249 return &g_ppb_keyboard_input_event_thunk; |
249 } | 250 } |
250 | 251 |
251 const PPB_WheelInputEvent* GetPPB_WheelInputEvent_Thunk() { | 252 const PPB_WheelInputEvent* GetPPB_WheelInputEvent_Thunk() { |
252 return &g_ppb_wheel_input_event_thunk; | 253 return &g_ppb_wheel_input_event_thunk; |
253 } | 254 } |
254 | 255 |
255 } // namespace thunk | 256 } // namespace thunk |
256 } // namespace ppapi | 257 } // namespace ppapi |
OLD | NEW |