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

Side by Side Diff: ui/views/window/dialog_client_view.h

Issue 2825243002: DialogClientView: Handle nested close requests gracefully.
Patch Set: Self review Created 3 years, 8 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 unified diff | Download patch
OLDNEW
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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 // a View should not appear, it will be null. 97 // a View should not appear, it will be null.
98 std::array<View*, kNumButtons> GetButtonRowViews(); 98 std::array<View*, kNumButtons> GetButtonRowViews();
99 99
100 // Installs and configures the LayoutManager for |button_row_container_|. 100 // Installs and configures the LayoutManager for |button_row_container_|.
101 void SetupLayout(); 101 void SetupLayout();
102 102
103 // Creates or deletes any buttons that are required. Updates data members. 103 // Creates or deletes any buttons that are required. Updates data members.
104 // After calling this, no button row Views will be in the view hierarchy. 104 // After calling this, no button row Views will be in the view hierarchy.
105 void SetupViews(); 105 void SetupViews();
106 106
107 // Updates |delegate_allowed_close_| using the provided |method|. If |close|
108 // is true, invokes Widget::Close() the first time the delegate allows it.
109 void CloseWithDelegateMethod(bool (DialogDelegate::*method)(), bool close);
110
107 // How much to inset the button row. 111 // How much to inset the button row.
108 gfx::Insets button_row_insets_; 112 gfx::Insets button_row_insets_;
109 113
110 // The minimum size of this dialog, regardless of the size of its content 114 // The minimum size of this dialog, regardless of the size of its content
111 // view. 115 // view.
112 gfx::Size minimum_size_; 116 gfx::Size minimum_size_;
113 117
114 // The dialog buttons. 118 // The dialog buttons.
115 LabelButton* ok_button_ = nullptr; 119 LabelButton* ok_button_ = nullptr;
116 LabelButton* cancel_button_ = nullptr; 120 LabelButton* cancel_button_ = nullptr;
117 121
118 // The extra view shown in the row of buttons; may be NULL. 122 // The extra view shown in the row of buttons; may be NULL.
119 View* extra_view_ = nullptr; 123 View* extra_view_ = nullptr;
120 124
121 // Container view for the button row. 125 // Container view for the button row.
122 ButtonRowContainer* button_row_container_ = nullptr; 126 ButtonRowContainer* button_row_container_ = nullptr;
123 127
124 // True if we've notified the delegate the window is closing and the delegate 128 // True if we've notified the delegate the window is closing and the delegate
125 // allowed the close. In some situations it's possible to get two closes (see 129 // allowed the close. In some situations it's possible to get two closes (see
126 // http://crbug.com/71940). This is used to avoid notifying the delegate 130 // http://crbug.com/71940). This is used to avoid notifying the delegate
127 // twice, which can have bad consequences. 131 // twice, which can have bad consequences.
128 bool delegate_allowed_close_ = false; 132 bool delegate_allowed_close_ = false;
129 133
134 // True while asking the delegate whether a close should occur. The delegate
135 // may perform actions that trigger a nested close query. DialogClientView
136 // ignores these nested requests, and only acts on the first on the stack.
137 bool asking_delegate_whether_to_close_ = false;
138
130 // Used to prevent unnecessary or potentially harmful changes during 139 // Used to prevent unnecessary or potentially harmful changes during
131 // SetupLayout(). Everything will be manually updated afterwards. 140 // SetupLayout(). Everything will be manually updated afterwards.
132 bool adding_or_removing_views_ = false; 141 bool adding_or_removing_views_ = false;
133 142
134 DISALLOW_COPY_AND_ASSIGN(DialogClientView); 143 DISALLOW_COPY_AND_ASSIGN(DialogClientView);
135 }; 144 };
136 145
137 } // namespace views 146 } // namespace views
138 147
139 #endif // UI_VIEWS_WINDOW_DIALOG_CLIENT_VIEW_H_ 148 #endif // UI_VIEWS_WINDOW_DIALOG_CLIENT_VIEW_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/extensions/extension_message_bubble_view_browsertest.cc ('k') | ui/views/window/dialog_client_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698