Chromium Code Reviews| Index: ui/views/views_delegate.cc |
| diff --git a/ui/views/views_delegate.cc b/ui/views/views_delegate.cc |
| index 8a78a96dedebbfa88229cb5d34284fd31393e216..5d46103b2b59acade260fa7e0955e538bc62a616 100644 |
| --- a/ui/views/views_delegate.cc |
| +++ b/ui/views/views_delegate.cc |
| @@ -19,6 +19,9 @@ namespace { |
| ViewsDelegate* views_delegate = nullptr; |
| +// Horizontal spacing between the image of a label button and its text. This |
| +// affects checkboxes and radiobuttons. |
| +constexpr int kIconTextSpacing = 5; |
|
Peter Kasting
2017/03/01 06:32:36
Nit: Can be defined in the function below that use
|
| } |
| ViewsDelegate::~ViewsDelegate() { |
| @@ -126,42 +129,42 @@ scoped_refptr<base::TaskRunner> ViewsDelegate::GetBlockingPoolTaskRunner() { |
| return nullptr; |
| } |
| -gfx::Insets ViewsDelegate::GetDialogButtonInsets() const { |
| - return gfx::Insets(0, kButtonHEdgeMarginNew, kButtonVEdgeMarginNew, |
| - kButtonHEdgeMarginNew); |
| -} |
| - |
| -int ViewsDelegate::GetDialogCloseButtonMargin() const { |
| - return kCloseButtonMargin; |
| -} |
| - |
| -int ViewsDelegate::GetDialogRelatedButtonHorizontalSpacing() const { |
| - return kRelatedButtonHSpacing; |
| -} |
| - |
| -int ViewsDelegate::GetDialogRelatedControlVerticalSpacing() const { |
| - return kRelatedControlVerticalSpacing; |
| -} |
| - |
| -gfx::Insets ViewsDelegate::GetDialogFrameViewInsets() const { |
| - return gfx::Insets(kPanelVertMargin, kButtonHEdgeMarginNew, 0, |
| - kButtonHEdgeMarginNew); |
| -} |
| - |
| -gfx::Insets ViewsDelegate::GetBubbleDialogMargins() const { |
| - return gfx::Insets(kPanelVertMargin, kPanelHorizMargin); |
| -} |
| - |
| -int ViewsDelegate::GetButtonMinimumWidth() const { |
| - return kMinimumButtonWidth; |
| -} |
| - |
| -int ViewsDelegate::GetDialogButtonMinimumWidth() const { |
| - return kDialogMinimumButtonWidth; |
| -} |
| - |
| -int ViewsDelegate::GetButtonHorizontalPadding() const { |
| - return kButtonHorizontalPadding; |
| +gfx::Insets ViewsDelegate::GetInsetsMetric(InsetsMetric metric) const { |
| + switch (metric) { |
| + case InsetsMetric::DIALOG_BUTTON: |
| + return gfx::Insets(0, kButtonHEdgeMarginNew, kButtonVEdgeMarginNew, |
| + kButtonHEdgeMarginNew); |
| + case InsetsMetric::DIALOG_FRAME_VIEW: |
| + return gfx::Insets(kPanelVertMargin, kButtonHEdgeMarginNew, 0, |
| + kButtonHEdgeMarginNew); |
| + case InsetsMetric::BUBBLE_DIALOG: |
| + return gfx::Insets(kPanelVertMargin, kPanelHorizMargin); |
| + } |
| + NOTREACHED(); |
| + return gfx::Insets(); |
| +} |
| + |
| +int ViewsDelegate::GetSpacingMetric(SpacingMetric metric) const { |
| + return GetDefaultSpacingMetric(metric); |
| +} |
| + |
| +int ViewsDelegate::GetDefaultSpacingMetric(SpacingMetric metric) { |
| + switch (metric) { |
| + case SpacingMetric::CLOSE_BUTTON_MARGIN: |
| + return kCloseButtonMargin; |
| + case SpacingMetric::RELATED_HORIZONTAL_BUTTON: |
| + return kRelatedButtonHSpacing; |
| + case SpacingMetric::RELATED_VERTICAL_CONTROL: |
| + return kRelatedControlVerticalSpacing; |
| + case SpacingMetric::ICON_TO_TEXT: |
| + return kIconTextSpacing; |
| + case SpacingMetric::DIALOG_BUTTON_MINIMUM_WIDTH: |
| + return kDialogMinimumButtonWidth; |
| + case SpacingMetric::BUTTON_HORIZONTAL_PADDING: |
| + return kButtonHorizontalPadding; |
| + } |
| + NOTREACHED(); |
| + return 0; |
| } |
| ViewsDelegate::ViewsDelegate() |