| OLD | NEW |
| 1 // Copyright (c) 2011 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" |
| 11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 return result; | 74 return result; |
| 75 } | 75 } |
| 76 | 76 |
| 77 void AppendKeyEvent(const WebInputEvent& event, | 77 void AppendKeyEvent(const WebInputEvent& event, |
| 78 std::vector<InputEventData>* result_events) { | 78 std::vector<InputEventData>* result_events) { |
| 79 const WebKeyboardEvent& key_event = | 79 const WebKeyboardEvent& key_event = |
| 80 static_cast<const WebKeyboardEvent&>(event); | 80 static_cast<const WebKeyboardEvent&>(event); |
| 81 InputEventData result = GetEventWithCommonFieldsAndType(event); | 81 InputEventData result = GetEventWithCommonFieldsAndType(event); |
| 82 result.event_modifiers = key_event.modifiers; | 82 result.event_modifiers = key_event.modifiers; |
| 83 result.key_code = key_event.windowsKeyCode; | 83 result.key_code = key_event.windowsKeyCode; |
| 84 // TODO(garykac): Platform-specific code to convert from |
| 85 // |key_event.nativeKeyCode| to USB key code. |
| 86 result.usb_key_code = 0; |
| 84 result_events->push_back(result); | 87 result_events->push_back(result); |
| 85 } | 88 } |
| 86 | 89 |
| 87 void AppendCharEvent(const WebInputEvent& event, | 90 void AppendCharEvent(const WebInputEvent& event, |
| 88 std::vector<InputEventData>* result_events) { | 91 std::vector<InputEventData>* result_events) { |
| 89 const WebKeyboardEvent& key_event = | 92 const WebKeyboardEvent& key_event = |
| 90 static_cast<const WebKeyboardEvent&>(event); | 93 static_cast<const WebKeyboardEvent&>(event); |
| 91 | 94 |
| 92 // This is a bit complex, the input event will normally just have one 16-bit | 95 // This is a bit complex, the input event will normally just have one 16-bit |
| 93 // character in it, but may be zero or more than one. The text array is | 96 // character in it, but may be zero or more than one. The text array is |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 return PP_INPUTEVENT_CLASS_KEYBOARD; | 518 return PP_INPUTEVENT_CLASS_KEYBOARD; |
| 516 case WebInputEvent::Undefined: | 519 case WebInputEvent::Undefined: |
| 517 default: | 520 default: |
| 518 NOTREACHED(); | 521 NOTREACHED(); |
| 519 return PP_InputEvent_Class(0); | 522 return PP_InputEvent_Class(0); |
| 520 } | 523 } |
| 521 } | 524 } |
| 522 | 525 |
| 523 } // namespace ppapi | 526 } // namespace ppapi |
| 524 } // namespace webkit | 527 } // namespace webkit |
| OLD | NEW |