Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(759)

Side by Side Diff: ui/views/controls/scrollbar/overlay_scroll_bar.cc

Issue 2837863004: Use base::OneShotTimer instead of base::Timer(false, false)
Patch Set: rebase Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/views/controls/scrollbar/overlay_scroll_bar.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « ui/views/controls/scrollbar/overlay_scroll_bar.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698