summaryrefslogtreecommitdiffstats
path: root/ui/views/window
diff options
context:
space:
mode:
authormsw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-06 02:54:56 +0000
committermsw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-06 02:54:56 +0000
commit20960d488457c4aafd3f707a097258791d678ec4 (patch)
tree263a3c637382f6dcf58b2ae26f06df1110eeb580 /ui/views/window
parent3666ddfc52d87c1b464c63f0005bbb54b3133af5 (diff)
downloadchromium_src-20960d488457c4aafd3f707a097258791d678ec4.zip
chromium_src-20960d488457c4aafd3f707a097258791d678ec4.tar.gz
chromium_src-20960d488457c4aafd3f707a097258791d678ec4.tar.bz2
Reland Fix Views web-modal dialog widget creation.
The original CL was reverted in r275139 for XP test failures: http://build.chromium.org/p/chromium.win/builders/XP%20Tests%20%281%29/builds/31455 (MediaGalleriesPlatformAppBrowserTest.Scan timeouts) I've addressed this here by reverting a test helper: MediaGalleriesScanResultDialogViews::AcceptDialogForTesting r272016 regressed web-modal dialog shadow styling. Use CreateDialogWidget for dialog creation to fix that. Only set SHADOW_TYPE_NONE for new-style dialogs there. (removes the double border, consolidates dialog widget init) Take WidgetDelegate for ConstrainedWebDialogDelegateViewViews. Mark web-modals as ui::MODAL_TYPE_CHILD and child widgets. Remove now unused Widget::CreateWindowAsFramelessChild. (keep a copy for the system-modal captive portal dialog) (that dialog is very odd, system-modal and "web-modal"?) Add [Create|Show]WebModalDialogViews helper functions. Use these for c/b/ui/views web-modal dialog init/show. (cannot be used by c/b/chromeos, so cleanup less there) Cleanup includes, cached widgets, using statements, etc. BUG=376646, 378970 TEST=Views tab-modal dialogs appear as expected. TBR=wittman@chromium.org,sky@chromium.org Review URL: https://codereview.chromium.org/319013002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@275303 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/views/window')
-rw-r--r--ui/views/window/dialog_delegate.cc12
-rw-r--r--ui/views/window/dialog_delegate.h4
2 files changed, 10 insertions, 6 deletions
diff --git a/ui/views/window/dialog_delegate.cc b/ui/views/window/dialog_delegate.cc
index aabfa6d..6c69b35 100644
--- a/ui/views/window/dialog_delegate.cc
+++ b/ui/views/window/dialog_delegate.cc
@@ -23,20 +23,24 @@ DialogDelegate::~DialogDelegate() {
}
// static
-Widget* DialogDelegate::CreateDialogWidget(DialogDelegate* dialog,
+Widget* DialogDelegate::CreateDialogWidget(WidgetDelegate* delegate,
gfx::NativeView context,
gfx::NativeView parent) {
views::Widget* widget = new views::Widget;
views::Widget::InitParams params;
- params.delegate = dialog;
+ params.delegate = delegate;
+ DialogDelegate* dialog = delegate->AsDialogDelegate();
if (!dialog || dialog->UseNewStyleForThisDialog()) {
params.opacity = Widget::InitParams::TRANSLUCENT_WINDOW;
params.remove_standard_frame = true;
+ // The bubble frame includes its own shadow; remove any native shadowing.
+ params.shadow_type = views::Widget::InitParams::SHADOW_TYPE_NONE;
}
params.context = context;
params.parent = parent;
- // TODO(msw): Add a matching shadow type and remove the bubble frame border?
- params.shadow_type = views::Widget::InitParams::SHADOW_TYPE_NONE;
+ // Web-modal (ui::MODAL_TYPE_CHILD) dialogs with parents are marked as child
+ // widgets to prevent top-level window behavior (independent movement, etc).
+ params.child = parent && (delegate->GetModalType() == ui::MODAL_TYPE_CHILD);
widget->Init(params);
return widget;
}
diff --git a/ui/views/window/dialog_delegate.h b/ui/views/window/dialog_delegate.h
index 2ef7983..692b787 100644
--- a/ui/views/window/dialog_delegate.h
+++ b/ui/views/window/dialog_delegate.h
@@ -31,8 +31,8 @@ class VIEWS_EXPORT DialogDelegate : public ui::DialogModel,
public:
virtual ~DialogDelegate();
- // Create a |dialog| window Widget with the specified |context| or |parent|.
- static Widget* CreateDialogWidget(DialogDelegate* dialog,
+ // Create a dialog widget with the specified |context| or |parent|.
+ static Widget* CreateDialogWidget(WidgetDelegate* delegate,
gfx::NativeView context,
gfx::NativeView parent);