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

Unified Diff: views/controls/textfield/native_textfield_win.cc

Issue 6034002: Replace Textfield::Keystroke with views::KeyEvent (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: key_code, ET_KEY_PRESS for WM_CHAR Created 9 years, 12 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « views/controls/textfield/native_textfield_views_unittest.cc ('k') | views/controls/textfield/textfield.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/controls/textfield/native_textfield_win.cc
diff --git a/views/controls/textfield/native_textfield_win.cc b/views/controls/textfield/native_textfield_win.cc
index 581e40f2bb0d1316e40c9e8586f07e51b9aafe9a..223a8b55661f8d4b02865bf994f4c8ba9850b043 100644
--- a/views/controls/textfield/native_textfield_win.cc
+++ b/views/controls/textfield/native_textfield_win.cc
@@ -9,6 +9,7 @@
#include "app/clipboard/clipboard.h"
#include "app/clipboard/scoped_clipboard_writer.h"
#include "app/keyboard_codes.h"
+#include "app/keyboard_code_conversion_win.h"
#include "app/l10n_util.h"
#include "app/l10n_util_win.h"
#include "app/win/win_util.h"
@@ -876,8 +877,27 @@ void NativeTextfieldWin::HandleKeystroke(UINT message,
Textfield::Controller* controller = textfield_->GetController();
bool handled = false;
if (controller) {
- handled = controller->HandleKeystroke(textfield_,
- Textfield::Keystroke(message, key, repeat_count, flags));
+ Event::EventType type;
+ switch (message) {
+ case WM_KEYDOWN:
+ case WM_CHAR:
+ type = Event::ET_KEY_PRESSED;
+ break;
+ case WM_KEYUP:
+ type = Event::ET_KEY_RELEASED;
+ break;
+ default:
+ NOTREACHED() << "Unknown message:" << message;
+ // Passing through to avoid crash on release build.
+ type = Event::ET_KEY_PRESSED;
+ }
+ KeyEvent key_event(type,
+ app::KeyboardCodeForWindowsKeyCode(key),
+ KeyEvent::GetKeyStateFlags(),
+ repeat_count,
+ flags,
+ message);
+ handled = controller->HandleKeyEvent(textfield_, key_event);
}
if (!handled) {
« no previous file with comments | « views/controls/textfield/native_textfield_views_unittest.cc ('k') | views/controls/textfield/textfield.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698