Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef UI_VIEWS_WINDOW_DIALOG_CLIENT_VIEW_H_ | 5 #ifndef UI_VIEWS_WINDOW_DIALOG_CLIENT_VIEW_H_ |
| 6 #define UI_VIEWS_WINDOW_DIALOG_CLIENT_VIEW_H_ | 6 #define UI_VIEWS_WINDOW_DIALOG_CLIENT_VIEW_H_ |
| 7 | 7 |
| 8 #include "base/gtest_prod_util.h" | 8 #include "base/gtest_prod_util.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "ui/base/ui_base_types.h" | 10 #include "ui/base/ui_base_types.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 57 const ViewHierarchyChangedDetails& details) override; | 57 const ViewHierarchyChangedDetails& details) override; |
| 58 void OnNativeThemeChanged(const ui::NativeTheme* theme) override; | 58 void OnNativeThemeChanged(const ui::NativeTheme* theme) override; |
| 59 | 59 |
| 60 // ButtonListener implementation: | 60 // ButtonListener implementation: |
| 61 void ButtonPressed(Button* sender, const ui::Event& event) override; | 61 void ButtonPressed(Button* sender, const ui::Event& event) override; |
| 62 | 62 |
| 63 void set_button_row_insets(const gfx::Insets& insets) { | 63 void set_button_row_insets(const gfx::Insets& insets) { |
| 64 button_row_insets_ = insets; | 64 button_row_insets_ = insets; |
| 65 } | 65 } |
| 66 | 66 |
| 67 void set_minimum_size(const gfx::Size& size) { minimum_size_ = size; } | |
| 68 | |
| 67 protected: | 69 protected: |
| 68 // For testing. | 70 // For testing. |
| 69 explicit DialogClientView(View* contents_view); | 71 explicit DialogClientView(View* contents_view); |
| 70 | 72 |
| 71 // Returns the DialogDelegate for the window. Virtual for testing. | 73 // Returns the DialogDelegate for the window. Virtual for testing. |
| 72 virtual DialogDelegate* GetDialogDelegate() const; | 74 virtual DialogDelegate* GetDialogDelegate() const; |
| 73 | 75 |
| 74 // Create and add the extra view, if supplied by the delegate. | 76 // Create and add the extra view, if supplied by the delegate. |
| 75 void CreateExtraView(); | 77 void CreateExtraView(); |
| 76 | 78 |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 96 // Returns the height of the row containing the buttons and the extra view. | 98 // Returns the height of the row containing the buttons and the extra view. |
| 97 int GetButtonsAndExtraViewRowHeight() const; | 99 int GetButtonsAndExtraViewRowHeight() const; |
| 98 | 100 |
| 99 // Returns the insets for the buttons and extra view. | 101 // Returns the insets for the buttons and extra view. |
| 100 gfx::Insets GetButtonRowInsets() const; | 102 gfx::Insets GetButtonRowInsets() const; |
| 101 | 103 |
| 102 // Returns the vertical padding to place between the contents view and the | 104 // Returns the vertical padding to place between the contents view and the |
| 103 // buttons/extra view. | 105 // buttons/extra view. |
| 104 int GetButtonsAndExtraViewRowTopPadding() const; | 106 int GetButtonsAndExtraViewRowTopPadding() const; |
| 105 | 107 |
| 106 // How much to inset the button row. | |
| 107 gfx::Insets button_row_insets_; | |
| 108 | |
| 109 // Sets up the focus chain for the child views. This is required since the | 108 // Sets up the focus chain for the child views. This is required since the |
| 110 // delegate may choose to add/remove views at any time. | 109 // delegate may choose to add/remove views at any time. |
| 111 void SetupFocusChain(); | 110 void SetupFocusChain(); |
| 112 | 111 |
| 112 // How much to inset the button row. | |
| 113 gfx::Insets button_row_insets_; | |
| 114 | |
| 115 // The minimum size of this dialog, regardless of the size of its content | |
| 116 // view. If this is equal to gfx::Size(), no minimum size is imposed. | |
|
sky
2017/02/08 17:10:52
optional: I would remove the last sentence as an e
| |
| 117 gfx::Size minimum_size_ = gfx::Size(); | |
|
sky
2017/02/08 17:10:52
Remove the = here. The empty constructor is the sa
| |
| 118 | |
| 113 // The dialog buttons. | 119 // The dialog buttons. |
| 114 LabelButton* ok_button_; | 120 LabelButton* ok_button_ = nullptr; |
| 115 LabelButton* cancel_button_; | 121 LabelButton* cancel_button_ = nullptr; |
| 116 | 122 |
| 117 // The extra view shown in the row of buttons; may be NULL. | 123 // The extra view shown in the row of buttons; may be NULL. |
| 118 View* extra_view_; | 124 View* extra_view_ = nullptr; |
| 119 | 125 |
| 120 // True if we've notified the delegate the window is closing and the delegate | 126 // True if we've notified the delegate the window is closing and the delegate |
| 121 // allowed the close. In some situations it's possible to get two closes (see | 127 // allowed the close. In some situations it's possible to get two closes (see |
| 122 // http://crbug.com/71940). This is used to avoid notifying the delegate | 128 // http://crbug.com/71940). This is used to avoid notifying the delegate |
| 123 // twice, which can have bad consequences. | 129 // twice, which can have bad consequences. |
| 124 bool delegate_allowed_close_; | 130 bool delegate_allowed_close_ = false; |
| 125 | 131 |
| 126 DISALLOW_COPY_AND_ASSIGN(DialogClientView); | 132 DISALLOW_COPY_AND_ASSIGN(DialogClientView); |
| 127 }; | 133 }; |
| 128 | 134 |
| 129 } // namespace views | 135 } // namespace views |
| 130 | 136 |
| 131 #endif // UI_VIEWS_WINDOW_DIALOG_CLIENT_VIEW_H_ | 137 #endif // UI_VIEWS_WINDOW_DIALOG_CLIENT_VIEW_H_ |
| OLD | NEW |