OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/chromeos/input_method/input_method_engine.h" | 5 #include "chrome/browser/chromeos/input_method/input_method_engine.h" |
6 | 6 |
7 #undef FocusIn | 7 #undef FocusIn |
8 #undef FocusOut | 8 #undef FocusOut |
9 #undef RootWindow | 9 #undef RootWindow |
10 #include <map> | 10 #include <map> |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 | 130 |
131 void GetExtensionKeyboardEventFromKeyEvent( | 131 void GetExtensionKeyboardEventFromKeyEvent( |
132 const ui::KeyEvent& event, | 132 const ui::KeyEvent& event, |
133 InputMethodEngine::KeyboardEvent* ext_event) { | 133 InputMethodEngine::KeyboardEvent* ext_event) { |
134 DCHECK(event.type() == ui::ET_KEY_RELEASED || | 134 DCHECK(event.type() == ui::ET_KEY_RELEASED || |
135 event.type() == ui::ET_KEY_PRESSED); | 135 event.type() == ui::ET_KEY_PRESSED); |
136 DCHECK(ext_event); | 136 DCHECK(ext_event); |
137 ext_event->type = (event.type() == ui::ET_KEY_RELEASED) ? "keyup" : "keydown"; | 137 ext_event->type = (event.type() == ui::ET_KEY_RELEASED) ? "keyup" : "keydown"; |
138 | 138 |
139 std::string dom_code = event.code(); | 139 std::string dom_code = event.code(); |
140 if (dom_code == | 140 if (dom_code == ui::KeycodeConverter::InvalidKeyboardEventCode()) |
141 ui::KeycodeConverter::GetInstance()->InvalidKeyboardEventCode()) | |
142 dom_code = ui::KeyboardCodeToDomKeycode(event.key_code()); | 141 dom_code = ui::KeyboardCodeToDomKeycode(event.key_code()); |
143 ext_event->code = dom_code; | 142 ext_event->code = dom_code; |
144 ext_event->key_code = static_cast<int>(event.key_code()); | 143 ext_event->key_code = static_cast<int>(event.key_code()); |
145 ext_event->alt_key = event.IsAltDown(); | 144 ext_event->alt_key = event.IsAltDown(); |
146 ext_event->ctrl_key = event.IsControlDown(); | 145 ext_event->ctrl_key = event.IsControlDown(); |
147 ext_event->shift_key = event.IsShiftDown(); | 146 ext_event->shift_key = event.IsShiftDown(); |
148 ext_event->caps_lock = event.IsCapsLockDown(); | 147 ext_event->caps_lock = event.IsCapsLockDown(); |
149 ext_event->key = GetKeyFromEvent(event); | 148 ext_event->key = GetKeyFromEvent(event); |
150 } | 149 } |
151 | 150 |
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 // TODO(nona): Implement it. | 673 // TODO(nona): Implement it. |
675 break; | 674 break; |
676 } | 675 } |
677 } | 676 } |
678 } | 677 } |
679 | 678 |
680 // TODO(nona): Support item.children. | 679 // TODO(nona): Support item.children. |
681 } | 680 } |
682 | 681 |
683 } // namespace chromeos | 682 } // namespace chromeos |
OLD | NEW |