MacViews: Support ui::MODAL_TYPE_WINDOW with a null parent window.

It sounds weird, but other platforms support this. The window simply
becomes unparented and isn't modal to anything.

Currently NativeWidgetMac will DCHECK in void NativeWidgetMac::
InitModalType() and crash in BridgedNativeWidget::ShowAsModalSheet()
when trying to attach the window to the parent as a dialog sheet.

It's straightforward to ignore the modal type on Mac when no parent is
given.

A use case for this is when extensions need to surface a dialog (e.g.
when permissions require upgrading). Usually there is a parent browser
window, but sometimes there is not. For example, background pages or app
shortcuts launched from the Windows desktop.

Add a test case for constrained_window::CreateBrowserModalDialogViews()
which is responsible for allowing this. There's an existing test --
ExtensionInstallPromptBrowserTest.NoParent -- but it doesn't have
coverage for actually showing the Widget - only the plumbing that leads
up to that step.

BUG=647574

Review-Url: https://chromiumcodereview.appspot.com/2415053002
Cr-Commit-Position: refs/heads/master@{#426302}
3 files changed