Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(236)

Side by Side Diff: ui/base/ime/input_method_chromeos.cc

Issue 1657593007: Implement chrome.input.ime.setComposition/commitText API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use Xxx::Results::Create(). Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/base/ime/input_method_chromeos.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « ui/base/ime/input_method_chromeos.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698