OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/views/controls/textfield/native_textfield_views.h" | 5 #include "ui/views/controls/textfield/native_textfield_views.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 } | 89 } |
90 | 90 |
91 //////////////////////////////////////////////////////////////////////////////// | 91 //////////////////////////////////////////////////////////////////////////////// |
92 // NativeTextfieldViews, View overrides: | 92 // NativeTextfieldViews, View overrides: |
93 | 93 |
94 bool NativeTextfieldViews::OnMousePressed(const ui::MouseEvent& event) { | 94 bool NativeTextfieldViews::OnMousePressed(const ui::MouseEvent& event) { |
95 OnBeforeUserAction(); | 95 OnBeforeUserAction(); |
96 TrackMouseClicks(event); | 96 TrackMouseClicks(event); |
97 | 97 |
98 TextfieldController* controller = textfield_->GetController(); | 98 TextfieldController* controller = textfield_->GetController(); |
99 if (!(controller && controller->HandleMouseEvent(textfield_, event)) || | 99 if (!(controller && controller->HandleMouseEvent(textfield_, event)) && |
100 // TODO: Remove once NativeTextfield implementations are consolidated to | |
101 // Textfield. | |
102 !textfield_->OnMousePressed(event)) { | 100 !textfield_->OnMousePressed(event)) { |
103 HandleMousePressEvent(event); | 101 HandleMousePressEvent(event); |
104 } | 102 } |
105 | 103 |
106 OnAfterUserAction(); | 104 OnAfterUserAction(); |
107 return true; | 105 return true; |
108 } | 106 } |
109 | 107 |
110 bool NativeTextfieldViews::ExceededDragThresholdFromLastClickLocation( | 108 bool NativeTextfieldViews::ExceededDragThresholdFromLastClickLocation( |
111 const ui::MouseEvent& event) { | 109 const ui::MouseEvent& event) { |
(...skipping 1183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1295 // Filter out all control characters, including tab and new line characters, | 1293 // Filter out all control characters, including tab and new line characters, |
1296 // and all characters with Alt modifier. But we need to allow characters with | 1294 // and all characters with Alt modifier. But we need to allow characters with |
1297 // AltGr modifier. | 1295 // AltGr modifier. |
1298 // On Windows AltGr is represented by Alt+Ctrl, and on Linux it's a different | 1296 // On Windows AltGr is represented by Alt+Ctrl, and on Linux it's a different |
1299 // flag that we don't care about. | 1297 // flag that we don't care about. |
1300 return ((ch >= 0x20 && ch < 0x7F) || ch > 0x9F) && | 1298 return ((ch >= 0x20 && ch < 0x7F) || ch > 0x9F) && |
1301 (flags & ~(ui::EF_SHIFT_DOWN | ui::EF_CAPS_LOCK_DOWN)) != ui::EF_ALT_DOWN; | 1299 (flags & ~(ui::EF_SHIFT_DOWN | ui::EF_CAPS_LOCK_DOWN)) != ui::EF_ALT_DOWN; |
1302 } | 1300 } |
1303 | 1301 |
1304 } // namespace views | 1302 } // namespace views |
OLD | NEW |