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 "cc/paint/paint_flags.h" | 8 #include "cc/paint/paint_flags.h" |
9 #include "third_party/skia/include/core/SkColor.h" | 9 #include "third_party/skia/include/core/SkColor.h" |
10 #include "ui/compositor/scoped_layer_animation_settings.h" | 10 #include "ui/compositor/scoped_layer_animation_settings.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 | 115 |
116 if (GetWidget()) | 116 if (GetWidget()) |
117 scroll_bar_->StartHideCountdown(); | 117 scroll_bar_->StartHideCountdown(); |
118 } else { | 118 } else { |
119 layer()->SetTransform(gfx::Transform()); | 119 layer()->SetTransform(gfx::Transform()); |
120 layer()->SetOpacity(ui::kOverlayScrollbarThumbHoverAlpha); | 120 layer()->SetOpacity(ui::kOverlayScrollbarThumbHoverAlpha); |
121 } | 121 } |
122 } | 122 } |
123 | 123 |
124 OverlayScrollBar::OverlayScrollBar(bool horizontal) | 124 OverlayScrollBar::OverlayScrollBar(bool horizontal) |
125 : BaseScrollBar(horizontal), hide_timer_(false, false) { | 125 : BaseScrollBar(horizontal) { |
126 auto* thumb = new Thumb(this); | 126 auto* thumb = new Thumb(this); |
127 SetThumb(thumb); | 127 SetThumb(thumb); |
128 thumb->Init(); | 128 thumb->Init(); |
129 set_notify_enter_exit_on_child(true); | 129 set_notify_enter_exit_on_child(true); |
130 SetPaintToLayer(); | 130 SetPaintToLayer(); |
131 layer()->SetMasksToBounds(true); | 131 layer()->SetMasksToBounds(true); |
132 layer()->SetFillsBoundsOpaquely(false); | 132 layer()->SetFillsBoundsOpaquely(false); |
133 } | 133 } |
134 | 134 |
135 OverlayScrollBar::~OverlayScrollBar() {} | 135 OverlayScrollBar::~OverlayScrollBar() {} |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 | 184 |
185 void OverlayScrollBar::StartHideCountdown() { | 185 void OverlayScrollBar::StartHideCountdown() { |
186 if (IsMouseHovered()) | 186 if (IsMouseHovered()) |
187 return; | 187 return; |
188 hide_timer_.Start( | 188 hide_timer_.Start( |
189 FROM_HERE, ui::kOverlayScrollbarFadeDelay, | 189 FROM_HERE, ui::kOverlayScrollbarFadeDelay, |
190 base::Bind(&OverlayScrollBar::Hide, base::Unretained(this))); | 190 base::Bind(&OverlayScrollBar::Hide, base::Unretained(this))); |
191 } | 191 } |
192 | 192 |
193 } // namespace views | 193 } // namespace views |
OLD | NEW |