Chromium Code Reviews| Index: components/constrained_window/constrained_window_views.cc |
| diff --git a/components/constrained_window/constrained_window_views.cc b/components/constrained_window/constrained_window_views.cc |
| index 62c274d33fdcbd521e626fa88e56641163238376..4ce37547a77ac404059a808c281ffff253da6434 100644 |
| --- a/components/constrained_window/constrained_window_views.cc |
| +++ b/components/constrained_window/constrained_window_views.cc |
| @@ -101,6 +101,22 @@ void UpdateModalDialogPosition(views::Widget* widget, |
| widget->SetBounds(gfx::Rect(position, size)); |
| } |
| +views::Widget* ShowWebModalDialogViews( |
| + views::WidgetDelegate* dialog, |
| + content::WebContents* initiator_web_contents, |
| + bool parented) { |
|
tapted
2016/05/13 06:08:46
ooh naming this is tough. Maybe `grandchild`? or `
Patti Lor
2016/05/18 04:48:38
Done, changed as discussed offline.
|
| + DCHECK(constrained_window_views_client); |
| + // For embedded WebContents, use the embedder's WebContents for constrained |
| + // window. |
| + content::WebContents* web_contents = |
| + guest_view::GuestViewBase::GetTopLevelWebContents(initiator_web_contents); |
| + views::Widget* widget = CreateWebModalDialogViews(dialog, web_contents); |
| + web_modal::WebContentsModalDialogManager* manager = |
| + web_modal::WebContentsModalDialogManager::FromWebContents(web_contents); |
| + manager->ShowModalDialog(widget->GetNativeWindow(), parented); |
|
tapted
2016/05/13 06:08:46
I think it's fine to duplicate the lines above, so
Patti Lor
2016/05/18 04:48:38
Done.
|
| + return widget; |
| +} |
| + |
| } // namespace |
| // static |
| @@ -135,15 +151,13 @@ void UpdateWidgetModalDialogPosition(views::Widget* widget, |
| views::Widget* ShowWebModalDialogViews( |
| views::WidgetDelegate* dialog, |
| content::WebContents* initiator_web_contents) { |
| - DCHECK(constrained_window_views_client); |
| - // For embedded WebContents, use the embedder's WebContents for constrained |
| - // window. |
| - content::WebContents* web_contents = |
| - guest_view::GuestViewBase::GetTopLevelWebContents(initiator_web_contents); |
| - views::Widget* widget = CreateWebModalDialogViews(dialog, web_contents); |
| - web_modal::WebContentsModalDialogManager::FromWebContents(web_contents) |
| - ->ShowModalDialog(widget->GetNativeWindow()); |
| - return widget; |
| + return ShowWebModalDialogViews(dialog, initiator_web_contents, false); |
| +} |
| + |
| +views::Widget* ShowParentedWebModalDialogViews( |
| + views::WidgetDelegate* dialog, |
| + content::WebContents* initiator_web_contents) { |
| + return ShowWebModalDialogViews(dialog, initiator_web_contents, true); |
| } |
| views::Widget* CreateWebModalDialogViews(views::WidgetDelegate* dialog, |