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

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: Reduced ViewsDelegate layout/metric functions to only two functions 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
Index: ui/views/views_delegate.cc
diff --git a/ui/views/views_delegate.cc b/ui/views/views_delegate.cc
index c47604bb8a77bec9cb230036b261bc21da41b973..1aee2c8ceb2fd7b7520accd42a6883bd23167655 100644
--- a/ui/views/views_delegate.cc
+++ b/ui/views/views_delegate.cc
@@ -126,30 +126,34 @@ 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);
+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 {
+ 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;
+ }
+ NOTREACHED();
+ return 0;
}
ViewsDelegate::ViewsDelegate()

Powered by Google App Engine
This is Rietveld 408576698