Chromium Code Reviews| 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) { |