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

Unified Diff: ui/views/views_delegate.h

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.h
diff --git a/ui/views/views_delegate.h b/ui/views/views_delegate.h
index c34751993693d773ab4b804bb61c93e5bca5f444..c6aa63d5a2d1b5d4d1099c7026c9708f437d04b1 100644
--- a/ui/views/views_delegate.h
+++ b/ui/views/views_delegate.h
@@ -88,6 +88,32 @@ class VIEWS_EXPORT ViewsDelegate {
CLOSE_MENU
};
+ enum class InsetsMetric {
sky 2017/02/17 20:50:46 optional: move this and SpacingMetric outside of V
kylix_rd 2017/02/17 21:40:51 I added them based on the precedent set by Process
sky 2017/02/17 22:39:03 For enums that are used extensively, like I think
+ // The insets that should be applied around a DialogClientView. Note that
+ // the top inset is used for the distance between the buttons and the
+ // DialogClientView's content view.
+ DIALOG_BUTTON,
+ // The insets that should be applied around a dialog's frame view.
+ DIALOG_FRAME_VIEW,
+ // The margins that should be applied around a bubble dialog.
+ BUBBLE_DIALOG,
+ };
+
+ enum class SpacingMetric {
+ // The distance between a dialog's edge and the close button in the upper
+ // trailing corner.
+ CLOSE_BUTTON_MARGIN,
+ // The spacing between a pair of related horizontal buttons, used for
+ // dialog layout.
+ RELATED_HORIZONTAL_BUTTON,
+ // The spacing between a pair of related vertical controls, used for
+ // dialog layout.
+ RELATED_VERTICAL_CONTROL,
+ // The spacing between the image on a label button and its associated
+ // text.
+ ICON_TO_TEXT,
+ };
+
virtual ~ViewsDelegate();
// Returns the ViewsDelegate instance if there is one, or nullptr otherwise.
@@ -196,28 +222,11 @@ class VIEWS_EXPORT ViewsDelegate {
// Returns a blocking pool task runner given a TaskRunnerType.
virtual scoped_refptr<base::TaskRunner> GetBlockingPoolTaskRunner();
- // Returns the insets that should be applied around a DialogClientView. Note
- // that the top inset is used for the distance between the buttons and the
- // DialogClientView's content view.
- virtual gfx::Insets GetDialogButtonInsets() const;
-
- // Returns the distance between a dialog's edge and the close button in the
- // upper trailing corner.
- virtual int GetDialogCloseButtonMargin() const;
-
- // Returns the spacing between a pair of related horizontal buttons, used for
- // dialog layout.
- virtual int GetDialogRelatedButtonHorizontalSpacing() const;
-
- // Returns the spacing between a pair of related vertical controls, used for
- // dialog layout.
- virtual int GetDialogRelatedControlVerticalSpacing() const;
-
- // Returns the insets that should be applied around a dialog's frame view.
- virtual gfx::Insets GetDialogFrameViewInsets() const;
+ // Returns the insets metric according to the given enumeration element.
+ virtual gfx::Insets GetInsetsMetric(InsetsMetric metric) const;
- // Returns the margins that should be applied around a bubble dialog.
- virtual gfx::Insets GetBubbleDialogMargins() const;
+ // Returns the spacing metric according to the given enumeration element.
+ virtual int GetSpacingMetric(SpacingMetric metric) const;
protected:
ViewsDelegate();

Powered by Google App Engine
This is Rietveld 408576698