| 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 "content/public/browser/native_web_keyboard_event.h" | 5 #include "content/public/browser/native_web_keyboard_event.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "content/browser/renderer_host/web_input_event_aura.h" | 8 #include "content/browser/renderer_host/web_input_event_aura.h" |
| 9 #include "ui/events/base_event_utils.h" |
| 9 #include "ui/events/event.h" | 10 #include "ui/events/event.h" |
| 10 | 11 |
| 11 namespace { | 12 namespace { |
| 12 | 13 |
| 13 // We need to copy |os_event| in NativeWebKeyboardEvent because it is | 14 // We need to copy |os_event| in NativeWebKeyboardEvent because it is |
| 14 // queued in RenderWidgetHost and may be passed and used | 15 // queued in RenderWidgetHost and may be passed and used |
| 15 // RenderViewHostDelegate::HandledKeybardEvent after the original aura | 16 // RenderViewHostDelegate::HandledKeybardEvent after the original aura |
| 16 // event is destroyed. | 17 // event is destroyed. |
| 17 ui::Event* CopyEvent(const ui::Event* event) { | 18 ui::Event* CopyEvent(const ui::Event* event) { |
| 18 return event ? ui::Event::Clone(*event).release() : nullptr; | 19 return event ? ui::Event::Clone(*event).release() : nullptr; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 NOTREACHED(); | 79 NOTREACHED(); |
| 79 } | 80 } |
| 80 | 81 |
| 81 modifiers = EventFlagsToWebInputEventModifiers(state); | 82 modifiers = EventFlagsToWebInputEventModifiers(state); |
| 82 timeStampSeconds = time_stamp_seconds; | 83 timeStampSeconds = time_stamp_seconds; |
| 83 windowsKeyCode = character; | 84 windowsKeyCode = character; |
| 84 nativeKeyCode = character; | 85 nativeKeyCode = character; |
| 85 text[0] = character; | 86 text[0] = character; |
| 86 unmodifiedText[0] = character; | 87 unmodifiedText[0] = character; |
| 87 isSystemKey = | 88 isSystemKey = |
| 88 (state & ui::EF_ALT_DOWN) != 0 && (state & ui::EF_ALTGR_DOWN) == 0; | 89 ui::IsSystemKeyModifier(state) && (state & ui::EF_ALTGR_DOWN) == 0; |
| 89 setKeyIdentifierFromWindowsKeyCode(); | 90 setKeyIdentifierFromWindowsKeyCode(); |
| 90 } | 91 } |
| 91 | 92 |
| 92 NativeWebKeyboardEvent& NativeWebKeyboardEvent::operator=( | 93 NativeWebKeyboardEvent& NativeWebKeyboardEvent::operator=( |
| 93 const NativeWebKeyboardEvent& other) { | 94 const NativeWebKeyboardEvent& other) { |
| 94 WebKeyboardEvent::operator=(other); | 95 WebKeyboardEvent::operator=(other); |
| 95 delete os_event; | 96 delete os_event; |
| 96 os_event = CopyEvent(other.os_event); | 97 os_event = CopyEvent(other.os_event); |
| 97 skip_in_browser = other.skip_in_browser; | 98 skip_in_browser = other.skip_in_browser; |
| 98 match_edit_command = other.match_edit_command; | 99 match_edit_command = other.match_edit_command; |
| 99 return *this; | 100 return *this; |
| 100 } | 101 } |
| 101 | 102 |
| 102 NativeWebKeyboardEvent::~NativeWebKeyboardEvent() { | 103 NativeWebKeyboardEvent::~NativeWebKeyboardEvent() { |
| 103 delete os_event; | 104 delete os_event; |
| 104 } | 105 } |
| 105 | 106 |
| 106 } // namespace content | 107 } // namespace content |
| OLD | NEW |