summaryrefslogtreecommitdiffstats
path: root/views/controls/textfield/native_textfield_win.cc
diff options
context:
space:
mode:
authoroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-05 23:50:59 +0000
committeroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-05 23:50:59 +0000
commit7110c8930b89fc05b45029f7751fa5ce06e41f1c (patch)
tree2b5cc53476a4484789b1a7de47e15a9035b78337 /views/controls/textfield/native_textfield_win.cc
parent70833268d3cfae8f2cf6b9cd69cc07c8508ab319 (diff)
downloadchromium_src-7110c8930b89fc05b45029f7751fa5ce06e41f1c.zip
chromium_src-7110c8930b89fc05b45029f7751fa5ce06e41f1c.tar.gz
chromium_src-7110c8930b89fc05b45029f7751fa5ce06e41f1c.tar.bz2
Replace Textfield::Keystroke with views::KeyEvent.
It looks big, but most of change is simple signature change. Note: I need your advice on how to deal with WM_CHAR event on Win. Please see my comment below. BUG=none TEST=no new functionality. All tests should still pass. Review URL: http://codereview.chromium.org/6034002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70553 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/controls/textfield/native_textfield_win.cc')
-rw-r--r--views/controls/textfield/native_textfield_win.cc24
1 files changed, 22 insertions, 2 deletions
diff --git a/views/controls/textfield/native_textfield_win.cc b/views/controls/textfield/native_textfield_win.cc
index 581e40f..223a8b5 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) {