| 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" | |
| 30 #include "ui/gfx/geometry/rect.h" | 28 #include "ui/gfx/geometry/rect.h" |
| 31 | 29 |
| 32 namespace { | 30 namespace { |
| 33 ui::IMEEngineHandlerInterface* GetEngine() { | 31 ui::IMEEngineHandlerInterface* GetEngine() { |
| 34 return ui::IMEBridge::Get()->GetCurrentEngineHandler(); | 32 return ui::IMEBridge::Get()->GetCurrentEngineHandler(); |
| 35 } | 33 } |
| 36 } // namespace | 34 } // namespace |
| 37 | 35 |
| 38 namespace ui { | 36 namespace ui { |
| 39 | 37 |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 ignore_result(DispatchKeyEventPostIME(event)); | 354 ignore_result(DispatchKeyEventPostIME(event)); |
| 357 } | 355 } |
| 358 | 356 |
| 359 void InputMethodChromeOS::ProcessFilteredKeyPressEvent(ui::KeyEvent* event) { | 357 void InputMethodChromeOS::ProcessFilteredKeyPressEvent(ui::KeyEvent* event) { |
| 360 if (NeedInsertChar()) { | 358 if (NeedInsertChar()) { |
| 361 ignore_result(DispatchKeyEventPostIME(event)); | 359 ignore_result(DispatchKeyEventPostIME(event)); |
| 362 return; | 360 return; |
| 363 } | 361 } |
| 364 ui::KeyEvent fabricated_event(ET_KEY_PRESSED, | 362 ui::KeyEvent fabricated_event(ET_KEY_PRESSED, |
| 365 VKEY_PROCESSKEY, | 363 VKEY_PROCESSKEY, |
| 366 ui::DomCode::NONE, | 364 event->code(), |
| 367 event->flags(), | 365 event->flags(), |
| 368 ui::DomKey::NONE, | 366 event->GetDomKey(), |
| 369 event->time_stamp()); | 367 event->time_stamp()); |
| 370 ignore_result(DispatchKeyEventPostIME(&fabricated_event)); | 368 ignore_result(DispatchKeyEventPostIME(&fabricated_event)); |
| 371 if (fabricated_event.stopped_propagation()) | 369 if (fabricated_event.stopped_propagation()) |
| 372 event->StopPropagation(); | 370 event->StopPropagation(); |
| 373 } | 371 } |
| 374 | 372 |
| 375 void InputMethodChromeOS::ProcessUnfilteredKeyPressEvent( | 373 void InputMethodChromeOS::ProcessUnfilteredKeyPressEvent( |
| 376 ui::KeyEvent* event) { | 374 ui::KeyEvent* event) { |
| 377 const TextInputClient* prev_client = GetTextInputClient(); | 375 const TextInputClient* prev_client = GetTextInputClient(); |
| 378 ignore_result(DispatchKeyEventPostIME(event)); | 376 ignore_result(DispatchKeyEventPostIME(event)); |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 bool InputMethodChromeOS::IsNonPasswordInputFieldFocused() { | 636 bool InputMethodChromeOS::IsNonPasswordInputFieldFocused() { |
| 639 TextInputType type = GetTextInputType(); | 637 TextInputType type = GetTextInputType(); |
| 640 return (type != TEXT_INPUT_TYPE_NONE) && (type != TEXT_INPUT_TYPE_PASSWORD); | 638 return (type != TEXT_INPUT_TYPE_NONE) && (type != TEXT_INPUT_TYPE_PASSWORD); |
| 641 } | 639 } |
| 642 | 640 |
| 643 bool InputMethodChromeOS::IsInputFieldFocused() { | 641 bool InputMethodChromeOS::IsInputFieldFocused() { |
| 644 return GetTextInputType() != TEXT_INPUT_TYPE_NONE; | 642 return GetTextInputType() != TEXT_INPUT_TYPE_NONE; |
| 645 } | 643 } |
| 646 | 644 |
| 647 } // namespace ui | 645 } // namespace ui |
| OLD | NEW |