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

Unified Diff: chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.mm

Issue 1029583007: Use the outermost embedder WebContents in ConstrainedWindowMac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.mm
diff --git a/chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.mm b/chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.mm
index 1da08e0e54dfdf0b1575f6d5192a90a1c7b00035..0cc3fa0e98e399e9f8c684496af2539e5f18a943 100644
--- a/chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.mm
+++ b/chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.mm
@@ -20,12 +20,15 @@ ConstrainedWindowMac::ConstrainedWindowMac(
id<ConstrainedWindowSheet> sheet)
: delegate_(delegate) {
DCHECK(sheet);
- extensions::GuestViewBase* guest_view =
- extensions::GuestViewBase::FromWebContents(web_contents);
- // For embedded WebContents, use the embedder's WebContents for constrained
- // window.
- web_contents = guest_view && guest_view->embedder_web_contents() ?
- guest_view->embedder_web_contents() : web_contents;
+
+ // |web_contents| may be embedded within a chain of nested GuestViews. If it
+ // is, follow the chain of embedders to the outermost WebContents and use it.
+ while (extensions::GuestViewBase* guest_view =
Fady Samuel 2015/03/26 01:43:02 Drive by comment: This pattern has started emergin
+ extensions::GuestViewBase::FromWebContents(web_contents)) {
+ if (!guest_view->embedder_web_contents())
+ break;
+ web_contents = guest_view->embedder_web_contents();
+ }
auto manager = WebContentsModalDialogManager::FromWebContents(web_contents);
scoped_ptr<SingleWebContentsDialogManagerCocoa> native_manager(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698