Chromium Code Reviews| Index: ui/views/controls/scrollbar/native_cocoa_scroll_bar.h |
| diff --git a/ui/views/controls/scrollbar/native_cocoa_scroll_bar.h b/ui/views/controls/scrollbar/native_cocoa_scroll_bar.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..837447d138784b5047d21a14330bde73da54ec0d |
| --- /dev/null |
| +++ b/ui/views/controls/scrollbar/native_cocoa_scroll_bar.h |
| @@ -0,0 +1,64 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef UI_VIEWS_CONTROLS_SCROLLBAR_NATIVE_COCOA_SCROLL_BAR_H_ |
| +#define UI_VIEWS_CONTROLS_SCROLLBAR_NATIVE_COCOA_SCROLL_BAR_H_ |
| + |
| +#include "base/macros.h" |
| +#import "base/mac/scoped_nsobject.h" |
| +#include "ui/gfx/animation/linear_animation.h" |
| +#import "ui/views/cocoa/views_scrollbar_bridge.h" |
| +#include "ui/views/controls/scrollbar/base_scroll_bar.h" |
| +#include "ui/views/controls/scrollbar/native_scroll_bar.h" |
| +#include "ui/views/controls/scrollbar/native_scroll_bar_views.h" |
| +#include "ui/views/views_export.h" |
| + |
| +@class ViewsScrollbarBridge; |
| + |
| +namespace views { |
| + |
| +// The transparent scrollbar which overlays its contents. |
| +class VIEWS_EXPORT NativeCocoaScrollBar : public NativeScrollBar { |
| + public: |
| + explicit NativeCocoaScrollBar(bool horizontal); |
| + ~NativeCocoaScrollBar() override; |
| + |
| + protected: |
| + NativeScrollBarWrapper* CreateWrapper() override; |
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(NativeCocoaScrollBar); |
| +}; |
| + |
| +class VIEWS_EXPORT NativeCocoaScrollBarViews |
|
tapted
2016/02/11 08:46:17
I think this should be
NativeScrollBarViewsMac
i
spqchan
2016/02/13 01:39:23
I just switched back to CocoaScrollBar, do you thi
|
| + : public NativeScrollBarViews, |
|
tapted
2016/02/11 08:46:17
We should override NativeScrollBarViews::OnPaint()
spqchan
2016/02/13 01:39:23
Did it for CocoaScrollBar.
|
| + public ViewsScrollbarBridgeDelegate { |
| + public: |
| + explicit NativeCocoaScrollBarViews(NativeScrollBar* native_scroll_bar); |
| + ~NativeCocoaScrollBarViews() override; |
| + |
| + // BaseScrollBar override |
|
tapted
2016/02/11 08:46:17
nit: Lately views OWNERS have been asking me to go
spqchan
2016/02/13 01:39:23
Done.
|
| + bool OnScroll(float dx, float dy) override; |
| + |
|
tapted
2016/02/11 08:46:17
Hm... how do we fix the layout so that the content
spqchan
2016/02/13 01:39:23
I used return 0 for GetLayoutSize()
I used the scr
|
| + // ViewsScrollbarBridgeDelegate override |
| + void OnScrollerStyleChanged() override; |
| + |
| + private: |
| + void ShowScrollbar(); |
| + void HideScrollbar(); |
| + |
| + NSScrollerStyle scroller_style_; |
| + |
| + // Timer that will start the scrollbar's hiding animation when it reaches 0. |
| + base::OneShotTimer hide_scrollbar_timer_; |
| + |
| + // The bridge for NSScroller. |
| + base::scoped_nsobject<ViewsScrollbarBridge> bridge_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(NativeCocoaScrollBarViews); |
| +}; |
| + |
| +} // namespace views |
| + |
| +#endif // UI_VIEWS_CONTROLS_SCROLLBAR_COCOA_SCROLL_BAR_H_ |