| 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 11 matching lines...) Expand all Loading... |
| 22 #include "chromeos/ime/component_extension_ime_manager.h" | 22 #include "chromeos/ime/component_extension_ime_manager.h" |
| 23 #include "chromeos/ime/composition_text.h" | 23 #include "chromeos/ime/composition_text.h" |
| 24 #include "chromeos/ime/extension_ime_util.h" | 24 #include "chromeos/ime/extension_ime_util.h" |
| 25 #include "chromeos/ime/input_method_manager.h" | 25 #include "chromeos/ime/input_method_manager.h" |
| 26 #include "ui/aura/window.h" | 26 #include "ui/aura/window.h" |
| 27 #include "ui/aura/window_tree_host.h" | 27 #include "ui/aura/window_tree_host.h" |
| 28 #include "ui/base/ime/candidate_window.h" | 28 #include "ui/base/ime/candidate_window.h" |
| 29 #include "ui/base/ime/chromeos/ime_keymap.h" | 29 #include "ui/base/ime/chromeos/ime_keymap.h" |
| 30 #include "ui/events/event.h" | 30 #include "ui/events/event.h" |
| 31 #include "ui/events/event_processor.h" | 31 #include "ui/events/event_processor.h" |
| 32 #include "ui/events/keycodes/dom4/keycode_converter.h" |
| 32 #include "ui/keyboard/keyboard_controller.h" | 33 #include "ui/keyboard/keyboard_controller.h" |
| 33 #include "ui/keyboard/keyboard_util.h" | 34 #include "ui/keyboard/keyboard_util.h" |
| 34 | 35 |
| 35 namespace chromeos { | 36 namespace chromeos { |
| 36 const char* kErrorNotActive = "IME is not active"; | 37 const char* kErrorNotActive = "IME is not active"; |
| 37 const char* kErrorWrongContext = "Context is not active"; | 38 const char* kErrorWrongContext = "Context is not active"; |
| 38 const char* kCandidateNotFound = "Candidate not found"; | 39 const char* kCandidateNotFound = "Candidate not found"; |
| 39 | 40 |
| 40 namespace { | 41 namespace { |
| 41 | 42 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 } | 93 } |
| 93 | 94 |
| 94 void GetExtensionKeyboardEventFromKeyEvent( | 95 void GetExtensionKeyboardEventFromKeyEvent( |
| 95 const ui::KeyEvent& event, | 96 const ui::KeyEvent& event, |
| 96 InputMethodEngine::KeyboardEvent* ext_event) { | 97 InputMethodEngine::KeyboardEvent* ext_event) { |
| 97 DCHECK(event.type() == ui::ET_KEY_RELEASED || | 98 DCHECK(event.type() == ui::ET_KEY_RELEASED || |
| 98 event.type() == ui::ET_KEY_PRESSED); | 99 event.type() == ui::ET_KEY_PRESSED); |
| 99 DCHECK(ext_event); | 100 DCHECK(ext_event); |
| 100 ext_event->type = (event.type() == ui::ET_KEY_RELEASED) ? "keyup" : "keydown"; | 101 ext_event->type = (event.type() == ui::ET_KEY_RELEASED) ? "keyup" : "keydown"; |
| 101 | 102 |
| 102 ext_event->code = event.code(); | 103 std::string dom_code = event.code(); |
| 104 if (dom_code == |
| 105 ui::KeycodeConverter::GetInstance()->InvalidKeyboardEventCode()) |
| 106 dom_code = ui::KeyboardCodeToDomKeycode(event.key_code()); |
| 107 ext_event->code = dom_code; |
| 103 ext_event->key_code = static_cast<int>(event.key_code()); | 108 ext_event->key_code = static_cast<int>(event.key_code()); |
| 104 ext_event->alt_key = event.IsAltDown(); | 109 ext_event->alt_key = event.IsAltDown(); |
| 105 ext_event->ctrl_key = event.IsControlDown(); | 110 ext_event->ctrl_key = event.IsControlDown(); |
| 106 ext_event->shift_key = event.IsShiftDown(); | 111 ext_event->shift_key = event.IsShiftDown(); |
| 107 ext_event->caps_lock = event.IsCapsLockDown(); | 112 ext_event->caps_lock = event.IsCapsLockDown(); |
| 108 ext_event->key = GetKeyFromEvent(event); | 113 ext_event->key = GetKeyFromEvent(event); |
| 109 } | 114 } |
| 110 | 115 |
| 111 } // namespace | 116 } // namespace |
| 112 | 117 |
| (...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 // TODO(nona): Implement it. | 637 // TODO(nona): Implement it. |
| 633 break; | 638 break; |
| 634 } | 639 } |
| 635 } | 640 } |
| 636 } | 641 } |
| 637 | 642 |
| 638 // TODO(nona): Support item.children. | 643 // TODO(nona): Support item.children. |
| 639 } | 644 } |
| 640 | 645 |
| 641 } // namespace chromeos | 646 } // namespace chromeos |
| OLD | NEW |