Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "views/controls/textfield/native_textfield_views.h" | 5 #include "views/controls/textfield/native_textfield_views.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 87 set_drag_controller(this); | 87 set_drag_controller(this); |
| 88 } | 88 } |
| 89 | 89 |
| 90 NativeTextfieldViews::~NativeTextfieldViews() { | 90 NativeTextfieldViews::~NativeTextfieldViews() { |
| 91 } | 91 } |
| 92 | 92 |
| 93 //////////////////////////////////////////////////////////////////////////////// | 93 //////////////////////////////////////////////////////////////////////////////// |
| 94 // NativeTextfieldViews, View overrides: | 94 // NativeTextfieldViews, View overrides: |
| 95 | 95 |
| 96 bool NativeTextfieldViews::OnMousePressed(const MouseEvent& event) { | 96 bool NativeTextfieldViews::OnMousePressed(const MouseEvent& event) { |
| 97 if (textfield_->OnMousePressed(event)) { | |
|
msw
2011/11/11 01:28:58
Please add a comment here like "Allow the textfiel
jennyz
2011/11/12 01:50:17
Done.
| |
| 98 return true; | |
| 99 } | |
|
oshima
2011/11/11 01:52:32
This should be after OnBeforeUserAction() and has
jennyz
2011/11/12 01:50:17
Done.
| |
| 100 | |
| 97 OnBeforeUserAction(); | 101 OnBeforeUserAction(); |
| 98 textfield_->RequestFocus(); | 102 textfield_->RequestFocus(); |
| 99 | 103 |
| 100 if (event.IsOnlyLeftMouseButton()) { | 104 if (event.IsOnlyLeftMouseButton()) { |
| 101 base::TimeDelta time_delta = event.time_stamp() - last_click_time_; | 105 base::TimeDelta time_delta = event.time_stamp() - last_click_time_; |
| 102 gfx::Point location_delta = event.location().Subtract(last_click_location_); | 106 gfx::Point location_delta = event.location().Subtract(last_click_location_); |
| 103 if (time_delta.InMilliseconds() <= GetDoubleClickInterval() && | 107 if (time_delta.InMilliseconds() <= GetDoubleClickInterval() && |
| 104 !ExceededDragThreshold(location_delta.x(), location_delta.y())) { | 108 !ExceededDragThreshold(location_delta.x(), location_delta.y())) { |
| 105 aggregated_clicks_ = (aggregated_clicks_ + 1) % 3; | 109 aggregated_clicks_ = (aggregated_clicks_ + 1) % 3; |
| 106 } else { | 110 } else { |
| (...skipping 971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1078 | 1082 |
| 1079 #if defined(USE_AURA) | 1083 #if defined(USE_AURA) |
| 1080 // static | 1084 // static |
| 1081 NativeTextfieldWrapper* NativeTextfieldWrapper::CreateWrapper( | 1085 NativeTextfieldWrapper* NativeTextfieldWrapper::CreateWrapper( |
| 1082 Textfield* field) { | 1086 Textfield* field) { |
| 1083 return new NativeTextfieldViews(field); | 1087 return new NativeTextfieldViews(field); |
| 1084 } | 1088 } |
| 1085 #endif | 1089 #endif |
| 1086 | 1090 |
| 1087 } // namespace views | 1091 } // namespace views |
| OLD | NEW |