| 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 c67deee96289bda434179fd1d00d8abbbcbda866..bb3a1bcc529c4f81aee40e4ad4c6e372966210d0 100644
|
| --- a/chrome/browser/ui/views/html_dialog_view.cc
|
| +++ b/chrome/browser/ui/views/html_dialog_view.cc
|
| @@ -78,7 +78,7 @@ HtmlDialogView::~HtmlDialogView() {
|
| gfx::Size HtmlDialogView::GetPreferredSize() {
|
| gfx::Size out;
|
| if (delegate_)
|
| - delegate_->GetDialogSize(&out);
|
| + delegate_->GetMinimumDialogSize(&out);
|
| return out;
|
| }
|
|
|
| @@ -120,6 +120,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
|
| @@ -178,6 +184,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();
|
| @@ -188,7 +199,6 @@ 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());
|
| @@ -196,6 +206,9 @@ void HtmlDialogView::OnDialogClosed(const std::string& json_retval) {
|
| dialog_delegate->OnDialogClosed(json_retval);
|
| }
|
| GetWidget()->Close();
|
| +
|
| + if (delegate_)
|
| + delegate_ = NULL; // We will not communicate further with the delegate.
|
| }
|
|
|
| void HtmlDialogView::OnCloseContents(WebContents* source,
|
| @@ -302,6 +315,13 @@ void HtmlDialogView::InitDialog() {
|
| web_contents->GetPropertyBag(), this);
|
| tab_watcher_.reset(new TabFirstRenderWatcher(web_contents, this));
|
|
|
| + if (delegate_) {
|
| + gfx::Size out;
|
| + delegate_->GetDialogSize(&out);
|
| + if (!out.IsEmpty())
|
| + GetWidget()->CenterWindow(out);
|
| + }
|
| +
|
| DOMView::LoadURL(GetDialogContentURL());
|
| }
|
|
|
|
|