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

Side by Side Diff: ui/views/ime/mock_input_method.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, 5 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/views/focus/focus_manager_unittest.cc ('k') | ui/views/view_targeter_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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/views/ime/mock_input_method.h" 5 #include "ui/views/ime/mock_input_method.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "ui/base/ime/text_input_client.h" 9 #include "ui/base/ime/text_input_client.h"
10 #include "ui/events/event.h" 10 #include "ui/events/event.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 *result = InputMethod::NativeEventResult(); 57 *result = InputMethod::NativeEventResult();
58 return false; 58 return false;
59 } 59 }
60 60
61 void MockInputMethod::DispatchKeyEvent(const ui::KeyEvent& key) { 61 void MockInputMethod::DispatchKeyEvent(const ui::KeyEvent& key) {
62 bool handled = (composition_changed_ || result_text_.length()) && 62 bool handled = (composition_changed_ || result_text_.length()) &&
63 !IsTextInputTypeNone(); 63 !IsTextInputTypeNone();
64 64
65 ClearStates(); 65 ClearStates();
66 if (handled) { 66 if (handled) {
67 DCHECK(!key.is_char());
67 ui::KeyEvent mock_key(ui::ET_KEY_PRESSED, 68 ui::KeyEvent mock_key(ui::ET_KEY_PRESSED,
68 ui::VKEY_PROCESSKEY, 69 ui::VKEY_PROCESSKEY,
69 key.flags(), 70 key.flags());
70 key.is_char());
71 DispatchKeyEventPostIME(mock_key); 71 DispatchKeyEventPostIME(mock_key);
72 } else { 72 } else {
73 DispatchKeyEventPostIME(key); 73 DispatchKeyEventPostIME(key);
74 } 74 }
75 75
76 if (focus_changed_) 76 if (focus_changed_)
77 return; 77 return;
78 78
79 ui::TextInputClient* client = GetTextInputClient(); 79 ui::TextInputClient* client = GetTextInputClient();
80 if (client) { 80 if (client) {
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 input_locale_changed_ = false; 183 input_locale_changed_ = false;
184 } 184 }
185 185
186 void MockInputMethod::ClearResult() { 186 void MockInputMethod::ClearResult() {
187 composition_.Clear(); 187 composition_.Clear();
188 composition_changed_ = false; 188 composition_changed_ = false;
189 result_text_.clear(); 189 result_text_.clear();
190 } 190 }
191 191
192 } // namespace views 192 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/focus/focus_manager_unittest.cc ('k') | ui/views/view_targeter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698