Chromium Code Reviews| Index: ui/views/controls/scrollbar/native_scroll_bar_views.cc |
| diff --git a/ui/views/controls/scrollbar/native_scroll_bar_views.cc b/ui/views/controls/scrollbar/native_scroll_bar_views.cc |
| index 3348b5bcbca041cc3e422722b685040a623e0c45..f9d2eb83ff002c7c8388525d32200ccbab7b90ce 100644 |
| --- a/ui/views/controls/scrollbar/native_scroll_bar_views.cc |
| +++ b/ui/views/controls/scrollbar/native_scroll_bar_views.cc |
| @@ -29,7 +29,9 @@ class ScrollBarButton : public BaseScrollBarButton { |
| RIGHT, |
| }; |
| - ScrollBarButton(ButtonListener* listener, Type type); |
| + ScrollBarButton(ButtonListener* listener, |
| + Type type, |
| + NativeScrollBarWrapper* wrapper); |
| ~ScrollBarButton() override; |
| gfx::Size GetPreferredSize() const override; |
| @@ -44,12 +46,14 @@ class ScrollBarButton : public BaseScrollBarButton { |
| ui::NativeTheme::State GetNativeThemeState() const; |
| Type type_; |
| + NativeScrollBarWrapper* wrapper_; |
| }; |
| // Wrapper for the scroll thumb |
| class ScrollBarThumb : public BaseScrollBarThumb { |
| public: |
| - explicit ScrollBarThumb(BaseScrollBar* scroll_bar); |
| + explicit ScrollBarThumb(BaseScrollBar* scroll_bar, |
|
tapted
2016/02/08 00:31:15
nit: explicit not needed
spqchan
2016/02/09 21:21:26
Done.
|
| + NativeScrollBarWrapper* wrapper); |
| ~ScrollBarThumb() override; |
| gfx::Size GetPreferredSize() const override; |
| @@ -64,14 +68,16 @@ class ScrollBarThumb : public BaseScrollBarThumb { |
| ui::NativeTheme::State GetNativeThemeState() const; |
| ScrollBar* scroll_bar_; |
| + NativeScrollBarWrapper* wrapper_; |
|
tapted
2016/02/08 00:31:15
hm. I wonder if ScrollBar should expose a GetNativ
spqchan
2016/02/09 21:21:26
ScrollBar doesn't contain the native_wrapper so th
|
| }; |
| ///////////////////////////////////////////////////////////////////////////// |
| // ScrollBarButton |
| -ScrollBarButton::ScrollBarButton(ButtonListener* listener, Type type) |
| - : BaseScrollBarButton(listener), |
| - type_(type) { |
| +ScrollBarButton::ScrollBarButton(ButtonListener* listener, |
| + Type type, |
| + NativeScrollBarWrapper* wrapper) |
| + : BaseScrollBarButton(listener), type_(type), wrapper_(wrapper) { |
| SetFocusable(false); |
| SetAccessibilityFocusable(false); |
| } |
| @@ -105,6 +111,8 @@ ui::NativeTheme::ExtraParams |
| break; |
| } |
| + params.scrollbar_arrow.overlay = wrapper_->GetOverlayParams(); |
|
tapted
2016/02/08 00:31:15
check for a null |wrapper_|?
spqchan
2016/02/09 21:21:26
Acknowledged.
|
| + |
| return params; |
| } |
| @@ -147,9 +155,11 @@ ui::NativeTheme::State |
| ///////////////////////////////////////////////////////////////////////////// |
| // ScrollBarThumb |
| -ScrollBarThumb::ScrollBarThumb(BaseScrollBar* scroll_bar) |
| +ScrollBarThumb::ScrollBarThumb(BaseScrollBar* scroll_bar, |
| + NativeScrollBarWrapper* wrapper) |
| : BaseScrollBarThumb(scroll_bar), |
| - scroll_bar_(scroll_bar) { |
| + scroll_bar_(scroll_bar), |
| + wrapper_(wrapper) { |
| SetFocusable(false); |
| SetAccessibilityFocusable(false); |
| } |
| @@ -184,6 +194,7 @@ ui::NativeTheme::ExtraParams ScrollBarThumb::GetNativeThemeParams() const { |
| ui::NativeTheme::ExtraParams params; |
| params.scrollbar_thumb.is_hovering = |
| (GetState() != CustomButton::STATE_HOVERED); |
| + params.scrollbar_thumb.overlay = wrapper_->GetOverlayParams(); |
|
tapted
2016/02/08 00:31:15
null check?
spqchan
2016/02/09 21:21:26
Acknowledged.
|
| return params; |
| } |
| @@ -219,19 +230,18 @@ ui::NativeTheme::State ScrollBarThumb::GetNativeThemeState() const { |
| const char NativeScrollBarViews::kViewClassName[] = "NativeScrollBarViews"; |
| NativeScrollBarViews::NativeScrollBarViews(NativeScrollBar* scroll_bar) |
| - : BaseScrollBar(scroll_bar->IsHorizontal(), |
| - new ScrollBarThumb(this)), |
| + : BaseScrollBar(scroll_bar->IsHorizontal(), new ScrollBarThumb(this, this)), |
| native_scroll_bar_(scroll_bar) { |
| set_controller(native_scroll_bar_->controller()); |
| if (native_scroll_bar_->IsHorizontal()) { |
| - prev_button_ = new ScrollBarButton(this, ScrollBarButton::LEFT); |
| - next_button_ = new ScrollBarButton(this, ScrollBarButton::RIGHT); |
| + prev_button_ = new ScrollBarButton(this, ScrollBarButton::LEFT, this); |
| + next_button_ = new ScrollBarButton(this, ScrollBarButton::RIGHT, this); |
| part_ = ui::NativeTheme::kScrollbarHorizontalTrack; |
| } else { |
| - prev_button_ = new ScrollBarButton(this, ScrollBarButton::UP); |
| - next_button_ = new ScrollBarButton(this, ScrollBarButton::DOWN); |
| + prev_button_ = new ScrollBarButton(this, ScrollBarButton::UP, this); |
| + next_button_ = new ScrollBarButton(this, ScrollBarButton::DOWN, this); |
| part_ = ui::NativeTheme::kScrollbarVerticalTrack; |
| } |
| @@ -406,4 +416,11 @@ int NativeScrollBarWrapper::GetVerticalScrollBarWidth( |
| return std::max(track_size.width(), button_size.width()); |
| } |
| +ui::NativeTheme::OverlayParams NativeScrollBarWrapper::GetOverlayParams() { |
| + ui::NativeTheme::OverlayParams params; |
| + params.is_overlay = false; |
| + params.alpha = 1.0; |
| + return params; |
| +} |
| + |
| } // namespace views |