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

Unified 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/harmony/harmony_layout_provider.cc
diff --git a/chrome/browser/ui/views/harmony/harmony_layout_provider.cc b/chrome/browser/ui/views/harmony/harmony_layout_provider.cc
index 35a53b1c86967bc30fd21af665b5609f97201745..d9dbd4df5da70dd78248197499dd622738bf0c83 100644
--- a/chrome/browser/ui/views/harmony/harmony_layout_provider.cc
+++ b/chrome/browser/ui/views/harmony/harmony_layout_provider.cc
@@ -95,17 +95,14 @@ bool HarmonyLayoutProvider::IsHarmonyMode() const {
return true;
}
-int HarmonyLayoutProvider::GetDialogPreferredWidth(DialogWidth width) const {
- switch (width) {
- case DialogWidth::SMALL:
- return 320;
- case DialogWidth::MEDIUM:
- return 448;
- case DialogWidth::LARGE:
- return 512;
+int HarmonyLayoutProvider::GetSnappedDialogWidth(int min_width) const {
+ for (int snap_point : {320, 448, 512}) {
+ if (min_width <= snap_point)
+ return snap_point;
}
- NOTREACHED();
- return 0;
+
+ return ((min_width + kHarmonyLayoutUnit - 1) / kHarmonyLayoutUnit) *
+ kHarmonyLayoutUnit;
}
const views::TypographyProvider& HarmonyLayoutProvider::GetTypographyProvider()
« 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