| Index: ash/common/system/tray/fixed_sized_scroll_view.cc
|
| diff --git a/ash/common/system/tray/fixed_sized_scroll_view.cc b/ash/common/system/tray/fixed_sized_scroll_view.cc
|
| index f63f84bd008833b8038d6093a63a848e19da1c2c..4bc89220354cb76bb65108bd524b0fc8f2d64306 100644
|
| --- a/ash/common/system/tray/fixed_sized_scroll_view.cc
|
| +++ b/ash/common/system/tray/fixed_sized_scroll_view.cc
|
| @@ -4,10 +4,24 @@
|
|
|
| #include "ash/common/system/tray/fixed_sized_scroll_view.h"
|
|
|
| +#include "ash/common/material_design/material_design_controller.h"
|
| +#include "ui/views/background.h"
|
| +#include "ui/views/controls/scrollbar/overlay_scroll_bar.h"
|
| +
|
| namespace ash {
|
|
|
| +namespace {
|
| +
|
| +bool UseMd() {
|
| + return MaterialDesignController::IsSystemTrayMenuMaterial();
|
| +}
|
| +
|
| +} // namespace
|
| +
|
| FixedSizedScrollView::FixedSizedScrollView() {
|
| set_notify_enter_exit_on_child(true);
|
| + if (UseMd())
|
| + SetVerticalScrollBar(new views::OverlayScrollBar(false));
|
| }
|
|
|
| FixedSizedScrollView::~FixedSizedScrollView() {}
|
| @@ -18,12 +32,18 @@ void FixedSizedScrollView::SetContentsView(views::View* view) {
|
| }
|
|
|
| void FixedSizedScrollView::SetFixedSize(const gfx::Size& size) {
|
| + DCHECK(!UseMd());
|
| if (fixed_size_ == size)
|
| return;
|
| fixed_size_ = size;
|
| PreferredSizeChanged();
|
| }
|
|
|
| +void FixedSizedScrollView::set_fixed_size(const gfx::Size& size) {
|
| + DCHECK(!UseMd());
|
| + fixed_size_ = size;
|
| +}
|
| +
|
| gfx::Size FixedSizedScrollView::GetPreferredSize() const {
|
| gfx::Size size =
|
| fixed_size_.IsEmpty() ? contents()->GetPreferredSize() : fixed_size_;
|
| @@ -33,6 +53,11 @@ gfx::Size FixedSizedScrollView::GetPreferredSize() const {
|
| }
|
|
|
| void FixedSizedScrollView::Layout() {
|
| + if (UseMd()) {
|
| + views::ScrollView::Layout();
|
| + return;
|
| + }
|
| +
|
| gfx::Rect bounds = gfx::Rect(contents()->GetPreferredSize());
|
| bounds.set_width(std::max(0, width() - GetScrollBarWidth()));
|
| // Keep the origin of the contents unchanged so that the list will not scroll
|
| @@ -51,6 +76,9 @@ void FixedSizedScrollView::Layout() {
|
| }
|
|
|
| void FixedSizedScrollView::OnBoundsChanged(const gfx::Rect& previous_bounds) {
|
| + if (UseMd())
|
| + return;
|
| +
|
| gfx::Rect bounds = gfx::Rect(contents()->GetPreferredSize());
|
| bounds.set_width(std::max(0, width() - GetScrollBarWidth()));
|
| contents()->SetBoundsRect(bounds);
|
|
|