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

Side by Side Diff: ui/views/controls/scrollbar/base_scroll_bar.cc

Issue 10824295: Rid the world of the last of views::Event types: TouchEvent, GestureEvent, MouseWheelEvent, ScrollE… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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
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/scrollbar/base_scroll_bar.h" 5 #include "ui/views/controls/scrollbar/base_scroll_bar.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 default: 160 default:
161 break; 161 break;
162 } 162 }
163 if (amount != SCROLL_NONE) { 163 if (amount != SCROLL_NONE) {
164 ScrollByAmount(amount); 164 ScrollByAmount(amount);
165 return true; 165 return true;
166 } 166 }
167 return false; 167 return false;
168 } 168 }
169 169
170 ui::GestureStatus BaseScrollBar::OnGestureEvent(const GestureEvent& event) { 170 ui::GestureStatus BaseScrollBar::OnGestureEvent(const ui::GestureEvent& event) {
171 if (event.type() == ui::ET_GESTURE_TAP_DOWN) { 171 if (event.type() == ui::ET_GESTURE_TAP_DOWN) {
172 ProcessPressEvent(event); 172 ProcessPressEvent(event);
173 return ui::GESTURE_STATUS_CONSUMED; 173 return ui::GESTURE_STATUS_CONSUMED;
174 } 174 }
175 175
176 if (event.type() == ui::ET_GESTURE_LONG_PRESS) { 176 if (event.type() == ui::ET_GESTURE_LONG_PRESS) {
177 // For a long-press, the repeater started in tap-down should continue. So 177 // For a long-press, the repeater started in tap-down should continue. So
178 // return early. 178 // return early.
179 return ui::GESTURE_STATUS_UNKNOWN; 179 return ui::GESTURE_STATUS_UNKNOWN;
180 } 180 }
(...skipping 12 matching lines...) Expand all
193 193
194 if (event.type() == ui::ET_GESTURE_SCROLL_UPDATE) { 194 if (event.type() == ui::ET_GESTURE_SCROLL_UPDATE) {
195 ScrollByContentsOffset(IsHorizontal() ? event.details().scroll_x() : 195 ScrollByContentsOffset(IsHorizontal() ? event.details().scroll_x() :
196 event.details().scroll_y()); 196 event.details().scroll_y());
197 return ui::GESTURE_STATUS_CONSUMED; 197 return ui::GESTURE_STATUS_CONSUMED;
198 } 198 }
199 199
200 return ui::GESTURE_STATUS_UNKNOWN; 200 return ui::GESTURE_STATUS_UNKNOWN;
201 } 201 }
202 202
203 bool BaseScrollBar::OnMouseWheel(const MouseWheelEvent& event) { 203 bool BaseScrollBar::OnMouseWheel(const ui::MouseWheelEvent& event) {
204 ScrollByContentsOffset(event.offset()); 204 ScrollByContentsOffset(event.offset());
205 return true; 205 return true;
206 } 206 }
207 207
208 /////////////////////////////////////////////////////////////////////////////// 208 ///////////////////////////////////////////////////////////////////////////////
209 // BaseScrollBar, ContextMenuController implementation: 209 // BaseScrollBar, ContextMenuController implementation:
210 210
211 enum ScrollBarContextMenuCommands { 211 enum ScrollBarContextMenuCommands {
212 ScrollBarContextMenuCommand_ScrollHere = 1, 212 ScrollBarContextMenuCommand_ScrollHere = 1,
213 ScrollBarContextMenuCommand_ScrollStart, 213 ScrollBarContextMenuCommand_ScrollStart,
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 thumb_position = thumb_position - (thumb_->GetSize() / 2); 423 thumb_position = thumb_position - (thumb_->GetSize() / 2);
424 return (thumb_position * contents_size_) / GetTrackSize(); 424 return (thumb_position * contents_size_) / GetTrackSize();
425 } 425 }
426 426
427 void BaseScrollBar::SetThumbTrackState(CustomButton::ButtonState state) { 427 void BaseScrollBar::SetThumbTrackState(CustomButton::ButtonState state) {
428 thumb_track_state_ = state; 428 thumb_track_state_ = state;
429 SchedulePaint(); 429 SchedulePaint();
430 } 430 }
431 431
432 } // namespace views 432 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/scrollbar/base_scroll_bar.h ('k') | ui/views/controls/scrollbar/native_scroll_bar.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698