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

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

Issue 972313002: Make <webview> use out-of-process iframe architecture. (Closed) Base URL: ssh://saopaulo.wat/mnt/dev/shared/src@testoopif2z-better-chrome
Patch Set: sync Created 5 years, 6 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 13835a0ff6441793c8577fb31108bbede147ff38..88720c3c668423de8b1f31ad1f05e22dc47dff8a 100644
--- a/components/guest_view/browser/guest_view_message_filter.cc
+++ b/components/guest_view/browser/guest_view_message_filter.cc
@@ -74,6 +74,8 @@ bool GuestViewMessageFilter::OnMessageReceived(const IPC::Message& message) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(GuestViewMessageFilter, message)
IPC_MESSAGE_HANDLER(GuestViewHostMsg_AttachGuest, OnAttachGuest)
+ IPC_MESSAGE_HANDLER(GuestViewHostMsg_AttachToEmbedderFrame,
+ OnAttachToEmbedderFrame)
IPC_MESSAGE_HANDLER(GuestViewHostMsg_ViewCreated, OnViewCreated)
IPC_MESSAGE_HANDLER(GuestViewHostMsg_ViewGarbageCollected,
OnViewGarbageCollected)
@@ -112,4 +114,47 @@ void GuestViewMessageFilter::OnAttachGuest(
params);
}
+void GuestViewMessageFilter::OnAttachToEmbedderFrame(
+ int embedder_local_render_frame_id,
+ int element_instance_id,
+ int guest_instance_id,
+ const base::DictionaryValue& params) {
+ auto* manager = GuestViewManager::FromBrowserContext(browser_context_);
+ DCHECK(manager);
+ content::WebContents* guest_web_contents =
+ manager->GetGuestByInstanceIDSafely(guest_instance_id,
+ render_process_id_);
+ if (!guest_web_contents)
+ return;
+
+ auto* guest = GuestViewBase::FromWebContents(guest_web_contents);
+ content::WebContents* owner_web_contents = guest->owner_web_contents();
+ DCHECK(owner_web_contents);
+ auto* embedder_frame = RenderFrameHost::FromID(
+ render_process_id_, embedder_local_render_frame_id);
+
+ // Attach this inner WebContents |guest_web_contents| to the outer
+ // WebContents |owner_web_contents|. The outer WebContents's
+ // frame |embedder_frame| hosts the inner WebContents.
+ guest_web_contents->AttachToOuterWebContentsFrame(owner_web_contents,
+ embedder_frame);
+
+ // Update the guest manager about the attachment.
+ // This sets up the embedder and guest pairing information inside
+ // the manager.
+ manager->AttachGuest(render_process_id_, element_instance_id,
+ guest_instance_id, params);
+
+ owner_web_contents->GetMainFrame()->Send(
+ new GuestViewMsg_AttachToEmbedderFrame_ACK(element_instance_id));
+
+ guest->WillAttach(
+ owner_web_contents, element_instance_id, false,
+ base::Bind(&GuestViewMessageFilter::WillAttachCallback, this, guest));
+}
+
+void GuestViewMessageFilter::WillAttachCallback(GuestViewBase* guest) {
+ guest->DidAttach(MSG_ROUTING_NONE);
+}
+
} // namespace guest_view
« no previous file with comments | « components/guest_view/browser/guest_view_message_filter.h ('k') | components/guest_view/common/guest_view_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698