| Index: chrome/browser/ui/views/html_dialog_view.cc
|
| diff --git a/chrome/browser/ui/views/html_dialog_view.cc b/chrome/browser/ui/views/html_dialog_view.cc
|
| index 329e7c6b68f31ab68428279c2fab80189a0c9fa3..9bb341c8b7b7161d0107ce23fb7513c34fb68ca8 100644
|
| --- a/chrome/browser/ui/views/html_dialog_view.cc
|
| +++ b/chrome/browser/ui/views/html_dialog_view.cc
|
| @@ -72,7 +72,7 @@ HtmlDialogView::~HtmlDialogView() {
|
| gfx::Size HtmlDialogView::GetPreferredSize() {
|
| gfx::Size out;
|
| if (delegate_)
|
| - delegate_->GetDialogSize(&out);
|
| + delegate_->GetMinimumDialogSize(&out);
|
| return out;
|
| }
|
|
|
| @@ -109,6 +109,12 @@ string16 HtmlDialogView::GetWindowTitle() const {
|
| return string16();
|
| }
|
|
|
| +std::string HtmlDialogView::GetWindowName() const {
|
| + if (delegate_)
|
| + return delegate_->GetDialogName();
|
| + return std::string();
|
| +}
|
| +
|
| void HtmlDialogView::WindowClosing() {
|
| // If we still have a delegate that means we haven't notified it of the
|
| // dialog closing. This happens if the user clicks the Close button on the
|
| @@ -167,6 +173,11 @@ void HtmlDialogView::GetDialogSize(gfx::Size* size) const {
|
| delegate_->GetDialogSize(size);
|
| }
|
|
|
| +void HtmlDialogView::GetMinimumDialogSize(gfx::Size* size) const {
|
| + if (delegate_)
|
| + delegate_->GetMinimumDialogSize(size);
|
| +}
|
| +
|
| std::string HtmlDialogView::GetDialogArgs() const {
|
| if (delegate_)
|
| return delegate_->GetDialogArgs();
|
| @@ -176,15 +187,17 @@ std::string HtmlDialogView::GetDialogArgs() const {
|
| void HtmlDialogView::OnDialogClosed(const std::string& json_retval) {
|
| HtmlDialogTabContentsDelegate::Detach();
|
| if (delegate_) {
|
| - HtmlDialogUIDelegate* dialog_delegate = delegate_;
|
| - delegate_ = NULL; // We will not communicate further with the delegate.
|
| -
|
| // Store the dialog content area size.
|
| - dialog_delegate->StoreDialogSize(GetContentsBounds().size());
|
| + delegate_->StoreDialogSize(GetContentsBounds().size());
|
| + }
|
| +
|
| + if (GetWidget())
|
| + GetWidget()->Close();
|
|
|
| - dialog_delegate->OnDialogClosed(json_retval);
|
| + if (delegate_) {
|
| + delegate_->OnDialogClosed(json_retval);
|
| + delegate_ = NULL; // We will not communicate further with the delegate.
|
| }
|
| - GetWidget()->Close();
|
| }
|
|
|
| void HtmlDialogView::OnCloseContents(WebContents* source,
|
| @@ -284,6 +297,13 @@ void HtmlDialogView::InitDialog() {
|
| web_contents->GetPropertyBag(), this);
|
| tab_watcher_.reset(new TabRenderWatcher(web_contents, this));
|
|
|
| + if (delegate_) {
|
| + gfx::Size out;
|
| + delegate_->GetDialogSize(&out);
|
| + if (!out.IsEmpty() && GetWidget())
|
| + GetWidget()->CenterWindow(out);
|
| + }
|
| +
|
| DOMView::LoadURL(GetDialogContentURL());
|
| }
|
|
|
|
|