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

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: Created 8 years, 10 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
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..5e50cd6b2ef2c3ae5ca023e7c65534d7ed6df2ad 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_)
sky 2012/03/01 17:01:57 You sure you don't want to set this to NULL before
yoshiki 2012/03/02 06:51:10 Yes, this delegate_ is necessary to save the windo
+ 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()->SetSizeAndCenterize(out);
+ }
+
DOMView::LoadURL(GetDialogContentURL());
}

Powered by Google App Engine
This is Rietveld 408576698