| 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 // View implementation. | 77 // View implementation. |
| 78 void ChildPreferredSizeChanged(View* child) override; | 78 void ChildPreferredSizeChanged(View* child) override; |
| 79 void ChildVisibilityChanged(View* child) override; | 79 void ChildVisibilityChanged(View* child) override; |
| 80 | 80 |
| 81 private: | 81 private: |
| 82 bool has_dialog_buttons() const { return ok_button_ || cancel_button_; } | 82 bool has_dialog_buttons() const { return ok_button_ || cancel_button_; } |
| 83 | 83 |
| 84 // Create a dialog button of the appropriate type. | 84 // Create a dialog button of the appropriate type. |
| 85 LabelButton* CreateDialogButton(ui::DialogButton type); | 85 LabelButton* CreateDialogButton(ui::DialogButton type); |
| 86 | 86 |
| 87 // Adds |ok_button| as a child of this view at the appropriate index, to |
| 88 // ensure correct focus order. |
| 89 void AddOKButton(LabelButton* ok_button); |
| 90 |
| 91 // Adds |cancel_button| as a child of this view at the appropriate index, to |
| 92 // ensure correct focus order. |
| 93 void AddCancelButton(LabelButton* cancel_button); |
| 94 |
| 87 // Update |button|'s text and enabled state according to the delegate's state. | 95 // Update |button|'s text and enabled state according to the delegate's state. |
| 88 void UpdateButton(LabelButton* button, ui::DialogButton type); | 96 void UpdateButton(LabelButton* button, ui::DialogButton type); |
| 89 | 97 |
| 90 // 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. |
| 91 int GetButtonsAndExtraViewRowHeight() const; | 99 int GetButtonsAndExtraViewRowHeight() const; |
| 92 | 100 |
| 93 // Returns the insets for the buttons and extra view. | 101 // Returns the insets for the buttons and extra view. |
| 94 gfx::Insets GetButtonRowInsets() const; | 102 gfx::Insets GetButtonRowInsets() const; |
| 95 | 103 |
| 96 // How much to inset the button row. | 104 // How much to inset the button row. |
| 97 gfx::Insets button_row_insets_; | 105 gfx::Insets button_row_insets_; |
| 98 | 106 |
| 99 // Sets up the focus chain for the child views. This is required since the | |
| 100 // delegate may choose to add/remove views at any time. | |
| 101 void SetupFocusChain(); | |
| 102 | |
| 103 // The dialog buttons. | 107 // The dialog buttons. |
| 104 LabelButton* ok_button_; | 108 LabelButton* ok_button_; |
| 105 LabelButton* cancel_button_; | 109 LabelButton* cancel_button_; |
| 106 | 110 |
| 107 // The extra view shown in the row of buttons; may be NULL. | 111 // The extra view shown in the row of buttons; may be NULL. |
| 108 View* extra_view_; | 112 View* extra_view_; |
| 109 | 113 |
| 110 // True if we've notified the delegate the window is closing and the delegate | 114 // True if we've notified the delegate the window is closing and the delegate |
| 111 // allowed the close. In some situations it's possible to get two closes (see | 115 // allowed the close. In some situations it's possible to get two closes (see |
| 112 // http://crbug.com/71940). This is used to avoid notifying the delegate | 116 // http://crbug.com/71940). This is used to avoid notifying the delegate |
| 113 // twice, which can have bad consequences. | 117 // twice, which can have bad consequences. |
| 114 bool delegate_allowed_close_; | 118 bool delegate_allowed_close_; |
| 115 | 119 |
| 116 DISALLOW_COPY_AND_ASSIGN(DialogClientView); | 120 DISALLOW_COPY_AND_ASSIGN(DialogClientView); |
| 117 }; | 121 }; |
| 118 | 122 |
| 119 } // namespace views | 123 } // namespace views |
| 120 | 124 |
| 121 #endif // UI_VIEWS_WINDOW_DIALOG_CLIENT_VIEW_H_ | 125 #endif // UI_VIEWS_WINDOW_DIALOG_CLIENT_VIEW_H_ |
| OLD | NEW |