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

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

Issue 1801363005: Fix bug of input.ime.onKeyEvent on Linux. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_auralinux.h" 5 #include "ui/base/ime/input_method_auralinux.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/environment.h" 8 #include "base/environment.h"
9 #include "ui/base/ime/ime_bridge.h" 9 #include "ui/base/ime/ime_bridge.h"
10 #include "ui/base/ime/ime_engine_handler_interface.h" 10 #include "ui/base/ime/ime_engine_handler_interface.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 // If there's an active IME extension is listening to the key event, and the 97 // If there's an active IME extension is listening to the key event, and the
98 // current text input client is not password input client, the key event 98 // current text input client is not password input client, the key event
99 // should be dispatched to the extension engine in the two conditions: 99 // should be dispatched to the extension engine in the two conditions:
100 // 1) |filtered| == false: the ET_KEY_PRESSED event of non-character key, 100 // 1) |filtered| == false: the ET_KEY_PRESSED event of non-character key,
101 // or the ET_KEY_RELEASED event of all key. 101 // or the ET_KEY_RELEASED event of all key.
102 // 2) |filtered| == true && NeedInsertChar(): the ET_KEY_PRESSED event of 102 // 2) |filtered| == true && NeedInsertChar(): the ET_KEY_PRESSED event of
103 // character key. 103 // character key.
104 if (text_input_type_ != TEXT_INPUT_TYPE_PASSWORD && 104 if (text_input_type_ != TEXT_INPUT_TYPE_PASSWORD &&
105 GetEngine() && GetEngine()->IsInterestedInKeyEvent() && 105 GetEngine() && GetEngine()->IsInterestedInKeyEvent() &&
106 (!filtered || NeedInsertChar())) { 106 (!filtered || NeedInsertChar())) {
107 ui::IMEEngineHandlerInterface::KeyEventDoneCallback callback = 107 ui::IMEEngineHandlerInterface::KeyEventDoneCallback callback = base::Bind(
108 base::Bind(&InputMethodAuraLinux::ProcessKeyEventDone, 108 &InputMethodAuraLinux::ProcessKeyEventByEngineDone,
109 weak_ptr_factory_.GetWeakPtr(), 109 weak_ptr_factory_.GetWeakPtr(), base::Owned(new ui::KeyEvent(*event)),
110 base::Owned(new ui::KeyEvent(*event)), filtered); 110 filtered, composition_changed_, composition_, result_text_);
Shu Chen 2016/03/17 06:37:08 I think this is wrong. Please consider why the Key
Azure Wei 2016/03/17 07:02:37 Done.
111 GetEngine()->ProcessKeyEvent(*event, callback); 111 GetEngine()->ProcessKeyEvent(*event, callback);
112 } else { 112 } else {
113 ProcessKeyEventDone(event, filtered, false); 113 ProcessKeyEventDone(event, filtered, false);
114 } 114 }
115 } 115 }
116 116
117 void InputMethodAuraLinux::ProcessKeyEventByEngineDone(
118 ui::KeyEvent* event,
119 bool filtered,
120 bool composition_changed,
121 const ui::CompositionText& composition,
122 const base::string16& result_text,
123 bool is_handled) {
124 composition_changed_ = composition_changed;
125 composition_.CopyFrom(composition);
126 result_text_ = result_text;
127 ProcessKeyEventDone(event, filtered, is_handled);
128 }
129
117 void InputMethodAuraLinux::ProcessKeyEventDone(ui::KeyEvent* event, 130 void InputMethodAuraLinux::ProcessKeyEventDone(ui::KeyEvent* event,
118 bool filtered, 131 bool filtered,
119 bool is_handled) { 132 bool is_handled) {
120 DCHECK(event); 133 DCHECK(event);
121 if (is_handled) 134 if (is_handled)
122 return; 135 return;
123 136
124 // If the IME extension has not handled the key event, passes the keyevent 137 // If the IME extension has not handled the key event, passes the keyevent
125 // back to the previous processing flow. Preconditions for this situation: 138 // back to the previous processing flow. Preconditions for this situation:
126 // 1) |filtered| == false 139 // 1) |filtered| == false
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 client->ConfirmCompositionText(); 445 client->ConfirmCompositionText();
433 446
434 if (GetEngine()) 447 if (GetEngine())
435 GetEngine()->Reset(); 448 GetEngine()->Reset();
436 } 449 }
437 450
438 ResetContext(); 451 ResetContext();
439 } 452 }
440 453
441 } // namespace ui 454 } // namespace ui
OLDNEW
« ui/base/ime/input_method_auralinux.h ('K') | « ui/base/ime/input_method_auralinux.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698