Chromium Code Reviews| Index: chrome/browser/printing/print_preview_dialog_controller.cc |
| diff --git a/chrome/browser/printing/print_preview_dialog_controller.cc b/chrome/browser/printing/print_preview_dialog_controller.cc |
| index 542d2d24345c1c4ffc52463fd10fccf60204dcac..f63e50a66e83de7188631cc3dcaf8efab6a7969e 100644 |
| --- a/chrome/browser/printing/print_preview_dialog_controller.cc |
| +++ b/chrome/browser/printing/print_preview_dialog_controller.cc |
| @@ -27,6 +27,7 @@ |
| #include "chrome/common/chrome_content_client.h" |
| #include "chrome/common/chrome_paths.h" |
| #include "chrome/common/url_constants.h" |
| +#include "components/web_modal/web_contents_modal_dialog_host.h" |
| #include "content/public/browser/navigation_controller.h" |
| #include "content/public/browser/navigation_details.h" |
| #include "content/public/browser/navigation_entry.h" |
| @@ -124,19 +125,20 @@ void PrintPreviewDialogDelegate::GetDialogSize(gfx::Size* size) const { |
| DCHECK(size); |
| const gfx::Size kMinDialogSize(800, 480); |
| const int kBorder = 25; |
| - const int kConstrainedWindowOverlap = 3; |
| - gfx::Rect rect; |
| - initiator_->GetView()->GetContainerBounds(&rect); |
| - size->set_width(std::max(rect.width(), kMinDialogSize.width()) - 2 * kBorder); |
| - size->set_height(std::max(rect.height(), kMinDialogSize.height()) - kBorder + |
| - kConstrainedWindowOverlap); |
| + |
| + Browser* browser = chrome::FindBrowserWithWebContents(initiator_); |
| + if (!browser) |
| + return; |
| + *size = browser->window()->GetWebContentsModalDialogHost()-> |
| + GetMaximumDialogSize(); |
|
Vitaly Buka (NO REVIEWS)
2013/09/06 21:14:29
Shouldn't we put at least kMinDialogSize in case o
Rune Fevang
2013/09/06 22:27:55
That seems reasonable, good idea :)
|
| + size->SetToMax(kMinDialogSize); |
| + size->Enlarge(-2 * kBorder, -kBorder); |
| #if defined(OS_MACOSX) |
| // Limit the maximum size on MacOS X. |
| // http://crbug.com/105815 |
| const gfx::Size kMaxDialogSize(1000, 660); |
| - size->set_width(std::min(size->width(), kMaxDialogSize.width())); |
| - size->set_height(std::min(size->height(), kMaxDialogSize.height())); |
| + size->SetToMin(kMaxDialogSize); |
| #endif |
| } |