| Index: chrome/browser/ui/views/constrained_web_dialog_delegate_views.cc
|
| diff --git a/chrome/browser/ui/views/constrained_web_dialog_delegate_views.cc b/chrome/browser/ui/views/constrained_web_dialog_delegate_views.cc
|
| index 1f6302730572dbd5ca30c14391fd545ce5d555f0..abe40827016b1d34073b9cd462e50c4b277e506f 100644
|
| --- a/chrome/browser/ui/views/constrained_web_dialog_delegate_views.cc
|
| +++ b/chrome/browser/ui/views/constrained_web_dialog_delegate_views.cc
|
| @@ -29,13 +29,13 @@ namespace {
|
| // potential use after destruction.
|
| class InitiatorWebContentsObserver
|
| : public content::WebContentsObserver {
|
| - public:
|
| - explicit InitiatorWebContentsObserver(content::WebContents* web_contents)
|
| + public:
|
| + explicit InitiatorWebContentsObserver(content::WebContents* web_contents)
|
| : content::WebContentsObserver(web_contents) {
|
| - }
|
| + }
|
|
|
| - private:
|
| - DISALLOW_COPY_AND_ASSIGN(InitiatorWebContentsObserver);
|
| + private:
|
| + DISALLOW_COPY_AND_ASSIGN(InitiatorWebContentsObserver);
|
| };
|
|
|
| class WebDialogWebContentsDelegateViews
|
| @@ -144,14 +144,17 @@ class ConstrainedWebDialogDelegateViewViews
|
| ui::WebDialogDelegate* delegate,
|
| content::WebContents* web_contents,
|
| const gfx::Size& min_size,
|
| - const gfx::Size& max_size)
|
| + const gfx::Size& max_size,
|
| + bool is_nonclipped)
|
| : views::WebView(browser_context),
|
| initiator_observer_(web_contents),
|
| - impl_(new ConstrainedWebDialogDelegateViews(browser_context, delegate,
|
| + impl_(new ConstrainedWebDialogDelegateViews(browser_context,
|
| + delegate,
|
| &initiator_observer_,
|
| this)),
|
| min_size_(min_size),
|
| - max_size_(max_size) {
|
| + max_size_(max_size),
|
| + is_nonclipped_(is_nonclipped) {
|
| SetWebContents(GetWebContents());
|
| AddAccelerator(ui::Accelerator(ui::VKEY_ESCAPE, ui::EF_NONE));
|
| if (!max_size_.IsEmpty())
|
| @@ -238,11 +241,17 @@ class ConstrainedWebDialogDelegateViewViews
|
| }
|
| void DocumentOnLoadCompletedInMainFrame() override {
|
| if (!max_size_.IsEmpty() && initiator_observer_.web_contents()) {
|
| - constrained_window::ShowModalDialog(GetWidget()->GetNativeWindow(),
|
| - initiator_observer_.web_contents());
|
| + if (is_nonclipped_) {
|
| + constrained_window::ShowNonClippedModalDialog(
|
| + GetWidget()->GetNativeWindow(),
|
| + initiator_observer_.web_contents());
|
| + } else {
|
| + constrained_window::ShowModalDialog(
|
| + GetWidget()->GetNativeWindow(),
|
| + initiator_observer_.web_contents());
|
| + }
|
| }
|
| }
|
| -
|
| private:
|
| void EnableAutoResize() {
|
| content::RenderViewHost* render_view_host =
|
| @@ -258,6 +267,10 @@ class ConstrainedWebDialogDelegateViewViews
|
| const gfx::Size min_size_;
|
| const gfx::Size max_size_;
|
|
|
| + // If true, dialog has bounds that are not constrained by the parent window's
|
| + // bounds, so it can extend outside of the parent window when resized.
|
| + bool is_nonclipped_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(ConstrainedWebDialogDelegateViewViews);
|
| };
|
|
|
| @@ -270,11 +283,23 @@ ConstrainedWebDialogDelegate* ShowConstrainedWebDialog(
|
| ConstrainedWebDialogDelegateViewViews* dialog =
|
| new ConstrainedWebDialogDelegateViewViews(
|
| browser_context, delegate, web_contents,
|
| - gfx::Size(), gfx::Size());
|
| + gfx::Size(), gfx::Size(), false);
|
| constrained_window::ShowWebModalDialogViews(dialog, web_contents);
|
| return dialog;
|
| }
|
|
|
| +ConstrainedWebDialogDelegate* ShowNonClippedConstrainedWebDialog(
|
| + content::BrowserContext* browser_context,
|
| + ui::WebDialogDelegate* delegate,
|
| + content::WebContents* web_contents) {
|
| + ConstrainedWebDialogDelegateViewViews* dialog =
|
| + new ConstrainedWebDialogDelegateViewViews(browser_context, delegate,
|
| + web_contents, gfx::Size(),
|
| + gfx::Size(), true);
|
| + constrained_window::ShowNonClippedWebModalDialogViews(dialog, web_contents);
|
| + return dialog;
|
| +}
|
| +
|
| ConstrainedWebDialogDelegate* ShowConstrainedWebDialogWithAutoResize(
|
| content::BrowserContext* browser_context,
|
| ui::WebDialogDelegate* delegate,
|
| @@ -286,7 +311,7 @@ ConstrainedWebDialogDelegate* ShowConstrainedWebDialogWithAutoResize(
|
| ConstrainedWebDialogDelegateViewViews* dialog =
|
| new ConstrainedWebDialogDelegateViewViews(
|
| browser_context, delegate, web_contents,
|
| - min_size, max_size);
|
| + min_size, max_size, false);
|
| constrained_window::CreateWebModalDialogViews(dialog, web_contents);
|
| return dialog;
|
| }
|
|
|