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

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

Issue 5988010: focus reverse traversal was not working for TextfieldViews. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updated comment 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_wrapper.h
diff --git a/views/controls/textfield/native_textfield_wrapper.h b/views/controls/textfield/native_textfield_wrapper.h
index eb5245fd7baf4f17f5d1d4ad412374a4d2aae9f9..5c3725865a70b8df7539aeb64a76329877841b27 100644
--- a/views/controls/textfield/native_textfield_wrapper.h
+++ b/views/controls/textfield/native_textfield_wrapper.h
@@ -15,6 +15,7 @@ class Insets;
namespace views {
+class KeyEvent;
class Textfield;
class View;
@@ -77,8 +78,9 @@ class NativeTextfieldWrapper {
// Updates the vertical margins for the native text field.
virtual void UpdateVerticalMargins() = 0;
- // Sets the focus to the text field.
- virtual void SetFocus() = 0;
+ // Sets the focus to the text field. Returns false if the wrapper
+ // didn't take focus.
+ virtual bool SetFocus() = 0;
// Retrieves the views::View that hosts the native control.
virtual View* GetView() = 0;
@@ -89,6 +91,23 @@ class NativeTextfieldWrapper {
// Returns whether or not an IME is composing text.
virtual bool IsIMEComposing() const = 0;
+ // Following methods are to forward key/focus related events to the
+ // views wrapper so that TextfieldViews can handle key inputs without
+ // having a focus.
+
+ // Invoked when a key is pressed/release on Textfield. Subclasser
+ // should return true if the event has been processed and false
+ // otherwise.
+ // See also View::OnKeyPressed/OnKeyReleased.
+ virtual bool HandleKeyPressed(const views::KeyEvent& e) = 0;
+ virtual bool HandleKeyReleased(const views::KeyEvent& e) = 0;
+
+ // Invoked when a focus is being moved from or to the Textfield.
+ // See also View::WillGainFocus/DidGainFocus/WillLoseFocus.
+ virtual void HandleWillGainFocus() = 0;
+ virtual void HandleDidGainFocus() = 0;
+ virtual void HandleWillLoseFocus() = 0;
+
// Creates an appropriate NativeTextfieldWrapper for the platform.
static NativeTextfieldWrapper* CreateWrapper(Textfield* field);
};

Powered by Google App Engine
This is Rietveld 408576698