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

Unified Diff: ui/views/views_delegate.cc

Issue 2696263002: Refactor ViewsDelegate and MD-ify the icon-to-text spacing for checkbox and radiobutton (Closed)
Patch Set: Used ifdef instead of duplicated code for delegate initialization 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/views_delegate.h ('k') | ui/views/window/dialog_client_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/views_delegate.cc
diff --git a/ui/views/views_delegate.cc b/ui/views/views_delegate.cc
index 8a78a96dedebbfa88229cb5d34284fd31393e216..a14cf4882998ba300f4f8e1d42605e57716af110 100644
--- a/ui/views/views_delegate.cc
+++ b/ui/views/views_delegate.cc
@@ -126,42 +126,38 @@ 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::GetDistanceMetric(DistanceMetric metric) const {
+ switch (metric) {
+ case DistanceMetric::CLOSE_BUTTON_MARGIN:
+ return kCloseButtonMargin;
+ case DistanceMetric::RELATED_BUTTON_HORIZONTAL:
+ return kRelatedButtonHSpacing;
+ case DistanceMetric::RELATED_CONTROL_HORIZONTAL:
+ return kRelatedControlHorizontalSpacing;
+ case DistanceMetric::RELATED_CONTROL_VERTICAL:
+ return kRelatedControlVerticalSpacing;
+ case DistanceMetric::DIALOG_BUTTON_MINIMUM_WIDTH:
+ return kDialogMinimumButtonWidth;
+ case DistanceMetric::BUTTON_HORIZONTAL_PADDING:
+ return kButtonHorizontalPadding;
+ }
+ NOTREACHED();
+ return 0;
}
ViewsDelegate::ViewsDelegate()
« no previous file with comments | « ui/views/views_delegate.h ('k') | ui/views/window/dialog_client_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698