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

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: Modify tracking of nonclipped state for new code structure. 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..0d8f86aef97850e9c8a433dd2e0bdb0c7bedf128 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 size of 438x455 without
+ // 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(kMinDialogSize.width() - size->width(), -2 * kBorder);
+ int shrink_height =
+ std::max(kMinDialogSize.height() - size->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