Commit 0a61f800 authored by sammc's avatar sammc Committed by Commit bot

Use the outermost embedder WebContents in ConstrainedWindowMac.

Currently, ConstrainedWindowMac uses the embedder WebContents of the
GuestView if the WebContents is in a GuestView. However, with OOP PDF, a
mime handler view can be embedded in a webview that is embedded in an
app window; in this case, the webview WebContents is used instead of the
app window WebContents. This CL changes ConstrainedWindowMac to use the
outermost embedder WebContents.

This is the same fix as http://crrev.com/321248, but for mac.

BUG=457672

Review URL: https://codereview.chromium.org/1029583007

Cr-Commit-Position: refs/heads/master@{#322305}
parent dbfb90d4
...@@ -20,12 +20,15 @@ ConstrainedWindowMac::ConstrainedWindowMac( ...@@ -20,12 +20,15 @@ ConstrainedWindowMac::ConstrainedWindowMac(
id<ConstrainedWindowSheet> sheet) id<ConstrainedWindowSheet> sheet)
: delegate_(delegate) { : delegate_(delegate) {
DCHECK(sheet); DCHECK(sheet);
extensions::GuestViewBase* guest_view =
extensions::GuestViewBase::FromWebContents(web_contents); // |web_contents| may be embedded within a chain of nested GuestViews. If it
// For embedded WebContents, use the embedder's WebContents for constrained // is, follow the chain of embedders to the outermost WebContents and use it.
// window. while (extensions::GuestViewBase* guest_view =
web_contents = guest_view && guest_view->embedder_web_contents() ? extensions::GuestViewBase::FromWebContents(web_contents)) {
guest_view->embedder_web_contents() : web_contents; if (!guest_view->embedder_web_contents())
break;
web_contents = guest_view->embedder_web_contents();
}
auto manager = WebContentsModalDialogManager::FromWebContents(web_contents); auto manager = WebContentsModalDialogManager::FromWebContents(web_contents);
scoped_ptr<SingleWebContentsDialogManagerCocoa> native_manager( scoped_ptr<SingleWebContentsDialogManagerCocoa> native_manager(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment