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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
73 } | 73 } |
74 | 74 |
75 bool HarmonyLayoutDelegate::ShouldShowWindowIcon() const { | 75 bool HarmonyLayoutDelegate::ShouldShowWindowIcon() const { |
76 return false; | 76 return false; |
77 } | 77 } |
78 | 78 |
79 bool HarmonyLayoutDelegate::IsHarmonyMode() const { | 79 bool HarmonyLayoutDelegate::IsHarmonyMode() const { |
80 return true; | 80 return true; |
81 } | 81 } |
82 | 82 |
83 int HarmonyLayoutDelegate::GetDialogPreferredWidth(DialogWidth width) const { | 83 int HarmonyLayoutDelegate::GetSnappedDialogWidth(int width) const { |
84 switch (width) { | 84 const int kSizes[] = {320, 448, 512}; |
Peter Kasting
2017/03/30 00:35:35
Nit: Can probably just inline this into the next l
| |
85 case DialogWidth::SMALL: | 85 for (const auto& size : kSizes) { |
86 return 320; | 86 if (size >= width) |
87 case DialogWidth::MEDIUM: | 87 return size; |
88 return 448; | |
89 case DialogWidth::LARGE: | |
90 return 512; | |
91 } | 88 } |
92 NOTREACHED(); | 89 |
93 return 0; | 90 return ((width + kHarmonyLayoutUnit - 1) / kHarmonyLayoutUnit) * |
91 kHarmonyLayoutUnit; | |
94 } | 92 } |
OLD | NEW |