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

Side by Side Diff: views/controls/textfield/native_textfield_views_unittest.cc

Issue 6823055: Consolidate OnKeyEvent and InputMethod code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Refactor X2Event handling, nix Windows InputMethodDelegate, etc. Created 9 years, 8 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 | Annotate | Revision Log
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 "base/auto_reset.h" 5 #include "base/auto_reset.h"
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/bind_helpers.h" 7 #include "base/bind_helpers.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 195
196 protected: 196 protected:
197 void SendKeyEvent(ui::KeyboardCode key_code, 197 void SendKeyEvent(ui::KeyboardCode key_code,
198 bool shift, 198 bool shift,
199 bool control, 199 bool control,
200 bool capslock) { 200 bool capslock) {
201 int flags = (shift ? ui::EF_SHIFT_DOWN : 0) | 201 int flags = (shift ? ui::EF_SHIFT_DOWN : 0) |
202 (control ? ui::EF_CONTROL_DOWN : 0) | 202 (control ? ui::EF_CONTROL_DOWN : 0) |
203 (capslock ? ui::EF_CAPS_LOCK_DOWN : 0); 203 (capslock ? ui::EF_CAPS_LOCK_DOWN : 0);
204 KeyEvent event(ui::ET_KEY_PRESSED, key_code, flags); 204 KeyEvent event(ui::ET_KEY_PRESSED, key_code, flags);
205 input_method_->DispatchKeyEvent(event); 205 widget_->OnKeyEvent(event);
206 } 206 }
207 207
208 void SendKeyEvent(ui::KeyboardCode key_code, bool shift, bool control) { 208 void SendKeyEvent(ui::KeyboardCode key_code, bool shift, bool control) {
209 SendKeyEvent(key_code, shift, control, false); 209 SendKeyEvent(key_code, shift, control, false);
210 } 210 }
211 211
212 void SendKeyEvent(ui::KeyboardCode key_code) { 212 void SendKeyEvent(ui::KeyboardCode key_code) {
213 SendKeyEvent(key_code, false, false); 213 SendKeyEvent(key_code, false, false);
214 } 214 }
215 215
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 706
707 textfield_->SetReadOnly(false); 707 textfield_->SetReadOnly(false);
708 input_method_->Clear(); 708 input_method_->Clear();
709 textfield_->SetPassword(true); 709 textfield_->SetPassword(true);
710 EXPECT_TRUE(input_method_->text_input_type_changed()); 710 EXPECT_TRUE(input_method_->text_input_type_changed());
711 EXPECT_TRUE(textfield_->GetTextInputClient()); 711 EXPECT_TRUE(textfield_->GetTextInputClient());
712 } 712 }
713 713
714 714
715 } // namespace views 715 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698