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 35635e61855c9432880f8c7a5f695ef1024f7361..241a318a5bb7a5d246ea91eaba4ba14377bb7d59 100644 |
| --- a/chrome/browser/printing/print_preview_dialog_controller.cc |
| +++ b/chrome/browser/printing/print_preview_dialog_controller.cc |
| @@ -78,9 +78,7 @@ PrintPreviewDialogDelegate::~PrintPreviewDialogDelegate() { |
| } |
| ui::ModalType PrintPreviewDialogDelegate::GetDialogModalType() const { |
| - // Not used, returning dummy value. |
| - NOTREACHED(); |
| - return ui::MODAL_TYPE_WINDOW; |
| + return ui::MODAL_TYPE_CHILD; |
| } |
| base::string16 PrintPreviewDialogDelegate::GetDialogTitle() const { |
| @@ -99,7 +97,8 @@ void PrintPreviewDialogDelegate::GetWebUIMessageHandlers( |
| void PrintPreviewDialogDelegate::GetDialogSize(gfx::Size* size) const { |
| DCHECK(size); |
| - const gfx::Size kMinDialogSize(800, 480); |
| + // Modified to match requested size. Previously: 800, 480. |
| + const gfx::Size kMinDialogSize(438, 455); |
| const int kBorder = 25; |
| *size = kMinDialogSize; |
| @@ -114,7 +113,15 @@ void PrintPreviewDialogDelegate::GetDialogSize(gfx::Size* size) const { |
| size->SetToMax(host->GetMaximumDialogSize()); |
| else |
| size->SetToMax(outermost_web_contents->GetContainerBounds().size()); |
| - size->Enlarge(-2 * kBorder, -kBorder); |
| + int expandWidth = 2*kBorder; |
|
Lei Zhang
2016/07/25 21:35:10
Take a look at the Google C++ style guide. non-con
rbpotter
2016/07/26 21:48:19
Done.
|
| + int expandHeight = kBorder; |
| + if (size->width() - kMinDialogSize.width() < 2*kBorder) { |
|
Lei Zhang
2016/07/25 21:35:10
This can be combined into:
int expand_width = std
rbpotter
2016/07/26 21:48:19
Done.
|
| + expandWidth = size->width() - kMinDialogSize.width(); |
| + } |
| + if (size->height() - kMinDialogSize.height() < kBorder) { |
| + expandHeight = size->height() - kMinDialogSize.height(); |
| + } |
| + size->Enlarge(-1*expandWidth, -1*expandHeight); |
|
Lei Zhang
2016/07/25 21:35:10
I think you can just write -var instead of -1 * va
rbpotter
2016/07/26 21:48:19
Done.
|
| #if defined(OS_MACOSX) |
| // Limit the maximum size on MacOS X. |
| @@ -357,7 +364,7 @@ WebContents* PrintPreviewDialogController::CreatePrintPreviewDialog( |
| // The dialog delegates are deleted when the dialog is closed. |
| ConstrainedWebDialogDelegate* web_dialog_delegate = |
| - ShowConstrainedWebDialog(initiator->GetBrowserContext(), |
| + ShowTopLevelConstrainedWebDialog(initiator->GetBrowserContext(), |
| new PrintPreviewDialogDelegate(initiator), |
|
Mike Wittman
2016/07/26 17:27:35
nit: update indendation
|
| initiator); |