Chromium Code Reviews| 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..c226d7b29a1daafcf95422f7b7bfcc52aa3534d7 100644 |
| --- a/chrome/browser/ui/views/harmony/harmony_layout_delegate.cc |
| +++ b/chrome/browser/ui/views/harmony/harmony_layout_delegate.cc |
| @@ -80,15 +80,12 @@ 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 kDefaultWidths[] = {320, 448, 512}; |
| + for (size_t i = 0; i < arraysize(kDefaultWidths); ++i) { |
|
tapted
2017/03/29 23:16:16
for (int snapped_width : kDefaultWidths)
(or `wi
Elly Fong-Jones
2017/04/05 18:17:53
Done.
I actually went one further and made it:
fo
|
| + if (width <= kDefaultWidths[i]) |
| + return kDefaultWidths[i]; |
| } |
| - NOTREACHED(); |
| - return 0; |
| + return ((width + kHarmonyLayoutUnit - 1) / kHarmonyLayoutUnit) * |
| + kHarmonyLayoutUnit; |
| } |