| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/overlay_scroll_bar.h" | 5 #include "ui/views/controls/scrollbar/overlay_scroll_bar.h" |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "third_party/skia/include/core/SkColor.h" | 8 #include "third_party/skia/include/core/SkColor.h" |
| 9 #include "ui/compositor/scoped_layer_animation_settings.h" | 9 #include "ui/compositor/scoped_layer_animation_settings.h" |
| 10 #include "ui/gfx/canvas.h" | 10 #include "ui/gfx/canvas.h" |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 OverlayScrollBar::~OverlayScrollBar() {} | 121 OverlayScrollBar::~OverlayScrollBar() {} |
| 122 | 122 |
| 123 gfx::Rect OverlayScrollBar::GetTrackBounds() const { | 123 gfx::Rect OverlayScrollBar::GetTrackBounds() const { |
| 124 gfx::Rect local = GetLocalBounds(); | 124 gfx::Rect local = GetLocalBounds(); |
| 125 // The track has to be wide enough for the thumb. | 125 // The track has to be wide enough for the thumb. |
| 126 local.Inset(gfx::Insets(IsHorizontal() ? -kThumbHoverOffset : 0, | 126 local.Inset(gfx::Insets(IsHorizontal() ? -kThumbHoverOffset : 0, |
| 127 IsHorizontal() ? 0 : -kThumbHoverOffset, 0, 0)); | 127 IsHorizontal() ? 0 : -kThumbHoverOffset, 0, 0)); |
| 128 return local; | 128 return local; |
| 129 } | 129 } |
| 130 | 130 |
| 131 int OverlayScrollBar::GetLayoutSize() const { | 131 int OverlayScrollBar::GetThickness() const { |
| 132 return 0; | |
| 133 } | |
| 134 | |
| 135 int OverlayScrollBar::GetContentOverlapSize() const { | |
| 136 return kThumbThickness; | 132 return kThumbThickness; |
| 137 } | 133 } |
| 138 | 134 |
| 135 bool OverlayScrollBar::OverlapsContent() const { |
| 136 return true; |
| 137 } |
| 138 |
| 139 void OverlayScrollBar::Layout() { | 139 void OverlayScrollBar::Layout() { |
| 140 gfx::Rect thumb_bounds = GetTrackBounds(); | 140 gfx::Rect thumb_bounds = GetTrackBounds(); |
| 141 BaseScrollBarThumb* thumb = GetThumb(); | 141 BaseScrollBarThumb* thumb = GetThumb(); |
| 142 if (IsHorizontal()) { | 142 if (IsHorizontal()) { |
| 143 thumb_bounds.set_x(thumb->x()); | 143 thumb_bounds.set_x(thumb->x()); |
| 144 thumb_bounds.set_width(thumb->width()); | 144 thumb_bounds.set_width(thumb->width()); |
| 145 } else { | 145 } else { |
| 146 thumb_bounds.set_y(thumb->y()); | 146 thumb_bounds.set_y(thumb->y()); |
| 147 thumb_bounds.set_height(thumb->height()); | 147 thumb_bounds.set_height(thumb->height()); |
| 148 } | 148 } |
| (...skipping 28 matching lines...) Expand all Loading... |
| 177 | 177 |
| 178 void OverlayScrollBar::StartHideCountdown() { | 178 void OverlayScrollBar::StartHideCountdown() { |
| 179 if (IsMouseHovered()) | 179 if (IsMouseHovered()) |
| 180 return; | 180 return; |
| 181 hide_timer_.Start( | 181 hide_timer_.Start( |
| 182 FROM_HERE, base::TimeDelta::FromSeconds(1), | 182 FROM_HERE, base::TimeDelta::FromSeconds(1), |
| 183 base::Bind(&OverlayScrollBar::Hide, base::Unretained(this))); | 183 base::Bind(&OverlayScrollBar::Hide, base::Unretained(this))); |
| 184 } | 184 } |
| 185 | 185 |
| 186 } // namespace views | 186 } // namespace views |
| OLD | NEW |