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

Unified Diff: chrome/browser/ui/views/harmony/layout_delegate.cc

Issue 2696263002: Refactor ViewsDelegate and MD-ify the icon-to-text spacing for checkbox and radiobutton (Closed)
Patch Set: Added GetDefaultSpacingMetric to ViewsDelegate to start process of hiding layout constants Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/harmony/layout_delegate.h ('k') | ui/views/bubble/bubble_dialog_delegate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/harmony/layout_delegate.cc
diff --git a/chrome/browser/ui/views/harmony/layout_delegate.cc b/chrome/browser/ui/views/harmony/layout_delegate.cc
index d366297d1520fffbeb0db5a3fd029cdd8165bb85..def928ab974182c70662d43818e7361941acf2b0 100644
--- a/chrome/browser/ui/views/harmony/layout_delegate.cc
+++ b/chrome/browser/ui/views/harmony/layout_delegate.cc
@@ -9,6 +9,7 @@
#include "chrome/browser/ui/views/harmony/harmony_layout_delegate.h"
#include "ui/base/material_design/material_design_controller.h"
#include "ui/views/layout/layout_constants.h"
+#include "ui/views/views_delegate.h"
static base::LazyInstance<LayoutDelegate> layout_delegate_ =
LAZY_INSTANCE_INITIALIZER;
@@ -23,21 +24,26 @@ LayoutDelegate* LayoutDelegate::Get() {
int LayoutDelegate::GetMetric(Metric metric) const {
switch (metric) {
case Metric::BUTTON_HORIZONTAL_PADDING:
- return 0;
+ return views::ViewsDelegate::GetDefaultSpacingMetric(
+ views::SpacingMetric::BUTTON_HORIZONTAL_PADDING);
case Metric::DIALOG_BUTTON_MARGIN:
return views::kButtonHEdgeMarginNew;
case Metric::DIALOG_BUTTON_MINIMUM_WIDTH:
- return views::kDialogMinimumButtonWidth;
+ return views::ViewsDelegate::GetDefaultSpacingMetric(
+ views::SpacingMetric::DIALOG_BUTTON_MINIMUM_WIDTH);
case Metric::DIALOG_BUTTON_TOP_SPACING:
return 0;
case Metric::DIALOG_CLOSE_BUTTON_MARGIN:
- return views::kCloseButtonMargin;
+ return views::ViewsDelegate::GetDefaultSpacingMetric(
+ views::SpacingMetric::CLOSE_BUTTON_MARGIN);
case Metric::PANEL_CONTENT_MARGIN:
return views::kPanelHorizMargin;
case Metric::RELATED_BUTTON_HORIZONTAL_SPACING:
- return views::kRelatedButtonHSpacing;
+ return views::ViewsDelegate::GetDefaultSpacingMetric(
+ views::SpacingMetric::RELATED_HORIZONTAL_BUTTON);
case Metric::RELATED_CONTROL_HORIZONTAL_SPACING:
- return views::kRelatedControlHorizontalSpacing;
+ return views::ViewsDelegate::GetDefaultSpacingMetric(
+ views::SpacingMetric::RELATED_VERTICAL_CONTROL);
case Metric::RELATED_CONTROL_VERTICAL_SPACING:
return views::kRelatedControlVerticalSpacing;
case Metric::RELATED_LABEL_HORIZONTAL_SPACING:
@@ -52,6 +58,9 @@ int LayoutDelegate::GetMetric(Metric metric) const {
return views::kUnrelatedControlVerticalSpacing;
case Metric::UNRELATED_CONTROL_VERTICAL_SPACING_LARGE:
return views::kUnrelatedControlLargeVerticalSpacing;
+ case Metric::ICON_TEXT_SPACING:
+ return views::ViewsDelegate::GetDefaultSpacingMetric(
sky 2017/02/24 18:31:13 I would rather see this code call ChromeViewsDeleg
kylix_rd 2017/02/24 19:04:20 I placed the function on ViewsDelegate as a static
Peter Kasting 2017/02/24 20:41:03 We should fix the tests so there is always a Views
+ views::SpacingMetric::ICON_TO_TEXT);
}
NOTREACHED();
return 0;
« no previous file with comments | « chrome/browser/ui/views/harmony/layout_delegate.h ('k') | ui/views/bubble/bubble_dialog_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698