Commit e289a91e authored by Lucas Gadani's avatar Lucas Gadani Committed by Commit Bot

Portals: Attach TabHelpers when a Portal is created.

This CL adds a notification via WebContentsDelegate that
notifies the embedder that a new portal WebContents was created.

The chrome/ embedder then uses this notification in order to
attach TabHelpers to the newly created WebContents.

Bug: 865565

Change-Id: I3e39883a5869832e6e59be9db7ea9e88ab18cd64
Reviewed-on: https://chromium-review.googlesource.com/1197143Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Commit-Queue: Lucas Gadani <lfg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#592498}
parent b6a59f2e
......@@ -1717,6 +1717,10 @@ void Browser::WebContentsCreated(WebContents* source_contents,
task_manager::WebContentsTags::CreateForTabContents(new_contents);
}
void Browser::PortalWebContentsCreated(WebContents* portal_web_contents) {
TabHelpers::AttachTabHelpers(portal_web_contents);
}
void Browser::RendererUnresponsive(
WebContents* source,
content::RenderWidgetHost* render_widget_host,
......
......@@ -636,6 +636,8 @@ class Browser : public TabStripModelObserver,
const std::string& frame_name,
const GURL& target_url,
content::WebContents* new_contents) override;
void PortalWebContentsCreated(
content::WebContents* portal_web_contents) override;
void RendererUnresponsive(
content::WebContents* source,
content::RenderWidgetHost* render_widget_host,
......
......@@ -9,6 +9,7 @@
#include "content/browser/frame_host/render_frame_host_impl.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_delegate.h"
#include "content/public/common/content_switches.h"
#include "mojo/public/cpp/bindings/strong_binding.h"
#include "third_party/blink/public/common/features.h"
......@@ -53,6 +54,9 @@ void Portal::Init(
WebContents::FromRenderFrameHost(owner_render_frame_host_)
->GetBrowserContext());
portal_contents_ = WebContents::Create(params);
WebContents::FromRenderFrameHost(owner_render_frame_host_)
->GetDelegate()
->PortalWebContentsCreated(portal_contents_.get());
}
void Portal::Navigate(const GURL& url) {
......
......@@ -318,6 +318,9 @@ class CONTENT_EXPORT WebContentsDelegate {
const GURL& target_url,
WebContents* new_contents) {}
// Notifies the embedder that a Portal WebContents was created.
virtual void PortalWebContentsCreated(WebContents* portal_web_contents) {}
// Notification that one of the frames in the WebContents is hung. |source| is
// the WebContents that is hung, and |render_widget_host| is the
// RenderWidgetHost that, while routing events to it, discovered the hang.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment