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..691d774d4e816b6575a0599cb5bec8c98e125bce |
| --- /dev/null |
| +++ b/ui/views/controls/scrollbar/native_cocoa_scroll_bar.h |
| @@ -0,0 +1,83 @@ |
| +// 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/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
|
| + : public NativeScrollBarViews, |
| + public ViewsScrollbarBridgeDelegate, |
| + public gfx::AnimationDelegate { |
| + public: |
| + explicit NativeCocoaScrollBarViews(NativeScrollBar* native_scroll_bar); |
| + ~NativeCocoaScrollBarViews() override; |
| + |
| + // BaseScrollBar override |
| + bool OnScroll(float dx, float dy) override; |
| + |
| + ui::NativeTheme::OverlayParams GetOverlayParams() override; |
| + |
| + // ViewsScrollbarBridgeDelegate override |
| + void OnScrollerStyleChanged() override; |
| + |
| + // Gets the scroller style from OSX and updates the scollbar if the style |
| + // has changed or hasn't been initialized yet. |
| + void UpdateScrollStyle(); |
| + |
| + private: |
| + // gfx::AnimationDelegate overrides: |
| + void AnimationProgressed(const gfx::Animation* animation) override; |
| + |
| + void ShowScrollbar(); |
| + void HideScrollbar(); |
| + |
| + 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
|
| + |
| + // Hiding animation for the scrollbars. |
| + gfx::LinearAnimation animation_; |
| + |
| + // Timer that will start the scrollbar's hiding animation when it reaches 0. |
| + base::OneShotTimer hide_scrollbar_timer_; |
| + |
| + // The opacity of the scrollbar. |
| + double scroller_opacity_; |
|
tapted
2016/02/08 00:31:15
This should probably be initialized too
spqchan
2016/02/09 21:21:25
Done.
|
| + |
| + // The bridge for NSScroller. |
| + base::scoped_nsobject<ViewsScrollbarBridge> bridge_; |
| + |
| + // Set to true after the object is initialized. |
| + bool init_; |
|
tapted
2016/02/08 00:31:15
(remove[ or initialize])
spqchan
2016/02/09 21:21:25
Done.
|
| + |
| + DISALLOW_COPY_AND_ASSIGN(NativeCocoaScrollBarViews); |
| +}; |
| + |
| +} // namespace views |
| + |
| +#endif // UI_VIEWS_CONTROLS_SCROLLBAR_COCOA_SCROLL_BAR_H_ |