| 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 382 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  393   thumb_->SetLength(static_cast<int>(ratio * GetTrackSize())); |  393   thumb_->SetLength(static_cast<int>(ratio * GetTrackSize())); | 
|  394  |  394  | 
|  395   int thumb_position = CalculateThumbPosition(contents_scroll_offset); |  395   int thumb_position = CalculateThumbPosition(contents_scroll_offset); | 
|  396   thumb_->SetPosition(thumb_position); |  396   thumb_->SetPosition(thumb_position); | 
|  397 } |  397 } | 
|  398  |  398  | 
|  399 int BaseScrollBar::GetPosition() const { |  399 int BaseScrollBar::GetPosition() const { | 
|  400   return thumb_->GetPosition(); |  400   return thumb_->GetPosition(); | 
|  401 } |  401 } | 
|  402  |  402  | 
 |  403 bool BaseScrollBar::OverlapsContent() const { | 
 |  404   return false; | 
 |  405 } | 
 |  406  | 
|  403 /////////////////////////////////////////////////////////////////////////////// |  407 /////////////////////////////////////////////////////////////////////////////// | 
|  404 // BaseScrollBar, protected: |  408 // BaseScrollBar, protected: | 
|  405  |  409  | 
|  406 BaseScrollBarThumb* BaseScrollBar::GetThumb() const { |  410 BaseScrollBarThumb* BaseScrollBar::GetThumb() const { | 
|  407   return thumb_; |  411   return thumb_; | 
|  408 } |  412 } | 
|  409  |  413  | 
|  410 void BaseScrollBar::ScrollToPosition(int position) { |  414 void BaseScrollBar::ScrollToPosition(int position) { | 
|  411   controller()->ScrollToPosition(this, position); |  415   controller()->ScrollToPosition(this, position); | 
|  412 } |  416 } | 
| (...skipping 67 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 |