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 #define XK_MISCELLANY | 7 #define XK_MISCELLANY |
8 #include <X11/keysymdef.h> | 8 #include <X11/keysymdef.h> |
9 #include <X11/X.h> | 9 #include <X11/X.h> |
10 #include <X11/Xlib.h> | 10 #include <X11/Xlib.h> |
11 #include <X11/Xutil.h> | 11 #include <X11/Xutil.h> |
12 #undef FocusIn | 12 #undef FocusIn |
13 #undef FocusOut | 13 #undef FocusOut |
14 #undef RootWindow | 14 #undef RootWindow |
15 #include <map> | 15 #include <map> |
16 | 16 |
17 #include "ash/ime/input_method_menu_item.h" | 17 #include "ash/ime/input_method_menu_item.h" |
18 #include "ash/ime/input_method_menu_manager.h" | 18 #include "ash/ime/input_method_menu_manager.h" |
19 #include "ash/shell.h" | 19 #include "ash/shell.h" |
20 #include "base/logging.h" | 20 #include "base/logging.h" |
21 #include "base/memory/scoped_ptr.h" | 21 #include "base/memory/scoped_ptr.h" |
22 #include "base/strings/string_number_conversions.h" | 22 #include "base/strings/string_number_conversions.h" |
23 #include "base/strings/string_util.h" | 23 #include "base/strings/string_util.h" |
24 #include "base/strings/utf_string_conversions.h" | 24 #include "base/strings/utf_string_conversions.h" |
25 #include "chromeos/ime/component_extension_ime_manager.h" | 25 #include "chromeos/ime/component_extension_ime_manager.h" |
26 #include "chromeos/ime/composition_text.h" | 26 #include "chromeos/ime/composition_text.h" |
27 #include "chromeos/ime/extension_ime_util.h" | 27 #include "chromeos/ime/extension_ime_util.h" |
28 #include "chromeos/ime/input_method_manager.h" | 28 #include "chromeos/ime/input_method_manager.h" |
29 #include "ui/aura/window.h" | 29 #include "ui/aura/window.h" |
30 #include "ui/aura/window_event_dispatcher.h" | 30 #include "ui/aura/window_tree_host.h" |
31 #include "ui/base/ime/candidate_window.h" | 31 #include "ui/base/ime/candidate_window.h" |
32 #include "ui/base/ime/chromeos/ime_keymap.h" | 32 #include "ui/base/ime/chromeos/ime_keymap.h" |
33 #include "ui/events/event.h" | 33 #include "ui/events/event.h" |
| 34 #include "ui/events/event_processor.h" |
34 #include "ui/events/keycodes/dom4/keycode_converter.h" | 35 #include "ui/events/keycodes/dom4/keycode_converter.h" |
35 #include "ui/events/keycodes/keyboard_code_conversion_x.h" | 36 #include "ui/events/keycodes/keyboard_code_conversion_x.h" |
36 #include "ui/keyboard/keyboard_controller.h" | 37 #include "ui/keyboard/keyboard_controller.h" |
37 | 38 |
38 namespace chromeos { | 39 namespace chromeos { |
39 const char* kErrorNotActive = "IME is not active"; | 40 const char* kErrorNotActive = "IME is not active"; |
40 const char* kErrorWrongContext = "Context is not active"; | 41 const char* kErrorWrongContext = "Context is not active"; |
41 const char* kCandidateNotFound = "Candidate not found"; | 42 const char* kCandidateNotFound = "Candidate not found"; |
42 | 43 |
43 namespace { | 44 namespace { |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 bool InputMethodEngine::SendKeyEvents( | 215 bool InputMethodEngine::SendKeyEvents( |
215 int context_id, | 216 int context_id, |
216 const std::vector<KeyboardEvent>& events) { | 217 const std::vector<KeyboardEvent>& events) { |
217 if (!active_) { | 218 if (!active_) { |
218 return false; | 219 return false; |
219 } | 220 } |
220 if (context_id != context_id_ || context_id_ == -1) { | 221 if (context_id != context_id_ || context_id_ == -1) { |
221 return false; | 222 return false; |
222 } | 223 } |
223 | 224 |
224 aura::WindowEventDispatcher* dispatcher = | 225 ui::EventProcessor* dispatcher = |
225 ash::Shell::GetPrimaryRootWindow()->GetHost()->dispatcher(); | 226 ash::Shell::GetPrimaryRootWindow()->GetHost()->event_processor(); |
226 | 227 |
227 for (size_t i = 0; i < events.size(); ++i) { | 228 for (size_t i = 0; i < events.size(); ++i) { |
228 const KeyboardEvent& event = events[i]; | 229 const KeyboardEvent& event = events[i]; |
229 const ui::EventType type = | 230 const ui::EventType type = |
230 (event.type == "keyup") ? ui::ET_KEY_RELEASED : ui::ET_KEY_PRESSED; | 231 (event.type == "keyup") ? ui::ET_KEY_RELEASED : ui::ET_KEY_PRESSED; |
231 | 232 |
232 // KeyboardCodeFromXKyeSym assumes US keyboard layout. | 233 // KeyboardCodeFromXKyeSym assumes US keyboard layout. |
233 ui::KeycodeConverter* conv = ui::KeycodeConverter::GetInstance(); | 234 ui::KeycodeConverter* conv = ui::KeycodeConverter::GetInstance(); |
234 DCHECK(conv); | 235 DCHECK(conv); |
235 | 236 |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
632 // TODO(nona): Implement it. | 633 // TODO(nona): Implement it. |
633 break; | 634 break; |
634 } | 635 } |
635 } | 636 } |
636 } | 637 } |
637 | 638 |
638 // TODO(nona): Support item.children. | 639 // TODO(nona): Support item.children. |
639 } | 640 } |
640 | 641 |
641 } // namespace chromeos | 642 } // namespace chromeos |
OLD | NEW |