Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(661)

Unified Diff: components/constrained_window/constrained_window_views.cc

Issue 1779383002: MacViews: Remove constrained window dependencies for certificate viewer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase & address review comments. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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,

Powered by Google App Engine
This is Rietveld 408576698