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/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 Loading... |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |