Give Cocoa browser windows a WebContentsModalDialogHost
Currently the presence of Infobars and devtools will affect the size of
a print preview dialog. Instead, the dialog should be sized based only
on the size of the window (and presence of toolbars). That is, in the
"regular" bounds (between 800x480 and 1000x660), the print preview
dialog should have an even border on the bottom and left/right sides
w.r.t. the window edge, and follow when the window is resized.
print_preview_dialog_controller.cc uses WebContentsModalDialogHost::
GetMaximumDialogSize() to determine the right size, but Cocoa browsers
currently do not have a WCMDH. This means the dialog sizes based only on
the WebContents, which is wrong.
This CL provides a simple WebContentsModalDialogHost to bridge to the
ConstrainedWindowSheetController. The logic currently in
SingleWebContentsDialogManagerCocoa to find the parent view is relocated
to the WebContentsModalDialogHost.
A WCMDH is also needed to provide web-modal toolkit-views dialogs on a
Cocoa browser, but it actually doesn't need to be any more complicated
than this.
Code coverage on Mac+Cocoa is given by PrintPreviewTest.PrintCommands
which relies on a WebContentsModalDialogHost to properly size the
dialog.
BUG=492990, 492967, 485854
TEST=Open (bottom-docked) DevTools, Hotdog->Print. The Print preview
dialog should extend over the devtools, and when resizing the browser
between 480 and 660 pixels in height, the dialog size should follow the
window border, and not get squished up above DevTools.
Review URL: https://codereview.chromium.org/
1160443005
Cr-Commit-Position: refs/heads/master@{#331885}