Index: views/controls/textfield/native_textfield_views.h |
diff --git a/views/controls/textfield/native_textfield_views.h b/views/controls/textfield/native_textfield_views.h |
index d474a72b6dd5c6b1fc774d3361d1777313f987a7..5f6c4c5e93061067ba35d2c77a567332638ba1c7 100644 |
--- a/views/controls/textfield/native_textfield_views.h |
+++ b/views/controls/textfield/native_textfield_views.h |
@@ -14,6 +14,10 @@ |
#include "views/controls/textfield/native_textfield_wrapper.h" |
#include "views/view.h" |
+namespace base { |
+class Time; |
+} |
+ |
namespace gfx { |
class Canvas; |
} // namespace |
@@ -111,6 +115,13 @@ class NativeTextfieldViews : public views::View, |
private: |
friend class NativeTextfieldViewsTest; |
+ enum ClickAction { |
+ SELECT_WORD, |
+ SELECT_ALL, |
+ CURSOR_SELECT, |
+ NONE, |
+ }; |
+ |
// A Border class to draw focus border for the text field. |
class TextfieldBorder : public Border { |
public: |
@@ -162,6 +173,13 @@ class NativeTextfieldViews : public views::View, |
// Find a cusor position for given |point| in this views coordinates. |
size_t FindCursorPosition(const gfx::Point& point) const; |
+ // Double or tripple click handler. Returns true if a double/triple click is |
+ // detected and handled. |
+ bool DetectAndHandleDoubleAndTripleClick(const views::MouseEvent& e); |
+ |
+ // Helper function determines whether a mouse event is a double/triple click. |
+ ClickAction GetClickAction(const views::MouseEvent& e); |
+ |
// Utility function to inform the parent textfield (and its controller if any) |
// that the text in the textfield has changed. |
void PropagateTextChange(); |
@@ -193,6 +211,18 @@ class NativeTextfieldViews : public views::View, |
// A runnable method factory for callback to update the cursor. |
ScopedRunnableMethodFactory<NativeTextfieldViews> cursor_timer_; |
+ // Time of last LEFT mouse press. Used for tracking double/triple click. |
+ base::Time last_mouse_press_time_; |
+ |
+ // Position of last LEFT mouse press. Used for tracking double/triple click. |
+ gfx::Point last_mouse_press_location_; |
+ |
+ // True if a click has occured and we are waiting for a double click. |
+ bool tracking_double_click_; |
+ |
+ // True if a double click has occured and we are waiting for a triple click. |
+ bool tracking_triple_click_; |
+ |
// Context menu and its content list for the textfield. |
scoped_ptr<ui::SimpleMenuModel> context_menu_contents_; |
scoped_ptr<Menu2> context_menu_menu_; |