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

Unified Diff: extensions/browser/guest_view/extensions_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: Rebase after swapped out changes major rework with RFP 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: extensions/browser/guest_view/extensions_guest_view_message_filter.cc
diff --git a/extensions/browser/guest_view/extensions_guest_view_message_filter.cc b/extensions/browser/guest_view/extensions_guest_view_message_filter.cc
index 016fffe0707b055046f0805fd7f8c05fae8978d5..6ad1e28ad4826500935c3be315afaac48570c525 100644
--- a/extensions/browser/guest_view/extensions_guest_view_message_filter.cc
+++ b/extensions/browser/guest_view/extensions_guest_view_message_filter.cc
@@ -48,6 +48,7 @@ void ExtensionsGuestViewMessageFilter::OverrideThreadForMessage(
const IPC::Message& message,
BrowserThread::ID* thread) {
switch (message.type()) {
+ case ExtensionsGuestViewHostMsg_AttachToEmbedderFrame::ID:
case ExtensionsGuestViewHostMsg_CreateMimeHandlerViewGuest::ID:
case ExtensionsGuestViewHostMsg_ResizeGuest::ID:
*thread = BrowserThread::UI;
@@ -61,6 +62,8 @@ bool ExtensionsGuestViewMessageFilter::OnMessageReceived(
const IPC::Message& message) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(ExtensionsGuestViewMessageFilter, message)
+ IPC_MESSAGE_HANDLER(ExtensionsGuestViewHostMsg_AttachToEmbedderFrame,
+ OnAttachToEmbedderFrame)
IPC_MESSAGE_HANDLER(ExtensionsGuestViewHostMsg_CanExecuteContentScriptSync,
OnCanExecuteContentScript)
IPC_MESSAGE_HANDLER(ExtensionsGuestViewHostMsg_CreateMimeHandlerViewGuest,
@@ -84,6 +87,44 @@ GuestViewManager* ExtensionsGuestViewMessageFilter::
return manager;
}
+void ExtensionsGuestViewMessageFilter::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_);
+ DCHECK(guest_web_contents);
+ auto* guest = WebViewGuest::FromWebContents(guest_web_contents);
+ DCHECK(guest);
+ 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);
+ guest_web_contents->AttachToOuterWebContentsFrame(owner_web_contents,
+ embedder_frame);
+
+ manager->AttachGuest(render_process_id_, element_instance_id,
+ guest_instance_id, params);
+
+ owner_web_contents->GetMainFrame()->Send(
+ new ExtensionsGuestViewMsg_AttachToEmbedderFrame_ACK(
+ element_instance_id));
+
+ guest->WillAttach(
+ owner_web_contents, element_instance_id, false,
+ base::Bind(&ExtensionsGuestViewMessageFilter::WillAttachCallback, this,
+ guest));
+}
+
+void ExtensionsGuestViewMessageFilter::WillAttachCallback(
+ extensions::WebViewGuest* guest) {
+ guest->DidAttach(MSG_ROUTING_NONE);
+}
+
void ExtensionsGuestViewMessageFilter::OnCanExecuteContentScript(
int render_view_id,
int script_id,

Powered by Google App Engine
This is Rietveld 408576698