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

Side by Side Diff: chrome/browser/ui/views/harmony/harmony_layout_delegate.cc

Issue 2750063002: views: implement dialog width snapping (Closed)
Patch Set: remove stray logging Created 3 years, 9 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 unified diff | Download patch
OLDNEW
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
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 kDefaultWidths[] = {320, 448, 512};
85 case DialogWidth::SMALL: 85 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
86 return 320; 86 if (width <= kDefaultWidths[i])
87 case DialogWidth::MEDIUM: 87 return kDefaultWidths[i];
88 return 448;
89 case DialogWidth::LARGE:
90 return 512;
91 } 88 }
92 NOTREACHED(); 89 return ((width + kHarmonyLayoutUnit - 1) / kHarmonyLayoutUnit) *
93 return 0; 90 kHarmonyLayoutUnit;
94 } 91 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698