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

Unified Diff: ui/views/window/dialog_client_view.h

Issue 2706423002: Use GridLayout for DialogClientView's button row. (Closed)
Patch Set: Rollback delete extra_view_ experiment 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/window/dialog_client_view.h
diff --git a/ui/views/window/dialog_client_view.h b/ui/views/window/dialog_client_view.h
index 3602812832829fe28371f772bb36f6e6bf6b8800..26484a6840aef4ff5b2fc90abdc1d94bde0ad7be 100644
--- a/ui/views/window/dialog_client_view.h
+++ b/ui/views/window/dialog_client_view.h
@@ -51,6 +51,9 @@ class VIEWS_EXPORT DialogClientView : public ClientView,
// View implementation:
gfx::Size GetPreferredSize() const override;
+ gfx::Size GetMinimumSize() const override;
+ gfx::Size GetMaximumSize() const override;
+
void Layout() override;
bool AcceleratorPressed(const ui::Accelerator& accelerator) override;
void ViewHierarchyChanged(
@@ -67,7 +70,7 @@ class VIEWS_EXPORT DialogClientView : public ClientView,
void set_minimum_size(const gfx::Size& size) { minimum_size_ = size; }
private:
- bool has_dialog_buttons() const { return ok_button_ || cancel_button_; }
+ class ButtonRowContainer;
// Returns the DialogDelegate for the window.
DialogDelegate* GetDialogDelegate() const;
@@ -76,34 +79,23 @@ class VIEWS_EXPORT DialogClientView : public ClientView,
void ChildPreferredSizeChanged(View* child) override;
void ChildVisibilityChanged(View* child) override;
- // Create a dialog button of the appropriate type.
- LabelButton* CreateDialogButton(ui::DialogButton type);
-
- // Update |button|'s text and enabled state according to the delegate's state.
- void UpdateButton(LabelButton* button, ui::DialogButton type);
-
- // Returns the height of the buttons.
- int GetButtonHeight() const;
-
- // Returns the height of the extra view.
- int GetExtraViewHeight() const;
-
- // Returns the height of the row containing the buttons and the extra view.
- int GetButtonsAndExtraViewRowHeight() const;
-
- // Returns the insets for the buttons and extra view, including the vertical
- // padding between them and the contents view.
- gfx::Insets GetButtonRowInsets() const;
-
- // Sets up the focus chain for the child views. This is required since the
- // delegate may choose to add/remove views at any time.
- void SetupFocusChain();
+ // Create and/or update the dialog button of |type| according to the
Peter Kasting 2017/02/28 03:33:24 Creates, updates (descriptive, not imperative; see
tapted 2017/02/28 06:52:43 Done.
+ // DialogDelegate methods that provide the button configuration. Stores it in
+ // the provided data |member| if non-null, otherwise updates it.
Peter Kasting 2017/02/28 03:33:23 This last sentence is still confusing to me. From
tapted 2017/02/28 06:52:43 Done.
+ void UpdateDialogButton(LabelButton** member, ui::DialogButton type);
// Returns the spacing between the extra view and the ok/cancel buttons. 0 if
// no extra view. Otherwise uses GetExtraViewPadding() or the default padding.
int GetExtraViewSpacing() const;
+ // Returns any Views in the button row, in the order they should appear.
+ std::vector<View*> GetButtonRowViews();
+
+ // Installs and configures the LayoutManager for |button_row_container_|.
+ void SetupLayout();
+
// Creates or deletes any buttons that are required. Updates data members.
+ // After calling this, no button row Views will be in the view hierarchy.
void SetupViews();
// How much to inset the button row.
@@ -120,12 +112,18 @@ class VIEWS_EXPORT DialogClientView : public ClientView,
// The extra view shown in the row of buttons; may be NULL.
View* extra_view_ = nullptr;
+ // Container view for the button row.
+ ButtonRowContainer* button_row_container_ = nullptr;
+
// True if we've notified the delegate the window is closing and the delegate
// allowed the close. In some situations it's possible to get two closes (see
// http://crbug.com/71940). This is used to avoid notifying the delegate
// twice, which can have bad consequences.
bool delegate_allowed_close_ = false;
+ // When true, prevents ViewHierarchyChanged() from clearing out data members.
+ bool preserve_button_row_data_members_ = false;
+
DISALLOW_COPY_AND_ASSIGN(DialogClientView);
};

Powered by Google App Engine
This is Rietveld 408576698