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

Side by Side Diff: chrome/browser/ui/views/harmony/harmony_layout_provider.cc

Issue 2821413002: views: support dialog width snapping once and for all (Closed)
Patch Set: fix failing unittest Created 3 years, 8 months 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
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 "chrome/browser/ui/views/harmony/harmony_layout_provider.h" 5 #include "chrome/browser/ui/views/harmony/harmony_layout_provider.h"
6 6
7 gfx::Insets HarmonyLayoutProvider::GetInsetsMetric(int metric) const { 7 gfx::Insets HarmonyLayoutProvider::GetInsetsMetric(int metric) const {
8 DCHECK_LT(metric, views::VIEWS_INSETS_MAX); 8 DCHECK_LT(metric, views::VIEWS_INSETS_MAX);
9 switch (metric) { 9 switch (metric) {
10 case views::INSETS_DIALOG_BUTTON: 10 case views::INSETS_DIALOG_BUTTON:
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 } 88 }
89 89
90 bool HarmonyLayoutProvider::ShouldShowWindowIcon() const { 90 bool HarmonyLayoutProvider::ShouldShowWindowIcon() const {
91 return false; 91 return false;
92 } 92 }
93 93
94 bool HarmonyLayoutProvider::IsHarmonyMode() const { 94 bool HarmonyLayoutProvider::IsHarmonyMode() const {
95 return true; 95 return true;
96 } 96 }
97 97
98 int HarmonyLayoutProvider::GetDialogPreferredWidth(DialogWidth width) const { 98 int HarmonyLayoutProvider::GetSnappedDialogWidth(int min_width) const {
99 switch (width) { 99 for (int snap_point : {320, 448, 512}) {
100 case DialogWidth::SMALL: 100 if (min_width <= snap_point)
101 return 320; 101 return snap_point;
102 case DialogWidth::MEDIUM:
103 return 448;
104 case DialogWidth::LARGE:
105 return 512;
106 } 102 }
107 NOTREACHED(); 103
108 return 0; 104 return ((min_width + kHarmonyLayoutUnit - 1) / kHarmonyLayoutUnit) *
105 kHarmonyLayoutUnit;
109 } 106 }
110 107
111 const views::TypographyProvider& HarmonyLayoutProvider::GetTypographyProvider() 108 const views::TypographyProvider& HarmonyLayoutProvider::GetTypographyProvider()
112 const { 109 const {
113 return typography_provider_; 110 return typography_provider_;
114 } 111 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/harmony/harmony_layout_provider.h ('k') | ui/views/bubble/bubble_frame_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698