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

Side by Side Diff: ui/views/controls/textfield/native_textfield_views.cc

Issue 10912063: events: Get rid of GestureStatus in favour of EventResult. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/views/controls/textfield/native_textfield_views.h ('k') | ui/views/view.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 // TODO: Remove once NativeTextfield implementations are consolidated to 139 // TODO: Remove once NativeTextfield implementations are consolidated to
140 // Textfield. 140 // Textfield.
141 textfield_->OnMouseReleased(event); 141 textfield_->OnMouseReleased(event);
142 // Cancel suspected drag initiations, the user was clicking in the selection. 142 // Cancel suspected drag initiations, the user was clicking in the selection.
143 if (initiating_drag_ && MoveCursorTo(event.location(), false)) 143 if (initiating_drag_ && MoveCursorTo(event.location(), false))
144 SchedulePaint(); 144 SchedulePaint();
145 initiating_drag_ = false; 145 initiating_drag_ = false;
146 OnAfterUserAction(); 146 OnAfterUserAction();
147 } 147 }
148 148
149 ui::GestureStatus NativeTextfieldViews::OnGestureEvent( 149 ui::EventResult NativeTextfieldViews::OnGestureEvent(
150 const ui::GestureEvent& event) { 150 const ui::GestureEvent& event) {
151 ui::GestureStatus status = textfield_->OnGestureEvent(event); 151 ui::EventResult status = textfield_->OnGestureEvent(event);
152 if (status != ui::GESTURE_STATUS_UNKNOWN) 152 if (status != ui::ER_UNHANDLED)
153 return status; 153 return status;
154 154
155 switch (event.type()) { 155 switch (event.type()) {
156 case ui::ET_GESTURE_TAP_DOWN: 156 case ui::ET_GESTURE_TAP_DOWN:
157 OnBeforeUserAction(); 157 OnBeforeUserAction();
158 textfield_->RequestFocus(); 158 textfield_->RequestFocus();
159 // We don't deselect if the point is in the selection 159 // We don't deselect if the point is in the selection
160 // because TAP_DOWN may turn into a LONG_PRESS. 160 // because TAP_DOWN may turn into a LONG_PRESS.
161 if (!GetRenderText()->IsPointInSelection(event.location()) && 161 if (!GetRenderText()->IsPointInSelection(event.location()) &&
162 MoveCursorTo(event.location(), false)) 162 MoveCursorTo(event.location(), false))
163 SchedulePaint(); 163 SchedulePaint();
164 OnAfterUserAction(); 164 OnAfterUserAction();
165 return ui::GESTURE_STATUS_CONSUMED; 165 return ui::ER_CONSUMED;
166 case ui::ET_GESTURE_DOUBLE_TAP: 166 case ui::ET_GESTURE_DOUBLE_TAP:
167 SelectAll(false); 167 SelectAll(false);
168 return ui::GESTURE_STATUS_CONSUMED; 168 return ui::ER_CONSUMED;
169 case ui::ET_GESTURE_SCROLL_UPDATE: 169 case ui::ET_GESTURE_SCROLL_UPDATE:
170 OnBeforeUserAction(); 170 OnBeforeUserAction();
171 if (MoveCursorTo(event.location(), true)) 171 if (MoveCursorTo(event.location(), true))
172 SchedulePaint(); 172 SchedulePaint();
173 OnAfterUserAction(); 173 OnAfterUserAction();
174 return ui::GESTURE_STATUS_CONSUMED; 174 return ui::ER_CONSUMED;
175 default: 175 default:
176 break; 176 break;
177 } 177 }
178 return TouchSelectionClientView::OnGestureEvent(event); 178 return TouchSelectionClientView::OnGestureEvent(event);
179 } 179 }
180 180
181 bool NativeTextfieldViews::OnKeyPressed(const ui::KeyEvent& event) { 181 bool NativeTextfieldViews::OnKeyPressed(const ui::KeyEvent& event) {
182 // OnKeyPressed/OnKeyReleased/OnFocus/OnBlur will never be invoked on 182 // OnKeyPressed/OnKeyReleased/OnFocus/OnBlur will never be invoked on
183 // NativeTextfieldViews as it will never gain focus. 183 // NativeTextfieldViews as it will never gain focus.
184 NOTREACHED(); 184 NOTREACHED();
(...skipping 1034 matching lines...) Expand 10 before | Expand all | Expand 10 after
1219 // Filter out all control characters, including tab and new line characters, 1219 // Filter out all control characters, including tab and new line characters,
1220 // and all characters with Alt modifier. But we need to allow characters with 1220 // and all characters with Alt modifier. But we need to allow characters with
1221 // AltGr modifier. 1221 // AltGr modifier.
1222 // On Windows AltGr is represented by Alt+Ctrl, and on Linux it's a different 1222 // On Windows AltGr is represented by Alt+Ctrl, and on Linux it's a different
1223 // flag that we don't care about. 1223 // flag that we don't care about.
1224 return ((ch >= 0x20 && ch < 0x7F) || ch > 0x9F) && 1224 return ((ch >= 0x20 && ch < 0x7F) || ch > 0x9F) &&
1225 (flags & ~(ui::EF_SHIFT_DOWN | ui::EF_CAPS_LOCK_DOWN)) != ui::EF_ALT_DOWN; 1225 (flags & ~(ui::EF_SHIFT_DOWN | ui::EF_CAPS_LOCK_DOWN)) != ui::EF_ALT_DOWN;
1226 } 1226 }
1227 1227
1228 } // namespace views 1228 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/textfield/native_textfield_views.h ('k') | ui/views/view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698