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

Unified Diff: ash/common/system/tray/fixed_sized_scroll_view.cc

Issue 2478273003: Use overlay scrollbars for the cros system menu. (Closed)
Patch Set: rebase Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/common/system/tray/fixed_sized_scroll_view.h ('k') | ash/common/system/tray/tray_details_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « ash/common/system/tray/fixed_sized_scroll_view.h ('k') | ash/common/system/tray/tray_details_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698