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

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

Issue 2750063002: views: implement dialog width snapping (Closed)
Patch Set: 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 16 matching lines...) Expand all
27 case Metric::DIALOG_BUTTON_MINIMUM_WIDTH: 27 case Metric::DIALOG_BUTTON_MINIMUM_WIDTH:
28 // Minimum label size plus padding. 28 // Minimum label size plus padding.
29 return 2 * kHarmonyLayoutUnit + 29 return 2 * kHarmonyLayoutUnit +
30 2 * GetMetric(Metric::BUTTON_HORIZONTAL_PADDING); 30 2 * GetMetric(Metric::BUTTON_HORIZONTAL_PADDING);
31 case Metric::DIALOG_BUTTON_TOP_SPACING: 31 case Metric::DIALOG_BUTTON_TOP_SPACING:
32 return kHarmonyLayoutUnit; 32 return kHarmonyLayoutUnit;
33 case Metric::DIALOG_CLOSE_BUTTON_MARGIN: 33 case Metric::DIALOG_CLOSE_BUTTON_MARGIN:
34 // TODO(pkasting): The "- 4" here is a hack that matches the extra padding 34 // TODO(pkasting): The "- 4" here is a hack that matches the extra padding
35 // in vector_icon_button.cc and should be removed when that padding is. 35 // in vector_icon_button.cc and should be removed when that padding is.
36 return (kHarmonyLayoutUnit / 2) - 4; 36 return (kHarmonyLayoutUnit / 2) - 4;
37 case Metric::DIALOG_WIDTH_SNAPPING_UNIT:
38 return kHarmonyLayoutUnit;
37 case Metric::PANEL_CONTENT_MARGIN: 39 case Metric::PANEL_CONTENT_MARGIN:
38 return kHarmonyLayoutUnit; 40 return kHarmonyLayoutUnit;
39 case Metric::RELATED_BUTTON_HORIZONTAL_SPACING: 41 case Metric::RELATED_BUTTON_HORIZONTAL_SPACING:
40 return kHarmonyLayoutUnit / 2; 42 return kHarmonyLayoutUnit / 2;
41 case Metric::RELATED_CONTROL_HORIZONTAL_SPACING: 43 case Metric::RELATED_CONTROL_HORIZONTAL_SPACING:
42 return kHarmonyLayoutUnit; 44 return kHarmonyLayoutUnit;
43 case Metric::RELATED_CONTROL_VERTICAL_SPACING: 45 case Metric::RELATED_CONTROL_VERTICAL_SPACING:
44 return kHarmonyLayoutUnit / 2; 46 return kHarmonyLayoutUnit / 2;
45 case Metric::RELATED_LABEL_HORIZONTAL_SPACING: 47 case Metric::RELATED_LABEL_HORIZONTAL_SPACING:
46 return kHarmonyLayoutUnit; 48 return kHarmonyLayoutUnit;
(...skipping 30 matching lines...) Expand all
77 case DialogWidth::SMALL: 79 case DialogWidth::SMALL:
78 return 320; 80 return 320;
79 case DialogWidth::MEDIUM: 81 case DialogWidth::MEDIUM:
80 return 448; 82 return 448;
81 case DialogWidth::LARGE: 83 case DialogWidth::LARGE:
82 return 512; 84 return 512;
83 } 85 }
84 NOTREACHED(); 86 NOTREACHED();
85 return 0; 87 return 0;
86 } 88 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698