| 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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 break; | 187 break; |
| 188 } | 188 } |
| 189 if (amount != SCROLL_NONE) { | 189 if (amount != SCROLL_NONE) { |
| 190 ScrollByAmount(amount); | 190 ScrollByAmount(amount); |
| 191 return true; | 191 return true; |
| 192 } | 192 } |
| 193 return false; | 193 return false; |
| 194 } | 194 } |
| 195 | 195 |
| 196 bool BaseScrollBar::OnMouseWheel(const ui::MouseWheelEvent& event) { | 196 bool BaseScrollBar::OnMouseWheel(const ui::MouseWheelEvent& event) { |
| 197 ScrollByContentsOffset(event.y_offset()); | 197 OnScroll(event.x_offset(), event.y_offset()); |
| 198 return true; | 198 return true; |
| 199 } | 199 } |
| 200 | 200 |
| 201 void BaseScrollBar::OnGestureEvent(ui::GestureEvent* event) { | 201 void BaseScrollBar::OnGestureEvent(ui::GestureEvent* event) { |
| 202 // If a fling is in progress, then stop the fling for any incoming gesture | 202 // If a fling is in progress, then stop the fling for any incoming gesture |
| 203 // event (except for the GESTURE_END event that is generated at the end of the | 203 // event (except for the GESTURE_END event that is generated at the end of the |
| 204 // fling). | 204 // fling). |
| 205 if (scroll_animator_.get() && scroll_animator_->is_scrolling() && | 205 if (scroll_animator_.get() && scroll_animator_->is_scrolling() && |
| 206 (event->type() != ui::ET_GESTURE_END || | 206 (event->type() != ui::ET_GESTURE_END || |
| 207 event->details().touch_points() > 1)) { | 207 event->details().touch_points() > 1)) { |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 thumb_position = thumb_position - (thumb_->GetSize() / 2); | 508 thumb_position = thumb_position - (thumb_->GetSize() / 2); |
| 509 return (thumb_position * contents_size_) / GetTrackSize(); | 509 return (thumb_position * contents_size_) / GetTrackSize(); |
| 510 } | 510 } |
| 511 | 511 |
| 512 void BaseScrollBar::SetThumbTrackState(CustomButton::ButtonState state) { | 512 void BaseScrollBar::SetThumbTrackState(CustomButton::ButtonState state) { |
| 513 thumb_track_state_ = state; | 513 thumb_track_state_ = state; |
| 514 SchedulePaint(); | 514 SchedulePaint(); |
| 515 } | 515 } |
| 516 | 516 |
| 517 } // namespace views | 517 } // namespace views |
| OLD | NEW |