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

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: Fix Mac compile error. Created 4 years, 4 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 7e0a8968c2607badf6289d644d9c25dc0135dfe1..e311f1a992983cc65c5597899ce2f7d2b9aef748 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,8 +97,15 @@ void PrintPreviewDialogDelegate::GetWebUIMessageHandlers(
void PrintPreviewDialogDelegate::GetDialogSize(gfx::Size* size) const {
DCHECK(size);
- const gfx::Size kMinDialogSize(800, 480);
const int kBorder = 25;
+ // Gives ChromeOS dialogs the requested minimum sizei of 438x455 without
Lei Zhang 2016/08/19 03:28:46 s/sizei/size/
rbpotter 2016/08/19 16:59:42 Done.
+ // changing the existing behavior on Mac OSX. For all other platforms, the min
+ // size is later overridden by the size of the parent window.
+#if defined(OS_MACOSX)
+ const gfx::Size kMinDialogSize(800, 480);
+#else
+ const gfx::Size kMinDialogSize(438, 455);
+#endif
*size = kMinDialogSize;
web_modal::WebContentsModalDialogHost* host = nullptr;
@@ -114,7 +119,15 @@ void PrintPreviewDialogDelegate::GetDialogSize(gfx::Size* size) const {
size->SetToMax(host->GetMaximumDialogSize());
else
size->SetToMax(outermost_web_contents->GetContainerBounds().size());
+#if defined(OS_MACOSX)
size->Enlarge(-2 * kBorder, -kBorder);
+#else
+ int shrink_width =
+ std::max(-size->width() + kMinDialogSize.width(), -2 * kBorder);
Lei Zhang 2016/08/19 03:28:46 If you stick with |shrink_width|, do kMinDialogSiz
rbpotter 2016/08/19 16:59:42 Done.
+ int shrink_height =
+ std::max(-size->height() + kMinDialogSize.height(), -kBorder);
+ size->Enlarge(shrink_width, shrink_height);
+#endif
#if defined(OS_MACOSX)
// Limit the maximum size on MacOS X.
@@ -369,9 +382,9 @@ WebContents* PrintPreviewDialogController::CreatePrintPreviewDialog(
// The dialog delegates are deleted when the dialog is closed.
ConstrainedWebDialogDelegate* web_dialog_delegate =
- ShowConstrainedWebDialog(initiator->GetBrowserContext(),
- new PrintPreviewDialogDelegate(initiator),
- initiator);
+ ShowNonClippedConstrainedWebDialog(
+ initiator->GetBrowserContext(),
+ new PrintPreviewDialogDelegate(initiator), initiator);
WebContents* preview_dialog = web_dialog_delegate->GetWebContents();

Powered by Google App Engine
This is Rietveld 408576698