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

Unified Diff: chrome/browser/ui/views/html_dialog_view.cc

Issue 9569001: WebUI TaskManager: Add method to set minimum window size on HTMLDialog. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: prevent from failing the tests Created 8 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/html_dialog_view.h ('k') | chrome/browser/ui/webui/html_dialog_ui.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
}
« no previous file with comments | « chrome/browser/ui/views/html_dialog_view.h ('k') | chrome/browser/ui/webui/html_dialog_ui.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698