Index: chrome/browser/ui/views/harmony/harmony_layout_delegate.cc |
diff --git a/chrome/browser/ui/views/harmony/harmony_layout_delegate.cc b/chrome/browser/ui/views/harmony/harmony_layout_delegate.cc |
index 57f90992c019c21ba18590ebbbad9fd623c760fc..63504f7d3cd2a57d072b7f64fe349aab47a9489a 100644 |
--- a/chrome/browser/ui/views/harmony/harmony_layout_delegate.cc |
+++ b/chrome/browser/ui/views/harmony/harmony_layout_delegate.cc |
@@ -80,15 +80,13 @@ bool HarmonyLayoutDelegate::IsHarmonyMode() const { |
return true; |
} |
-int HarmonyLayoutDelegate::GetDialogPreferredWidth(DialogWidth width) const { |
- switch (width) { |
- case DialogWidth::SMALL: |
- return 320; |
- case DialogWidth::MEDIUM: |
- return 448; |
- case DialogWidth::LARGE: |
- return 512; |
+int HarmonyLayoutDelegate::GetSnappedDialogWidth(int width) const { |
+ const int kSizes[] = {320, 448, 512}; |
Peter Kasting
2017/03/30 00:35:35
Nit: Can probably just inline this into the next l
|
+ for (const auto& size : kSizes) { |
+ if (size >= width) |
+ return size; |
} |
- NOTREACHED(); |
- return 0; |
+ |
+ return ((width + kHarmonyLayoutUnit - 1) / kHarmonyLayoutUnit) * |
+ kHarmonyLayoutUnit; |
} |