Chromium Code Reviews| Index: ui/views/views_delegate.h |
| diff --git a/ui/views/views_delegate.h b/ui/views/views_delegate.h |
| index 7b3960f5c7c0a5be23772d6cc4b7d72f7064d5c2..ad53b28ce6dcf4a2061091f0a2a09004b2c6fa61 100644 |
| --- a/ui/views/views_delegate.h |
| +++ b/ui/views/views_delegate.h |
| @@ -58,6 +58,36 @@ namespace internal { |
| class NativeWidgetDelegate; |
| } |
| +enum class InsetsMetric { |
| + // 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. |
|
Peter Kasting
2017/03/01 06:32:36
What is a "bubble dialog"? Is that what the UX fo
kylix_rd
2017/03/01 17:33:27
Yes, I think the UX folks are using "popover" as a
Peter Kasting
2017/03/01 23:32:23
That's fair.
|
| + BUBBLE_DIALOG, |
| +}; |
| + |
| +enum class SpacingMetric { |
|
Peter Kasting
2017/03/01 06:32:36
Nit: I suggest naming these to closely align with
kylix_rd
2017/03/01 17:33:27
Some of those constant names contain the word "SPA
Peter Kasting
2017/03/01 23:32:23
That's fine, I didn't mean you had to copy names e
|
| + // 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, |
| + // Returns the default minimum width of a dialog button. |
|
Peter Kasting
2017/03/01 06:32:36
Nit: No "Returns" (2 places)
kylix_rd
2017/03/01 17:33:27
Done.
|
| + DIALOG_BUTTON_MINIMUM_WIDTH, |
| + // Returns the default padding to add on each side of a button's label. |
| + BUTTON_HORIZONTAL_PADDING, |
| +}; |
| + |
| // ViewsDelegate is an interface implemented by an object using the views |
| // framework. It is used to obtain various high level application utilities |
| // and perform some actions such as window placement saving. |
| @@ -196,37 +226,15 @@ 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 metric according to the given enumeration element. |
| + virtual gfx::Insets GetInsetsMetric(InsetsMetric metric) const; |
| - // Returns the insets that should be applied around a dialog's frame view. |
| - virtual gfx::Insets GetDialogFrameViewInsets() const; |
| + // Returns the spacing metric according to the given enumeration element. |
| + virtual int GetSpacingMetric(SpacingMetric metric) const; |
| - // Returns the margins that should be applied around a bubble dialog. |
| - virtual gfx::Insets GetBubbleDialogMargins() const; |
| - |
| - // Returns the default minimum width of a button. |
| - virtual int GetButtonMinimumWidth() const; |
| - |
| - // Returns the minimum width of a dialog button. |
| - virtual int GetDialogButtonMinimumWidth() const; |
| - |
| - // Returns the default padding to add on each side of a button's label. |
| - virtual int GetButtonHorizontalPadding() const; |
| + // Returns the default metric in instances where a delegate hasn't been |
| + // instantiated. |
| + static int GetDefaultSpacingMetric(SpacingMetric metric); |
|
sky
2017/02/28 20:11:52
Now that you've made it so ViewsDelegate is always
kylix_rd
2017/03/01 17:33:27
Done.
|
| protected: |
| ViewsDelegate(); |