| 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 return true; | 187 return true; |
| 188 } | 188 } |
| 189 return false; | 189 return false; |
| 190 } | 190 } |
| 191 | 191 |
| 192 bool BaseScrollBar::OnMouseWheel(const ui::MouseWheelEvent& event) { | 192 bool BaseScrollBar::OnMouseWheel(const ui::MouseWheelEvent& event) { |
| 193 OnScroll(event.x_offset(), event.y_offset()); | 193 OnScroll(event.x_offset(), event.y_offset()); |
| 194 return true; | 194 return true; |
| 195 } | 195 } |
| 196 | 196 |
| 197 void BaseScrollBar::OnScrollEvent(ui::ScrollEvent* event) { |
| 198 controller()->OnScrollEventFromScrollBar(event); |
| 199 } |
| 200 |
| 197 void BaseScrollBar::OnGestureEvent(ui::GestureEvent* event) { | 201 void BaseScrollBar::OnGestureEvent(ui::GestureEvent* event) { |
| 198 // 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 |
| 199 // 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 |
| 200 // fling). | 204 // fling). |
| 201 if (scroll_animator_.get() && scroll_animator_->is_scrolling() && | 205 if (scroll_animator_.get() && scroll_animator_->is_scrolling() && |
| 202 (event->type() != ui::ET_GESTURE_END || | 206 (event->type() != ui::ET_GESTURE_END || |
| 203 event->details().touch_points() > 1)) { | 207 event->details().touch_points() > 1)) { |
| 204 scroll_animator_->Stop(); | 208 scroll_animator_->Stop(); |
| 205 } | 209 } |
| 206 | 210 |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 return (thumb_position * (contents_size_ - viewport_size_)) / | 510 return (thumb_position * (contents_size_ - viewport_size_)) / |
| 507 (track_size - thumb_size); | 511 (track_size - thumb_size); |
| 508 } | 512 } |
| 509 | 513 |
| 510 void BaseScrollBar::SetThumbTrackState(CustomButton::ButtonState state) { | 514 void BaseScrollBar::SetThumbTrackState(CustomButton::ButtonState state) { |
| 511 thumb_track_state_ = state; | 515 thumb_track_state_ = state; |
| 512 SchedulePaint(); | 516 SchedulePaint(); |
| 513 } | 517 } |
| 514 | 518 |
| 515 } // namespace views | 519 } // namespace views |
| OLD | NEW |