Chromium Code Reviews| Index: ui/views/controls/scrollbar/overlay_scroll_bar.h |
| diff --git a/ui/views/controls/scrollbar/overlay_scroll_bar.h b/ui/views/controls/scrollbar/overlay_scroll_bar.h |
| index 36f908c2e7b10a172a68de3e761b1e3e82151752..b3dade83462420650bace249a391d8c3d1e7a095 100644 |
| --- a/ui/views/controls/scrollbar/overlay_scroll_bar.h |
| +++ b/ui/views/controls/scrollbar/overlay_scroll_bar.h |
| @@ -8,6 +8,7 @@ |
| #include "base/macros.h" |
| #include "ui/gfx/animation/slide_animation.h" |
| #include "ui/views/controls/scrollbar/base_scroll_bar.h" |
| +#include "ui/views/controls/scrollbar/base_scroll_bar_thumb.h" |
| namespace views { |
| @@ -20,19 +21,49 @@ class VIEWS_EXPORT OverlayScrollBar : public BaseScrollBar { |
| protected: |
| // BaseScrollBar overrides: |
| gfx::Rect GetTrackBounds() const override; |
| - void OnGestureEvent(ui::GestureEvent* event) override; |
| // ScrollBar overrides: |
| int GetLayoutSize() const override; |
| int GetContentOverlapSize() const override; |
| - void OnMouseEnteredScrollView(const ui::MouseEvent& event) override; |
| - void OnMouseExitedScrollView(const ui::MouseEvent& event) override; |
| // View overrides: |
| void Layout() override; |
| + void OnMouseEntered(const ui::MouseEvent& event) override; |
| + void OnMouseExited(const ui::MouseEvent& event) override; |
| private: |
| - gfx::SlideAnimation animation_; |
| + class Thumb : public BaseScrollBarThumb, public gfx::AnimationDelegate { |
| + public: |
| + explicit Thumb(OverlayScrollBar* scroll_bar); |
| + ~Thumb() override; |
| + |
| + protected: |
| + // BaseScrollBarThumb: |
| + gfx::Size GetPreferredSize() const override; |
| + void OnPaint(gfx::Canvas* canvas) override; |
| + void OnBoundsChanged(const gfx::Rect& previous_bounds) override; |
| + void SetState(CustomButton::ButtonState state) override; |
| + |
| + // gfx::AnimationDelegate overrides: |
|
tdanderson
2016/11/10 20:50:21
nit: just gfx::AnimationDelegate:
Evan Stade
2016/11/11 02:46:46
guess I don't really care one way or another, but
|
| + void AnimationProgressed(const gfx::Animation* animation) override; |
| + |
| + private: |
| + OverlayScrollBar* scroll_bar_; |
| + gfx::SlideAnimation hover_animation_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(Thumb); |
| + }; |
| + friend class Thumb; |
| + |
| + // Shows the thumb without delay. |
| + void ShowThumb(); |
| + // Hides the thumb with a delay. |
| + void HideThumb(); |
| + // Starts a countdown that hides the thumb when it fires. |
| + void StartThumbHideCountdown(); |
| + |
| + base::Timer thumb_hide_timer_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(OverlayScrollBar); |
| }; |