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

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

Issue 404203003: Distinguish between keystroke and character events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: IsCharFromNative() for Mac build Created 6 years, 4 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_auralinux.cc ('k') | ui/base/ime/input_method_chromeos_unittest.cc » ('j') | 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 <algorithm> 7 #include <algorithm>
8 #include <cstring> 8 #include <cstring>
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 DispatchKeyEventPostIME(event); 360 DispatchKeyEventPostIME(event);
361 } 361 }
362 362
363 void InputMethodChromeOS::ProcessFilteredKeyPressEvent( 363 void InputMethodChromeOS::ProcessFilteredKeyPressEvent(
364 const ui::KeyEvent& event) { 364 const ui::KeyEvent& event) {
365 if (NeedInsertChar()) { 365 if (NeedInsertChar()) {
366 DispatchKeyEventPostIME(event); 366 DispatchKeyEventPostIME(event);
367 } else { 367 } else {
368 const ui::KeyEvent fabricated_event(ET_KEY_PRESSED, 368 const ui::KeyEvent fabricated_event(ET_KEY_PRESSED,
369 VKEY_PROCESSKEY, 369 VKEY_PROCESSKEY,
370 event.flags(), 370 event.flags());
371 false); // is_char
372 DispatchKeyEventPostIME(fabricated_event); 371 DispatchKeyEventPostIME(fabricated_event);
373 } 372 }
374 } 373 }
375 374
376 void InputMethodChromeOS::ProcessUnfilteredKeyPressEvent( 375 void InputMethodChromeOS::ProcessUnfilteredKeyPressEvent(
377 const ui::KeyEvent& event) { 376 const ui::KeyEvent& event) {
378 const TextInputClient* prev_client = GetTextInputClient(); 377 const TextInputClient* prev_client = GetTextInputClient();
379 DispatchKeyEventPostIME(event); 378 DispatchKeyEventPostIME(event);
380 379
381 // We shouldn't dispatch the character anymore if the key event dispatch 380 // We shouldn't dispatch the character anymore if the key event dispatch
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 436
438 bool InputMethodChromeOS::HasInputMethodResult() const { 437 bool InputMethodChromeOS::HasInputMethodResult() const {
439 return result_text_.length() || composition_changed_; 438 return result_text_.length() || composition_changed_;
440 } 439 }
441 440
442 void InputMethodChromeOS::SendFakeProcessKeyEvent(bool pressed) const { 441 void InputMethodChromeOS::SendFakeProcessKeyEvent(bool pressed) const {
443 if (!GetTextInputClient()) 442 if (!GetTextInputClient())
444 return; 443 return;
445 KeyEvent evt(pressed ? ET_KEY_PRESSED : ET_KEY_RELEASED, 444 KeyEvent evt(pressed ? ET_KEY_PRESSED : ET_KEY_RELEASED,
446 pressed ? VKEY_PROCESSKEY : VKEY_UNKNOWN, 445 pressed ? VKEY_PROCESSKEY : VKEY_UNKNOWN,
447 EF_IME_FABRICATED_KEY, 446 EF_IME_FABRICATED_KEY);
448 false); // is_char
449 DispatchKeyEventPostIME(evt); 447 DispatchKeyEventPostIME(evt);
450 } 448 }
451 449
452 void InputMethodChromeOS::AbandonAllPendingKeyEvents() { 450 void InputMethodChromeOS::AbandonAllPendingKeyEvents() {
453 pending_key_events_.clear(); 451 pending_key_events_.clear();
454 } 452 }
455 453
456 void InputMethodChromeOS::CommitText(const std::string& text) { 454 void InputMethodChromeOS::CommitText(const std::string& text) {
457 if (text.empty()) 455 if (text.empty())
458 return; 456 return;
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 0, length, SK_ColorBLACK, false /* thick */, SK_ColorTRANSPARENT)); 650 0, length, SK_ColorBLACK, false /* thick */, SK_ColorTRANSPARENT));
653 } 651 }
654 } 652 }
655 653
656 bool InputMethodChromeOS::IsInputFieldFocused() { 654 bool InputMethodChromeOS::IsInputFieldFocused() {
657 TextInputType type = GetTextInputType(); 655 TextInputType type = GetTextInputType();
658 return (type != TEXT_INPUT_TYPE_NONE) && (type != TEXT_INPUT_TYPE_PASSWORD); 656 return (type != TEXT_INPUT_TYPE_NONE) && (type != TEXT_INPUT_TYPE_PASSWORD);
659 } 657 }
660 658
661 } // namespace ui 659 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/ime/input_method_auralinux.cc ('k') | ui/base/ime/input_method_chromeos_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698