summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-29 00:50:34 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-29 00:50:34 +0000
commitdae2b82d7ae27065a2398f7a9f134564d2adf7cd (patch)
tree358798b6e2bdba69d3b96de9e523268acc90666d
parentfce8e2fccb2fdb9ed1f52ab9701e5299cec63677 (diff)
downloadchromium_src-dae2b82d7ae27065a2398f7a9f134564d2adf7cd.zip
chromium_src-dae2b82d7ae27065a2398f7a9f134564d2adf7cd.tar.gz
chromium_src-dae2b82d7ae27065a2398f7a9f134564d2adf7cd.tar.bz2
The "extra view" used by the DialogClientView must not be retrieved before the contents view has been attached to the view hierarchy.
http://crbug.com/2751 Review URL: http://codereview.chromium.org/8681 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4116 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/views/dialog_client_view.cc22
-rw-r--r--chrome/views/dialog_client_view.h3
2 files changed, 17 insertions, 8 deletions
diff --git a/chrome/views/dialog_client_view.cc b/chrome/views/dialog_client_view.cc
index 78cbeca..024331f 100644
--- a/chrome/views/dialog_client_view.cc
+++ b/chrome/views/dialog_client_view.cc
@@ -135,13 +135,6 @@ void DialogClientView::ShowDialogButtons() {
cancel_button_->AddAccelerator(Accelerator(VK_ESCAPE, false, false, false));
AddChildView(cancel_button_);
}
-
- View* extra_view = dd->GetExtraView();
- if (extra_view && !extra_view_) {
- extra_view_ = extra_view;
- extra_view_->SetGroup(kButtonGroup);
- AddChildView(extra_view_);
- }
if (!buttons) {
// Register the escape key as an accelerator which will close the window
// if there are no dialog buttons.
@@ -222,13 +215,17 @@ void DialogClientView::Layout() {
LayoutContentsView();
}
-void DialogClientView::ViewHierarchyChanged(bool is_add, View* parent, View* child) {
+void DialogClientView::ViewHierarchyChanged(bool is_add, View* parent,
+ View* child) {
if (is_add && child == this) {
// Can only add and update the dialog buttons _after_ they are added to the
// view hierarchy since they are native controls and require the
// Container's HWND.
ShowDialogButtons();
ClientView::ViewHierarchyChanged(is_add, parent, child);
+ // The "extra view" must be created and installed after the contents view
+ // has been inserted into the view hierarchy.
+ CreateExtraView();
UpdateDialogButtons();
Layout();
}
@@ -356,6 +353,15 @@ void DialogClientView::LayoutContentsView() {
contents_view()->Layout();
}
+void DialogClientView::CreateExtraView() {
+ View* extra_view = GetDialogDelegate()->GetExtraView();
+ if (extra_view && !extra_view_) {
+ extra_view_ = extra_view;
+ extra_view_->SetGroup(kButtonGroup);
+ AddChildView(extra_view_);
+ }
+}
+
DialogDelegate* DialogClientView::GetDialogDelegate() const {
DialogDelegate* dd = window()->window_delegate()->AsDialogDelegate();
DCHECK(dd);
diff --git a/chrome/views/dialog_client_view.h b/chrome/views/dialog_client_view.h
index b3b4025..f8bcac1 100644
--- a/chrome/views/dialog_client_view.h
+++ b/chrome/views/dialog_client_view.h
@@ -79,6 +79,9 @@ class DialogClientView : public ClientView,
bool has_dialog_buttons() const { return ok_button_ || cancel_button_; }
+ // Create and add the extra view, if supplied by the delegate.
+ void CreateExtraView();
+
// Returns the DialogDelegate for the window.
DialogDelegate* GetDialogDelegate() const;