| 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 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 controller()->ScrollToPosition(this, position); | 433 controller()->ScrollToPosition(this, position); |
| 434 } | 434 } |
| 435 | 435 |
| 436 int BaseScrollBar::GetScrollIncrement(bool is_page, bool is_positive) { | 436 int BaseScrollBar::GetScrollIncrement(bool is_page, bool is_positive) { |
| 437 return controller()->GetScrollIncrement(this, is_page, is_positive); | 437 return controller()->GetScrollIncrement(this, is_page, is_positive); |
| 438 } | 438 } |
| 439 | 439 |
| 440 /////////////////////////////////////////////////////////////////////////////// | 440 /////////////////////////////////////////////////////////////////////////////// |
| 441 // BaseScrollBar, private: | 441 // BaseScrollBar, private: |
| 442 | 442 |
| 443 #if !defined(OS_MACOSX) |
| 444 // static |
| 445 base::Timer* BaseScrollBar::GetHideTimerForTest(BaseScrollBar* scroll_bar) { |
| 446 return nullptr; |
| 447 } |
| 448 #endif |
| 449 |
| 443 int BaseScrollBar::GetThumbSizeForTest() { | 450 int BaseScrollBar::GetThumbSizeForTest() { |
| 444 return thumb_->GetSize(); | 451 return thumb_->GetSize(); |
| 445 } | 452 } |
| 446 | 453 |
| 447 void BaseScrollBar::ProcessPressEvent(const ui::LocatedEvent& event) { | 454 void BaseScrollBar::ProcessPressEvent(const ui::LocatedEvent& event) { |
| 448 SetThumbTrackState(CustomButton::STATE_PRESSED); | 455 SetThumbTrackState(CustomButton::STATE_PRESSED); |
| 449 gfx::Rect thumb_bounds = thumb_->bounds(); | 456 gfx::Rect thumb_bounds = thumb_->bounds(); |
| 450 if (IsHorizontal()) { | 457 if (IsHorizontal()) { |
| 451 if (GetMirroredXInView(event.x()) < thumb_bounds.x()) { | 458 if (GetMirroredXInView(event.x()) < thumb_bounds.x()) { |
| 452 last_scroll_amount_ = SCROLL_PREV_PAGE; | 459 last_scroll_amount_ = SCROLL_PREV_PAGE; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 return (thumb_position * (contents_size_ - viewport_size_)) / | 513 return (thumb_position * (contents_size_ - viewport_size_)) / |
| 507 (track_size - thumb_size); | 514 (track_size - thumb_size); |
| 508 } | 515 } |
| 509 | 516 |
| 510 void BaseScrollBar::SetThumbTrackState(CustomButton::ButtonState state) { | 517 void BaseScrollBar::SetThumbTrackState(CustomButton::ButtonState state) { |
| 511 thumb_track_state_ = state; | 518 thumb_track_state_ = state; |
| 512 SchedulePaint(); | 519 SchedulePaint(); |
| 513 } | 520 } |
| 514 | 521 |
| 515 } // namespace views | 522 } // namespace views |
| OLD | NEW |