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/event_conversion.h" | 5 #include "webkit/plugins/ppapi/event_conversion.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/i18n/char_iterator.h" | 8 #include "base/i18n/char_iterator.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 } | 66 } |
67 } | 67 } |
68 | 68 |
69 // Generates a PP_InputEvent with the fields common to all events, as well as | 69 // Generates a PP_InputEvent with the fields common to all events, as well as |
70 // the event type from the given web event. Event-specific fields will be zero | 70 // the event type from the given web event. Event-specific fields will be zero |
71 // initialized. | 71 // initialized. |
72 InputEventData GetEventWithCommonFieldsAndType(const WebInputEvent& web_event) { | 72 InputEventData GetEventWithCommonFieldsAndType(const WebInputEvent& web_event) { |
73 InputEventData result; | 73 InputEventData result; |
74 result.event_type = ConvertEventTypes(web_event.type); | 74 result.event_type = ConvertEventTypes(web_event.type); |
75 result.event_time_stamp = EventTimeToPPTimeTicks(web_event.timeStampSeconds); | 75 result.event_time_stamp = EventTimeToPPTimeTicks(web_event.timeStampSeconds); |
| 76 result.usb_key_code = 0; |
76 return result; | 77 return result; |
77 } | 78 } |
78 | 79 |
79 void AppendKeyEvent(const WebInputEvent& event, | 80 void AppendKeyEvent(const WebInputEvent& event, |
80 std::vector<InputEventData>* result_events) { | 81 std::vector<InputEventData>* result_events) { |
81 const WebKeyboardEvent& key_event = | 82 const WebKeyboardEvent& key_event = |
82 static_cast<const WebKeyboardEvent&>(event); | 83 static_cast<const WebKeyboardEvent&>(event); |
83 InputEventData result = GetEventWithCommonFieldsAndType(event); | 84 InputEventData result = GetEventWithCommonFieldsAndType(event); |
84 result.event_modifiers = key_event.modifiers; | 85 result.event_modifiers = key_event.modifiers; |
85 result.key_code = key_event.windowsKeyCode; | 86 result.key_code = key_event.windowsKeyCode; |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 output_pad.buttons_length = webkit_pad.buttonsLength; | 545 output_pad.buttons_length = webkit_pad.buttonsLength; |
545 memcpy(output_pad.buttons, | 546 memcpy(output_pad.buttons, |
546 webkit_pad.buttons, | 547 webkit_pad.buttons, |
547 sizeof(output_pad.buttons)); | 548 sizeof(output_pad.buttons)); |
548 } | 549 } |
549 } | 550 } |
550 } | 551 } |
551 | 552 |
552 } // namespace ppapi | 553 } // namespace ppapi |
553 } // namespace webkit | 554 } // namespace webkit |
OLD | NEW |