| 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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 return true; | 170 return true; |
| 171 } | 171 } |
| 172 return false; | 172 return false; |
| 173 } | 173 } |
| 174 | 174 |
| 175 bool BaseScrollBar::OnMouseWheel(const ui::MouseWheelEvent& event) { | 175 bool BaseScrollBar::OnMouseWheel(const ui::MouseWheelEvent& event) { |
| 176 OnScroll(event.x_offset(), event.y_offset()); | 176 OnScroll(event.x_offset(), event.y_offset()); |
| 177 return true; | 177 return true; |
| 178 } | 178 } |
| 179 | 179 |
| 180 void BaseScrollBar::OnScrollEvent(ui::ScrollEvent* event) { |
| 181 controller()->OnScrollEventFromScrollBar(event); |
| 182 } |
| 183 |
| 180 void BaseScrollBar::OnGestureEvent(ui::GestureEvent* event) { | 184 void BaseScrollBar::OnGestureEvent(ui::GestureEvent* event) { |
| 181 // If a fling is in progress, then stop the fling for any incoming gesture | 185 // If a fling is in progress, then stop the fling for any incoming gesture |
| 182 // event (except for the GESTURE_END event that is generated at the end of the | 186 // event (except for the GESTURE_END event that is generated at the end of the |
| 183 // fling). | 187 // fling). |
| 184 if (scroll_animator_.get() && scroll_animator_->is_scrolling() && | 188 if (scroll_animator_.get() && scroll_animator_->is_scrolling() && |
| 185 (event->type() != ui::ET_GESTURE_END || | 189 (event->type() != ui::ET_GESTURE_END || |
| 186 event->details().touch_points() > 1)) { | 190 event->details().touch_points() > 1)) { |
| 187 scroll_animator_->Stop(); | 191 scroll_animator_->Stop(); |
| 188 } | 192 } |
| 189 | 193 |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 int track_size = GetTrackSize(); | 484 int track_size = GetTrackSize(); |
| 481 if (track_size == thumb_size) | 485 if (track_size == thumb_size) |
| 482 return 0; | 486 return 0; |
| 483 if (scroll_to_middle) | 487 if (scroll_to_middle) |
| 484 thumb_position = thumb_position - (thumb_size / 2); | 488 thumb_position = thumb_position - (thumb_size / 2); |
| 485 return (thumb_position * (contents_size_ - viewport_size_)) / | 489 return (thumb_position * (contents_size_ - viewport_size_)) / |
| 486 (track_size - thumb_size); | 490 (track_size - thumb_size); |
| 487 } | 491 } |
| 488 | 492 |
| 489 } // namespace views | 493 } // namespace views |
| OLD | NEW |