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..f847e77c6144876cd0d92ed385fe8efe206f1912 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,22 @@ 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) { |
| + *size = kMinDialogSize; |
| + return; |
| + } |
| + *size = browser->window()->GetWebContentsModalDialogHost()-> |
|
Mike Wittman
2013/09/06 22:37:31
Probably should check the value returned from GetW
Rune Fevang
2013/09/06 22:53:07
OK, fixed and added a comment to GetWebContentsMod
|
| + GetMaximumDialogSize(); |
| + 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 |
| } |