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

Side by Side Diff: ui/views/controls/scrollbar/native_cocoa_scroll_bar.h

Issue 1671313002: MacViews: Overlay Scrollbars with Show/Hide Animations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added comments and fixed nits Created 4 years, 10 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
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef UI_VIEWS_CONTROLS_SCROLLBAR_NATIVE_COCOA_SCROLL_BAR_H_
6 #define UI_VIEWS_CONTROLS_SCROLLBAR_NATIVE_COCOA_SCROLL_BAR_H_
7
8 #include "base/macros.h"
9 #import "base/mac/scoped_nsobject.h"
10 #include "ui/gfx/animation/linear_animation.h"
11 #import "ui/views/cocoa/views_scrollbar_bridge.h"
12 #include "ui/views/controls/scrollbar/base_scroll_bar.h"
13 #include "ui/views/controls/scrollbar/native_scroll_bar.h"
14 #include "ui/views/controls/scrollbar/native_scroll_bar_views.h"
15 #include "ui/views/views_export.h"
16
17 @class ViewsScrollbarBridge;
18
19 namespace views {
20
21 // The transparent scrollbar which overlays its contents.
22 class VIEWS_EXPORT NativeCocoaScrollBar : public NativeScrollBar {
23 public:
24 explicit NativeCocoaScrollBar(bool horizontal);
25 ~NativeCocoaScrollBar() override;
26
27 protected:
28 NativeScrollBarWrapper* CreateWrapper() override;
29
30 private:
31 DISALLOW_COPY_AND_ASSIGN(NativeCocoaScrollBar);
32 };
33
34 class VIEWS_EXPORT NativeCocoaScrollBarViews
tapted 2016/02/08 00:31:15 nit: needs a comment also I'm not sure about `Nat
spqchan 2016/02/09 21:21:25 That's true, I'm not sure what the best name it is
35 : public NativeScrollBarViews,
36 public ViewsScrollbarBridgeDelegate,
37 public gfx::AnimationDelegate {
38 public:
39 explicit NativeCocoaScrollBarViews(NativeScrollBar* native_scroll_bar);
40 ~NativeCocoaScrollBarViews() override;
41
42 // BaseScrollBar override
43 bool OnScroll(float dx, float dy) override;
44
45 ui::NativeTheme::OverlayParams GetOverlayParams() override;
46
47 // ViewsScrollbarBridgeDelegate override
48 void OnScrollerStyleChanged() override;
49
50 // Gets the scroller style from OSX and updates the scollbar if the style
51 // has changed or hasn't been initialized yet.
52 void UpdateScrollStyle();
53
54 private:
55 // gfx::AnimationDelegate overrides:
56 void AnimationProgressed(const gfx::Animation* animation) override;
57
58 void ShowScrollbar();
59 void HideScrollbar();
60
61 NSScrollerStyle scroller_style_;
tapted 2016/02/08 00:31:15 needs an initializer, since UpdateScrollStyle chec
spqchan 2016/02/09 21:21:25 Hm, that is true. I can't set it to -1 since it's
62
63 // Hiding animation for the scrollbars.
64 gfx::LinearAnimation animation_;
65
66 // Timer that will start the scrollbar's hiding animation when it reaches 0.
67 base::OneShotTimer hide_scrollbar_timer_;
68
69 // The opacity of the scrollbar.
70 double scroller_opacity_;
tapted 2016/02/08 00:31:15 This should probably be initialized too
spqchan 2016/02/09 21:21:25 Done.
71
72 // The bridge for NSScroller.
73 base::scoped_nsobject<ViewsScrollbarBridge> bridge_;
74
75 // Set to true after the object is initialized.
76 bool init_;
tapted 2016/02/08 00:31:15 (remove[ or initialize])
spqchan 2016/02/09 21:21:25 Done.
77
78 DISALLOW_COPY_AND_ASSIGN(NativeCocoaScrollBarViews);
79 };
80
81 } // namespace views
82
83 #endif // UI_VIEWS_CONTROLS_SCROLLBAR_COCOA_SCROLL_BAR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698