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

Side by Side Diff: ash/common/system/tray/fixed_sized_scroll_view.cc

Issue 2558173006: Use overlay scrollbars by default in CrOS native UI. (Closed)
Patch Set: rebase Created 4 years 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 unified diff | Download patch
« no previous file with comments | « no previous file | ui/views/style/platform_style.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/common/system/tray/fixed_sized_scroll_view.h" 5 #include "ash/common/system/tray/fixed_sized_scroll_view.h"
6 6
7 #include "ash/common/material_design/material_design_controller.h" 7 #include "ash/common/material_design/material_design_controller.h"
8 #include "ui/views/controls/scrollbar/overlay_scroll_bar.h"
9 8
10 namespace ash { 9 namespace ash {
11 10
12 namespace { 11 namespace {
13 12
14 bool UseMd() { 13 bool UseMd() {
15 return MaterialDesignController::IsSystemTrayMenuMaterial(); 14 return MaterialDesignController::IsSystemTrayMenuMaterial();
16 } 15 }
17 16
18 } // namespace 17 } // namespace
19 18
20 FixedSizedScrollView::FixedSizedScrollView() { 19 FixedSizedScrollView::FixedSizedScrollView() {
21 set_notify_enter_exit_on_child(true); 20 set_notify_enter_exit_on_child(true);
22 if (UseMd()) {
23 SetVerticalScrollBar(new views::OverlayScrollBar(false));
24 SetHorizontalScrollBar(new views::OverlayScrollBar(true));
25 }
26 } 21 }
27 22
28 FixedSizedScrollView::~FixedSizedScrollView() {} 23 FixedSizedScrollView::~FixedSizedScrollView() {}
29 24
30 void FixedSizedScrollView::SetContentsView(views::View* view) { 25 void FixedSizedScrollView::SetContentsView(views::View* view) {
31 SetContents(view); 26 SetContents(view);
32 if (!UseMd()) 27 if (!UseMd())
33 view->SetBoundsRect(gfx::Rect(view->GetPreferredSize())); 28 view->SetBoundsRect(gfx::Rect(view->GetPreferredSize()));
34 } 29 }
35 30
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 void FixedSizedScrollView::OnBoundsChanged(const gfx::Rect& previous_bounds) { 76 void FixedSizedScrollView::OnBoundsChanged(const gfx::Rect& previous_bounds) {
82 if (UseMd()) 77 if (UseMd())
83 return; 78 return;
84 79
85 gfx::Rect bounds = gfx::Rect(contents()->GetPreferredSize()); 80 gfx::Rect bounds = gfx::Rect(contents()->GetPreferredSize());
86 bounds.set_width(std::max(0, width() - GetScrollBarLayoutWidth())); 81 bounds.set_width(std::max(0, width() - GetScrollBarLayoutWidth()));
87 contents()->SetBoundsRect(bounds); 82 contents()->SetBoundsRect(bounds);
88 } 83 }
89 84
90 } // namespace ash 85 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ui/views/style/platform_style.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698