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/event.h" | 9 #include "ui/events/event.h" |
10 | 10 |
(...skipping 16 matching lines...) Expand all Loading... |
27 } | 27 } |
28 | 28 |
29 } // namespace | 29 } // namespace |
30 | 30 |
31 using blink::WebKeyboardEvent; | 31 using blink::WebKeyboardEvent; |
32 | 32 |
33 namespace content { | 33 namespace content { |
34 | 34 |
35 NativeWebKeyboardEvent::NativeWebKeyboardEvent() | 35 NativeWebKeyboardEvent::NativeWebKeyboardEvent() |
36 : os_event(NULL), | 36 : os_event(NULL), |
37 skip_in_browser(false) { | 37 skip_in_browser(false), |
| 38 match_edit_command(false) { |
38 } | 39 } |
39 | 40 |
40 NativeWebKeyboardEvent::NativeWebKeyboardEvent(gfx::NativeEvent native_event) | 41 NativeWebKeyboardEvent::NativeWebKeyboardEvent(gfx::NativeEvent native_event) |
41 : WebKeyboardEvent(MakeWebKeyboardEvent( | 42 : WebKeyboardEvent(MakeWebKeyboardEvent( |
42 static_cast<ui::KeyEvent*>(native_event))), | 43 static_cast<ui::KeyEvent*>(native_event))), |
43 os_event(CopyEvent(native_event)), | 44 os_event(CopyEvent(native_event)), |
44 skip_in_browser(false) { | 45 skip_in_browser(false), |
| 46 match_edit_command(false) { |
45 } | 47 } |
46 | 48 |
47 NativeWebKeyboardEvent::NativeWebKeyboardEvent( | 49 NativeWebKeyboardEvent::NativeWebKeyboardEvent( |
48 const NativeWebKeyboardEvent& other) | 50 const NativeWebKeyboardEvent& other) |
49 : WebKeyboardEvent(other), | 51 : WebKeyboardEvent(other), |
50 os_event(CopyEvent(other.os_event)), | 52 os_event(CopyEvent(other.os_event)), |
51 skip_in_browser(other.skip_in_browser) { | 53 skip_in_browser(other.skip_in_browser), |
| 54 match_edit_command(false) { |
52 } | 55 } |
53 | 56 |
54 NativeWebKeyboardEvent::NativeWebKeyboardEvent( | 57 NativeWebKeyboardEvent::NativeWebKeyboardEvent( |
55 ui::EventType key_event_type, | 58 ui::EventType key_event_type, |
56 bool is_char, | 59 bool is_char, |
57 wchar_t character, | 60 wchar_t character, |
58 int state, | 61 int state, |
59 double time_stamp_seconds) | 62 double time_stamp_seconds) |
60 : os_event(NULL), | 63 : os_event(NULL), |
61 skip_in_browser(false) { | 64 skip_in_browser(false), |
| 65 match_edit_command(false) { |
62 switch (key_event_type) { | 66 switch (key_event_type) { |
63 case ui::ET_KEY_PRESSED: | 67 case ui::ET_KEY_PRESSED: |
64 type = is_char ? blink::WebInputEvent::Char : | 68 type = is_char ? blink::WebInputEvent::Char : |
65 blink::WebInputEvent::RawKeyDown; | 69 blink::WebInputEvent::RawKeyDown; |
66 break; | 70 break; |
67 case ui::ET_KEY_RELEASED: | 71 case ui::ET_KEY_RELEASED: |
68 type = blink::WebInputEvent::KeyUp; | 72 type = blink::WebInputEvent::KeyUp; |
69 break; | 73 break; |
70 default: | 74 default: |
71 NOTREACHED(); | 75 NOTREACHED(); |
72 } | 76 } |
73 | 77 |
74 modifiers = EventFlagsToWebInputEventModifiers(state); | 78 modifiers = EventFlagsToWebInputEventModifiers(state); |
75 timeStampSeconds = time_stamp_seconds; | 79 timeStampSeconds = time_stamp_seconds; |
76 windowsKeyCode = character; | 80 windowsKeyCode = character; |
77 nativeKeyCode = character; | 81 nativeKeyCode = character; |
78 text[0] = character; | 82 text[0] = character; |
79 unmodifiedText[0] = character; | 83 unmodifiedText[0] = character; |
80 isSystemKey = | 84 isSystemKey = |
81 (state & ui::EF_ALT_DOWN) != 0 && (state & ui::EF_ALTGR_DOWN) == 0; | 85 (state & ui::EF_ALT_DOWN) != 0 && (state & ui::EF_ALTGR_DOWN) == 0; |
82 setKeyIdentifierFromWindowsKeyCode(); | 86 setKeyIdentifierFromWindowsKeyCode(); |
83 } | 87 } |
84 | 88 |
85 NativeWebKeyboardEvent& NativeWebKeyboardEvent::operator=( | 89 NativeWebKeyboardEvent& NativeWebKeyboardEvent::operator=( |
86 const NativeWebKeyboardEvent& other) { | 90 const NativeWebKeyboardEvent& other) { |
87 WebKeyboardEvent::operator=(other); | 91 WebKeyboardEvent::operator=(other); |
88 delete os_event; | 92 delete os_event; |
89 os_event = CopyEvent(other.os_event); | 93 os_event = CopyEvent(other.os_event); |
90 skip_in_browser = other.skip_in_browser; | 94 skip_in_browser = other.skip_in_browser; |
91 | 95 match_edit_command = other.match_edit_command; |
92 return *this; | 96 return *this; |
93 } | 97 } |
94 | 98 |
95 NativeWebKeyboardEvent::~NativeWebKeyboardEvent() { | 99 NativeWebKeyboardEvent::~NativeWebKeyboardEvent() { |
96 delete os_event; | 100 delete os_event; |
97 } | 101 } |
98 | 102 |
99 } // namespace content | 103 } // namespace content |
OLD | NEW |