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

Unified Diff: views/controls/textfield/textfield.h

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_win.cc ('k') | views/controls/textfield/textfield.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/controls/textfield/textfield.h
diff --git a/views/controls/textfield/textfield.h b/views/controls/textfield/textfield.h
index 9dd1ee9febfdaf3aadd6f65e16d496157f1bfc1a..141ddcb5e84549573b5dfe7eea1cbc93b8a83f13 100644
--- a/views/controls/textfield/textfield.h
+++ b/views/controls/textfield/textfield.h
@@ -31,6 +31,8 @@
namespace views {
+class KeyEvent;
+
class NativeTextfieldWrapper;
// This class implements a ChromeView that wraps a native text (edit) field.
@@ -39,50 +41,6 @@ class Textfield : public View {
// The button's class name.
static const char kViewClassName[];
- // Keystroke provides a platform-dependent way to send keystroke events.
- // Cross-platform code can use IsKeystrokeEnter/Escape to check for these
- // two common key events.
- // TODO(brettw) this should be cleaned up to be more cross-platform.
- class Keystroke {
- public:
-#if defined(OS_WIN)
- const Keystroke(unsigned int m,
- wchar_t k,
- int r,
- unsigned int f)
- : message_(m),
- key_(k),
- repeat_count_(r),
- flags_(f) {
- }
- unsigned int message() const { return message_; }
- wchar_t key() const { return key_; }
- int repeat_count() const { return repeat_count_; }
- unsigned int flags() const { return flags_; }
-#else
- explicit Keystroke(const KeyEvent* event)
- : event_(event) {
- }
- const KeyEvent& key_event() const { return *event_;};
- const GdkEventKey* event() const { return event_->native_event(); }
-#endif
- app::KeyboardCode GetKeyboardCode() const;
- bool IsControlHeld() const;
- bool IsShiftHeld() const;
-
- private:
-#if defined(OS_WIN)
- unsigned int message_;
- wchar_t key_;
- int repeat_count_;
- unsigned int flags_;
-#else
- const KeyEvent* event_;
-#endif
-
- DISALLOW_COPY_AND_ASSIGN(Keystroke);
- };
-
// This defines the callback interface for other code to be notified of
// changes in the state of a text field.
class Controller {
@@ -94,8 +52,8 @@ class Textfield : public View {
// This method is called to get notified about keystrokes in the edit.
// This method returns true if the message was handled and should not be
// processed further. If it returns false the processing continues.
- virtual bool HandleKeystroke(Textfield* sender,
- const Textfield::Keystroke& keystroke) = 0;
+ virtual bool HandleKeyEvent(Textfield* sender,
+ const KeyEvent& key_event) = 0;
};
enum StyleFlags {
« no previous file with comments | « views/controls/textfield/native_textfield_win.cc ('k') | views/controls/textfield/textfield.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698