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

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

Issue 1657593007: Implement chrome.input.ime.setComposition/commitText API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_win.h" 5 #include "ui/base/ime/input_method_win.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 171
172 // Dispatches the key events to the Chrome IME extension which is listening to 172 // Dispatches the key events to the Chrome IME extension which is listening to
173 // key events on the following two situations: 173 // key events on the following two situations:
174 // 1) |char_msgs| is empty when the event is non-character key. 174 // 1) |char_msgs| is empty when the event is non-character key.
175 // 2) |char_msgs|.size() == 1 when the event is character key and the WM_CHAR 175 // 2) |char_msgs|.size() == 1 when the event is character key and the WM_CHAR
176 // messages have been combined in the event processing flow. 176 // messages have been combined in the event processing flow.
177 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( 177 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
178 switches::kDisableMergeKeyCharEvents) && 178 switches::kDisableMergeKeyCharEvents) &&
179 char_msgs.size() <= 1 && GetEngine() && 179 char_msgs.size() <= 1 && GetEngine() &&
180 GetEngine()->IsInterestedInKeyEvent()) { 180 GetEngine()->IsInterestedInKeyEvent()) {
181 // Make true that we don't handle IME API calling of setComposition and
182 // commitText while the extension is processing key event.
183 handling_key_event_ = true;
181 ui::IMEEngineHandlerInterface::KeyEventDoneCallback callback = base::Bind( 184 ui::IMEEngineHandlerInterface::KeyEventDoneCallback callback = base::Bind(
182 &InputMethodWin::ProcessKeyEventDone, weak_ptr_factory_.GetWeakPtr(), 185 &InputMethodWin::ProcessKeyEventDone, weak_ptr_factory_.GetWeakPtr(),
183 base::Owned(new ui::KeyEvent(*event)), 186 base::Owned(new ui::KeyEvent(*event)),
184 base::Owned(new std::vector<MSG>(char_msgs))); 187 base::Owned(new std::vector<MSG>(char_msgs)));
185 GetEngine()->ProcessKeyEvent(*event, callback); 188 GetEngine()->ProcessKeyEvent(*event, callback);
186 } else { 189 } else {
187 ProcessKeyEventDone(event, &char_msgs, false); 190 ProcessKeyEventDone(event, &char_msgs, false);
188 } 191 }
189 } 192 }
190 193
191 void InputMethodWin::ProcessKeyEventDone(ui::KeyEvent* event, 194 void InputMethodWin::ProcessKeyEventDone(ui::KeyEvent* event,
192 const std::vector<MSG>* char_msgs, 195 const std::vector<MSG>* char_msgs,
193 bool is_handled) { 196 bool is_handled) {
197 handling_key_event_ = false;
194 DCHECK(event); 198 DCHECK(event);
195 if (is_handled) 199 if (is_handled)
196 return; 200 return;
197 201
198 ui::EventDispatchDetails details = DispatchKeyEventPostIME(event); 202 ui::EventDispatchDetails details = DispatchKeyEventPostIME(event);
199 if (details.dispatcher_destroyed || details.target_destroyed || 203 if (details.dispatcher_destroyed || details.target_destroyed ||
200 event->stopped_propagation()) { 204 event->stopped_propagation()) {
201 return; 205 return;
202 } 206 }
203 207
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 if (old_text_input_type != ui::TEXT_INPUT_TYPE_NONE) 682 if (old_text_input_type != ui::TEXT_INPUT_TYPE_NONE)
679 engine->FocusOut(); 683 engine->FocusOut();
680 if (text_input_type != ui::TEXT_INPUT_TYPE_NONE) 684 if (text_input_type != ui::TEXT_INPUT_TYPE_NONE)
681 engine->FocusIn(context); 685 engine->FocusIn(context);
682 686
683 ui::IMEBridge::Get()->SetCurrentInputContext(context); 687 ui::IMEBridge::Get()->SetCurrentInputContext(context);
684 } 688 }
685 } 689 }
686 690
687 } // namespace ui 691 } // namespace ui
OLDNEW
« ui/base/ime/input_method_base.h ('K') | « ui/base/ime/input_method_chromeos.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698