| 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 "content/renderer/pepper/event_conversion.h" | 5 #include "content/renderer/pepper/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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 return result; | 128 return result; |
| 129 } | 129 } |
| 130 | 130 |
| 131 void AppendKeyEvent(const WebInputEvent& event, | 131 void AppendKeyEvent(const WebInputEvent& event, |
| 132 std::vector<InputEventData>* result_events) { | 132 std::vector<InputEventData>* result_events) { |
| 133 const WebKeyboardEvent& key_event = | 133 const WebKeyboardEvent& key_event = |
| 134 static_cast<const WebKeyboardEvent&>(event); | 134 static_cast<const WebKeyboardEvent&>(event); |
| 135 InputEventData result = GetEventWithCommonFieldsAndType(event); | 135 InputEventData result = GetEventWithCommonFieldsAndType(event); |
| 136 result.event_modifiers = key_event.modifiers; | 136 result.event_modifiers = key_event.modifiers; |
| 137 result.key_code = key_event.windowsKeyCode; | 137 result.key_code = key_event.windowsKeyCode; |
| 138 #if defined(OS_MACOSX) | |
| 139 // Workaround for |domCode| not being set on OS X. crbug.com/493833 | |
| 140 result.code = ui::KeycodeConverter::DomCodeToCodeString( | |
| 141 ui::KeycodeConverter::NativeKeycodeToDomCode(key_event.nativeKeyCode)); | |
| 142 #else | |
| 143 result.code = ui::KeycodeConverter::DomCodeToCodeString( | 138 result.code = ui::KeycodeConverter::DomCodeToCodeString( |
| 144 static_cast<ui::DomCode>(key_event.domCode)); | 139 static_cast<ui::DomCode>(key_event.domCode)); |
| 145 #endif | |
| 146 result_events->push_back(result); | 140 result_events->push_back(result); |
| 147 } | 141 } |
| 148 | 142 |
| 149 void AppendCharEvent(const WebInputEvent& event, | 143 void AppendCharEvent(const WebInputEvent& event, |
| 150 std::vector<InputEventData>* result_events) { | 144 std::vector<InputEventData>* result_events) { |
| 151 const WebKeyboardEvent& key_event = | 145 const WebKeyboardEvent& key_event = |
| 152 static_cast<const WebKeyboardEvent&>(event); | 146 static_cast<const WebKeyboardEvent&>(event); |
| 153 | 147 |
| 154 // This is a bit complex, the input event will normally just have one 16-bit | 148 // This is a bit complex, the input event will normally just have one 16-bit |
| 155 // character in it, but may be zero or more than one. The text array is | 149 // character in it, but may be zero or more than one. The text array is |
| (...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 749 case WebInputEvent::TouchStart: | 743 case WebInputEvent::TouchStart: |
| 750 return PP_INPUTEVENT_CLASS_TOUCH; | 744 return PP_INPUTEVENT_CLASS_TOUCH; |
| 751 case WebInputEvent::Undefined: | 745 case WebInputEvent::Undefined: |
| 752 default: | 746 default: |
| 753 CHECK(WebInputEvent::isGestureEventType(type)); | 747 CHECK(WebInputEvent::isGestureEventType(type)); |
| 754 return PP_InputEvent_Class(0); | 748 return PP_InputEvent_Class(0); |
| 755 } | 749 } |
| 756 } | 750 } |
| 757 | 751 |
| 758 } // namespace content | 752 } // namespace content |
| OLD | NEW |