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

Unified Diff: chrome/browser/ui/views/chrome_constrained_window_views_client.cc

Issue 1012373002: Return the outermost embedder when returning the embedder web contents. (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/views/chrome_constrained_window_views_client.cc
diff --git a/chrome/browser/ui/views/chrome_constrained_window_views_client.cc b/chrome/browser/ui/views/chrome_constrained_window_views_client.cc
index 7575b14741b9aa69c9025eb7f396e73d1d95e0cf..767d96d99b28e14fae307295dde2da2301eed301 100644
--- a/chrome/browser/ui/views/chrome_constrained_window_views_client.cc
+++ b/chrome/browser/ui/views/chrome_constrained_window_views_client.cc
@@ -21,10 +21,17 @@ class ChromeConstrainedWindowViewsClient
// ConstrainedWindowViewsClient:
content::WebContents* GetEmbedderWebContents(
content::WebContents* initiator_web_contents) override {
- extensions::GuestViewBase* guest_view =
- extensions::GuestViewBase::FromWebContents(initiator_web_contents);
- return guest_view && guest_view->embedder_web_contents() ?
- guest_view->embedder_web_contents() : initiator_web_contents;
+ // |initiator_web_contents| may be embedded within a chain of nested
+ // GuestViews. If it is, follow the chain of embedders to the outermost
+ // WebContents and return it.
+ while (extensions::GuestViewBase* guest_view =
+ extensions::GuestViewBase::FromWebContents(
+ initiator_web_contents)) {
+ if (!guest_view->embedder_web_contents())
+ break;
+ initiator_web_contents = guest_view->embedder_web_contents();
+ }
+ return initiator_web_contents;
}
web_modal::ModalDialogHost* GetModalDialogHost(
gfx::NativeWindow parent) override {
« 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