| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_delegate.h" | 5 #include "chrome/browser/ui/views/harmony/harmony_layout_delegate.h" |
| 6 | 6 |
| 7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 | 9 |
| 10 static base::LazyInstance<HarmonyLayoutDelegate>::DestructorAtExit | 10 static base::LazyInstance<HarmonyLayoutDelegate>::DestructorAtExit |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 } | 77 } |
| 78 | 78 |
| 79 bool HarmonyLayoutDelegate::ShouldShowWindowIcon() const { | 79 bool HarmonyLayoutDelegate::ShouldShowWindowIcon() const { |
| 80 return false; | 80 return false; |
| 81 } | 81 } |
| 82 | 82 |
| 83 bool HarmonyLayoutDelegate::IsHarmonyMode() const { | 83 bool HarmonyLayoutDelegate::IsHarmonyMode() const { |
| 84 return true; | 84 return true; |
| 85 } | 85 } |
| 86 | 86 |
| 87 int HarmonyLayoutDelegate::GetDialogPreferredWidth(DialogWidth width) const { | 87 int HarmonyLayoutDelegate::GetSnappedDialogWidth(int min_width) const { |
| 88 switch (width) { | 88 for (int width : {320, 448, 512}) { |
| 89 case DialogWidth::SMALL: | 89 if (min_width <= width) |
| 90 return 320; | 90 return width; |
| 91 case DialogWidth::MEDIUM: | |
| 92 return 448; | |
| 93 case DialogWidth::LARGE: | |
| 94 return 512; | |
| 95 } | 91 } |
| 96 NOTREACHED(); | 92 return ((min_width + kHarmonyLayoutUnit - 1) / kHarmonyLayoutUnit) * |
| 97 return 0; | 93 kHarmonyLayoutUnit; |
| 98 } | 94 } |
| OLD | NEW |