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

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: " 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
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..66acda661e836c43636954b456f2968176543bae 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,29 @@ 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:
+ type = Event::ET_KEY_PRESSED;
+ break;
+ case WM_KEYUP:
+ type = Event::ET_KEY_RELEASED;
+ break;
+ case WM_CHAR:
+ type = Event::ET_UNKNOWN;
oshima 2011/01/04 20:26:34 I need your advice here. Event::EventType does not
Ben Goodger (Google) 2011/01/05 17:35:12 According to SDK docs, WM_CHAR is synthesized when
+ break;
+ default:
+ NOTREACHED() << "Unknown message:" << message;
+ // pass 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) {

Powered by Google App Engine
This is Rietveld 408576698