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> |
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 bool InputMethodChromeOS::NeedInsertChar() const { | 432 bool InputMethodChromeOS::NeedInsertChar() const { |
433 return GetTextInputClient() && | 433 return GetTextInputClient() && |
434 (IsTextInputTypeNone() || | 434 (IsTextInputTypeNone() || |
435 (!composing_text_ && result_text_.length() == 1)); | 435 (!composing_text_ && result_text_.length() == 1)); |
436 } | 436 } |
437 | 437 |
438 bool InputMethodChromeOS::HasInputMethodResult() const { | 438 bool InputMethodChromeOS::HasInputMethodResult() const { |
439 return result_text_.length() || composition_changed_; | 439 return result_text_.length() || composition_changed_; |
440 } | 440 } |
441 | 441 |
442 bool InputMethodChromeOS::SendFakeProcessKeyEvent(bool pressed) const { | |
443 KeyEvent evt(pressed ? ET_KEY_PRESSED : ET_KEY_RELEASED, | |
444 pressed ? VKEY_PROCESSKEY : VKEY_UNKNOWN, | |
445 EF_IME_FABRICATED_KEY); | |
446 ignore_result(DispatchKeyEventPostIME(&evt)); | |
447 return evt.stopped_propagation(); | |
448 } | |
449 | |
450 void InputMethodChromeOS::CommitText(const std::string& text) { | 442 void InputMethodChromeOS::CommitText(const std::string& text) { |
451 if (text.empty()) | 443 if (text.empty()) |
452 return; | 444 return; |
453 | 445 |
454 // We need to receive input method result even if the text input type is | 446 // We need to receive input method result even if the text input type is |
455 // TEXT_INPUT_TYPE_NONE, to make sure we can always send correct | 447 // TEXT_INPUT_TYPE_NONE, to make sure we can always send correct |
456 // character for each key event to the focused text input client. | 448 // character for each key event to the focused text input client. |
457 if (!GetTextInputClient()) | 449 if (!GetTextInputClient()) |
458 return; | 450 return; |
459 | 451 |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 bool InputMethodChromeOS::IsNonPasswordInputFieldFocused() { | 633 bool InputMethodChromeOS::IsNonPasswordInputFieldFocused() { |
642 TextInputType type = GetTextInputType(); | 634 TextInputType type = GetTextInputType(); |
643 return (type != TEXT_INPUT_TYPE_NONE) && (type != TEXT_INPUT_TYPE_PASSWORD); | 635 return (type != TEXT_INPUT_TYPE_NONE) && (type != TEXT_INPUT_TYPE_PASSWORD); |
644 } | 636 } |
645 | 637 |
646 bool InputMethodChromeOS::IsInputFieldFocused() { | 638 bool InputMethodChromeOS::IsInputFieldFocused() { |
647 return GetTextInputType() != TEXT_INPUT_TYPE_NONE; | 639 return GetTextInputType() != TEXT_INPUT_TYPE_NONE; |
648 } | 640 } |
649 | 641 |
650 } // namespace ui | 642 } // namespace ui |
OLD | NEW |