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

Unified Diff: content/browser/web_contents/web_contents_impl.cc

Issue 10344028: Support cross-process window.close() messages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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 | « content/browser/web_contents/web_contents_impl.h ('k') | content/common/swapped_out_messages.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/web_contents/web_contents_impl.cc
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 05dafcd5a03c47149959973c9ea7ad5ec9ee9b18..fbd9e5a7883018462ebfb65610139cc2bcb2527b 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -2386,6 +2386,16 @@ void WebContentsImpl::RequestTransferURL(
}
}
+void WebContentsImpl::RouteCloseEvent(RenderViewHost* rvh) {
+ // Tell the active RenderViewHost to run unload handlers and close, as long
+ // as the request came from a RenderViewHost in the same BrowsingInstance.
+ // In most cases, we receive this from a swapped out RenderViewHost.
+ // It is possible to receive it from one that has just been swapped in,
+ // in which case we might as well deliver the message anyway.
+ if (rvh->GetSiteInstance()->IsRelatedSiteInstance(GetSiteInstance()))
+ GetRenderViewHost()->ClosePage();
+}
+
void WebContentsImpl::RunJavaScriptMessage(
RenderViewHost* rvh,
const string16& message,
« no previous file with comments | « content/browser/web_contents/web_contents_impl.h ('k') | content/common/swapped_out_messages.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698