| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ui/base/ime/input_method_chromeos.h" | 5 #include "ui/base/ime/input_method_chromeos.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <cstring> | 10 #include <cstring> |
| 11 #include <set> | 11 #include <set> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/bind.h" | 14 #include "base/bind.h" |
| 15 #include "base/i18n/char_iterator.h" | 15 #include "base/i18n/char_iterator.h" |
| 16 #include "base/logging.h" | 16 #include "base/logging.h" |
| 17 #include "base/strings/string_util.h" | 17 #include "base/strings/string_util.h" |
| 18 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
| 19 #include "base/sys_info.h" | 19 #include "base/sys_info.h" |
| 20 #include "base/third_party/icu/icu_utf.h" | 20 #include "base/third_party/icu/icu_utf.h" |
| 21 #include "ui/base/ime/chromeos/ime_keyboard.h" | 21 #include "ui/base/ime/chromeos/ime_keyboard.h" |
| 22 #include "ui/base/ime/chromeos/input_method_manager.h" | 22 #include "ui/base/ime/chromeos/input_method_manager.h" |
| 23 #include "ui/base/ime/composition_text.h" | 23 #include "ui/base/ime/composition_text.h" |
| 24 #include "ui/base/ime/ime_bridge.h" | 24 #include "ui/base/ime/ime_bridge.h" |
| 25 #include "ui/base/ime/ime_engine_handler_interface.h" | 25 #include "ui/base/ime/ime_engine_handler_interface.h" |
| 26 #include "ui/base/ime/text_input_client.h" | 26 #include "ui/base/ime/text_input_client.h" |
| 27 #include "ui/events/event.h" | 27 #include "ui/events/event.h" |
| 28 #include "ui/events/keycodes/dom/dom_code.h" |
| 29 #include "ui/events/keycodes/dom/dom_key.h" |
| 28 #include "ui/gfx/geometry/rect.h" | 30 #include "ui/gfx/geometry/rect.h" |
| 29 | 31 |
| 30 namespace { | 32 namespace { |
| 31 ui::IMEEngineHandlerInterface* GetEngine() { | 33 ui::IMEEngineHandlerInterface* GetEngine() { |
| 32 return ui::IMEBridge::Get()->GetCurrentEngineHandler(); | 34 return ui::IMEBridge::Get()->GetCurrentEngineHandler(); |
| 33 } | 35 } |
| 34 } // namespace | 36 } // namespace |
| 35 | 37 |
| 36 namespace ui { | 38 namespace ui { |
| 37 | 39 |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 ignore_result(DispatchKeyEventPostIME(event)); | 356 ignore_result(DispatchKeyEventPostIME(event)); |
| 355 } | 357 } |
| 356 | 358 |
| 357 void InputMethodChromeOS::ProcessFilteredKeyPressEvent(ui::KeyEvent* event) { | 359 void InputMethodChromeOS::ProcessFilteredKeyPressEvent(ui::KeyEvent* event) { |
| 358 if (NeedInsertChar()) { | 360 if (NeedInsertChar()) { |
| 359 ignore_result(DispatchKeyEventPostIME(event)); | 361 ignore_result(DispatchKeyEventPostIME(event)); |
| 360 return; | 362 return; |
| 361 } | 363 } |
| 362 ui::KeyEvent fabricated_event(ET_KEY_PRESSED, | 364 ui::KeyEvent fabricated_event(ET_KEY_PRESSED, |
| 363 VKEY_PROCESSKEY, | 365 VKEY_PROCESSKEY, |
| 364 event->code(), | 366 ui::DomCode::NONE, |
| 365 event->flags(), | 367 event->flags(), |
| 366 event->GetDomKey(), | 368 ui::DomKey::NONE, |
| 367 event->time_stamp()); | 369 event->time_stamp()); |
| 368 ignore_result(DispatchKeyEventPostIME(&fabricated_event)); | 370 ignore_result(DispatchKeyEventPostIME(&fabricated_event)); |
| 369 if (fabricated_event.stopped_propagation()) | 371 if (fabricated_event.stopped_propagation()) |
| 370 event->StopPropagation(); | 372 event->StopPropagation(); |
| 371 } | 373 } |
| 372 | 374 |
| 373 void InputMethodChromeOS::ProcessUnfilteredKeyPressEvent( | 375 void InputMethodChromeOS::ProcessUnfilteredKeyPressEvent( |
| 374 ui::KeyEvent* event) { | 376 ui::KeyEvent* event) { |
| 375 const TextInputClient* prev_client = GetTextInputClient(); | 377 const TextInputClient* prev_client = GetTextInputClient(); |
| 376 ignore_result(DispatchKeyEventPostIME(event)); | 378 ignore_result(DispatchKeyEventPostIME(event)); |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 636 bool InputMethodChromeOS::IsNonPasswordInputFieldFocused() { | 638 bool InputMethodChromeOS::IsNonPasswordInputFieldFocused() { |
| 637 TextInputType type = GetTextInputType(); | 639 TextInputType type = GetTextInputType(); |
| 638 return (type != TEXT_INPUT_TYPE_NONE) && (type != TEXT_INPUT_TYPE_PASSWORD); | 640 return (type != TEXT_INPUT_TYPE_NONE) && (type != TEXT_INPUT_TYPE_PASSWORD); |
| 639 } | 641 } |
| 640 | 642 |
| 641 bool InputMethodChromeOS::IsInputFieldFocused() { | 643 bool InputMethodChromeOS::IsInputFieldFocused() { |
| 642 return GetTextInputType() != TEXT_INPUT_TYPE_NONE; | 644 return GetTextInputType() != TEXT_INPUT_TYPE_NONE; |
| 643 } | 645 } |
| 644 | 646 |
| 645 } // namespace ui | 647 } // namespace ui |
| OLD | NEW |