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

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

Issue 10829225: Browser Plugin: Add HTML5-like postMessage support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: No need to rename addEventListener/removeEventListener Created 8 years, 2 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: 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 645644f4279af87a2a3c216be1155838995cccca..fb042ccb2ebf71203843d246c88082a917ce536b 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -3013,8 +3013,10 @@ void WebContentsImpl::RouteMessageEvent(
RenderViewHost* rvh,
const ViewMsg_PostMessage_Params& params) {
// Only deliver the message to the active RenderViewHost if the request
- // came from a RenderViewHost in the same BrowsingInstance.
- if (!rvh->GetSiteInstance()->IsRelatedSiteInstance(GetSiteInstance()))
+ // came from a RenderViewHost in the same BrowsingInstance or this WebContents
+ // is dedicated to a browser plugin guest.
Charlie Reis 2012/10/12 00:31:43 nit: or if This check isn't quite right, but I'm
Fady Samuel 2012/10/12 18:07:53 Done.
+ if (!rvh->GetSiteInstance()->IsRelatedSiteInstance(GetSiteInstance()) &&
+ !GetBrowserPluginGuest() && !GetBrowserPluginEmbedder())
return;
ViewMsg_PostMessage_Params new_params(params);
@@ -3039,8 +3041,13 @@ void WebContentsImpl::RouteMessageEvent(
}
if (source_contents) {
- new_params.source_routing_id =
- source_contents->CreateOpenerRenderViews(GetSiteInstance());
+ if (GetBrowserPluginGuest()) {
+ new_params.source_routing_id =
Charlie Reis 2012/10/12 00:31:43 Please mention that we create a swapped out RV for
Fady Samuel 2012/10/12 18:07:53 Done.
+ source_contents->CreateSwappedOutRenderView(GetSiteInstance());
+ } else {
+ new_params.source_routing_id =
+ source_contents->CreateOpenerRenderViews(GetSiteInstance());
+ }
} else {
// We couldn't find it, so don't pass a source frame.
new_params.source_routing_id = MSG_ROUTING_NONE;
@@ -3143,6 +3150,11 @@ WebPreferences WebContentsImpl::GetWebkitPrefs() {
return GetWebkitPrefs(GetRenderViewHost(), url);
}
+int WebContentsImpl::CreateSwappedOutRenderView(
+ content::SiteInstance* instance) {
+ return render_manager_.CreateRenderView(instance, MSG_ROUTING_NONE, true);
+}
+
void WebContentsImpl::OnUserGesture() {
// Notify observers.
FOR_EACH_OBSERVER(WebContentsObserver, observers_, DidGetUserGesture());

Powered by Google App Engine
This is Rietveld 408576698