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

Unified Diff: chrome/browser/printing/print_preview_dialog_controller.cc

Issue 2172363002: Created min size for print preview dialog and modified to allow the Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: reduced diff Created 4 years, 5 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/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);

Powered by Google App Engine
This is Rietveld 408576698