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

Unified Diff: components/guest_view/browser/guest_view_message_filter.cc

Issue 1560553002: Framelet Prototype 2016 Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased + Applied Brett's Windows + Fixed security issue Created 4 years, 11 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: components/guest_view/browser/guest_view_message_filter.cc
diff --git a/components/guest_view/browser/guest_view_message_filter.cc b/components/guest_view/browser/guest_view_message_filter.cc
index c7d1546d125ee89deb394998e23f884f79d390d2..38b7cfd66cfb57e5e12368b59692865a571b0da9 100644
--- a/components/guest_view/browser/guest_view_message_filter.cc
+++ b/components/guest_view/browser/guest_view_message_filter.cc
@@ -81,7 +81,28 @@ bool GuestViewMessageFilter::OnMessageReceived(const IPC::Message& message) {
OnViewGarbageCollected)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
- return handled;
+ if (handled)
+ return true;
+
+ int element_instance_id = kInstanceIDNone;
+ base::PickleIterator iter(message);
+ bool success = iter.ReadInt(&element_instance_id);
+ DCHECK(success);
+
+ auto manager = GuestViewManager::FromBrowserContext(browser_context_);
+
+ content::WebContents* guest_web_contents =
+ manager->GetGuestByInstanceID(render_process_id_, element_instance_id);
+ if (!guest_web_contents)
+ return true;
+
+ auto guest = GuestViewBase::FromWebContents(guest_web_contents);
+ if (guest && guest->OnMessageReceivedFromEmbedder(message))
+ return true;
+
+ // Always consume GuestView messages because we may not have an available
+ // guest during tear down.
+ return true;
}
void GuestViewMessageFilter::OnViewCreated(int view_instance_id,
« no previous file with comments | « components/guest_view/browser/guest_view_base.cc ('k') | components/guest_view/renderer/guest_view_container.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698