cef/patch/patches/mime_handler_view_guest_156...

298 lines
15 KiB
Diff
Raw Normal View History

2017-02-10 23:44:11 +01:00
diff --git content/browser/browser_plugin/browser_plugin_guest.cc content/browser/browser_plugin/browser_plugin_guest.cc
Add support for MimeHandlerViewInCrossProcessFrame (fixes issue #2727) The PDF loading documentation in extension_system.cc has be updated to describe the new code paths. To support delivery of input events to the mime handler renderer process it is now necessary to route events via the correct RWHV interface. For Aura-based platforms (Windows/Linux) this means RWHVAura::On*Event and for macOS this means RWHVMac::RouteOrProcess*Event. Since Aura uses UI event types these have become the source of truth on Aura-based platforms with conversion to Web event types when needed (primarily for OSR). This change also adds a timeout for CefProcessHostMsg_GetNewBrowserInfo to avoid a hung renderer process if the guest WebContents route is not registered via CefMimeHandlerViewGuestDelegate::OnGuestDetached as expected prior to CefBrowserInfoManager::OnGetNewBrowserInfo being called. This timeout can be disabled for testing purposes by passing the `--disable-new-browser-info-timeout` command-line flag. The `--disable-features=MimeHandlerViewInCrossProcessFrame` command-line flag can be used for a limited time to restore the previous implementation based on BrowserPlugin. That implementation will be deleted starting with the 3897 branch update. Known issues: - ExecuteJavaScript calls on the frame hosting the PDF extension will not be routed to the mime handler renderer process. - The PDF extension will not load successfully if blocked by ChromePluginPlaceholder and then manually continued via the "Run this plugin" context menu option (see https://crbug.com/533069#c41).
2020-01-23 22:58:01 +01:00
index 6eb21be63dec..8617eff6bfc8 100644
2017-02-10 23:44:11 +01:00
--- content/browser/browser_plugin/browser_plugin_guest.cc
+++ content/browser/browser_plugin/browser_plugin_guest.cc
Add support for MimeHandlerViewInCrossProcessFrame (fixes issue #2727) The PDF loading documentation in extension_system.cc has be updated to describe the new code paths. To support delivery of input events to the mime handler renderer process it is now necessary to route events via the correct RWHV interface. For Aura-based platforms (Windows/Linux) this means RWHVAura::On*Event and for macOS this means RWHVMac::RouteOrProcess*Event. Since Aura uses UI event types these have become the source of truth on Aura-based platforms with conversion to Web event types when needed (primarily for OSR). This change also adds a timeout for CefProcessHostMsg_GetNewBrowserInfo to avoid a hung renderer process if the guest WebContents route is not registered via CefMimeHandlerViewGuestDelegate::OnGuestDetached as expected prior to CefBrowserInfoManager::OnGetNewBrowserInfo being called. This timeout can be disabled for testing purposes by passing the `--disable-new-browser-info-timeout` command-line flag. The `--disable-features=MimeHandlerViewInCrossProcessFrame` command-line flag can be used for a limited time to restore the previous implementation based on BrowserPlugin. That implementation will be deleted starting with the 3897 branch update. Known issues: - ExecuteJavaScript calls on the frame hosting the PDF extension will not be routed to the mime handler renderer process. - The PDF extension will not load successfully if blocked by ChromePluginPlaceholder and then manually continued via the "Run this plugin" context menu option (see https://crbug.com/533069#c41).
2020-01-23 22:58:01 +01:00
@@ -820,7 +820,8 @@ void BrowserPluginGuest::OnWillAttachComplete(
2017-02-10 23:44:11 +01:00
static_cast<WebContentsViewGuest*>(GetWebContents()->GetView());
if (!web_contents()->GetRenderViewHost()->GetWidget()->GetView()) {
2017-02-10 23:44:11 +01:00
web_contents_view->CreateViewForWidget(
- web_contents()->GetRenderViewHost()->GetWidget(), true);
2017-02-10 23:44:11 +01:00
+ web_contents()->GetRenderViewHost()->GetWidget(),
+ embedder_web_contents->GetRenderViewHost()->GetWidget());
}
}
2017-02-10 23:44:11 +01:00
diff --git content/browser/frame_host/interstitial_page_impl.cc content/browser/frame_host/interstitial_page_impl.cc
index 7bb71f92bb0a..a6b89a831044 100644
2017-02-10 23:44:11 +01:00
--- content/browser/frame_host/interstitial_page_impl.cc
+++ content/browser/frame_host/interstitial_page_impl.cc
@@ -619,7 +619,7 @@ WebContentsView* InterstitialPageImpl::CreateWebContentsView() {
2017-02-10 23:44:11 +01:00
WebContentsView* wcv =
static_cast<WebContentsImpl*>(web_contents())->GetView();
RenderWidgetHostViewBase* view =
- wcv->CreateViewForWidget(render_view_host_->GetWidget(), false);
+ wcv->CreateViewForWidget(render_view_host_->GetWidget(), nullptr);
render_view_host_->GetWidget()->SetView(view);
render_view_host_->GetMainFrame()->AllowBindings(
BINDINGS_POLICY_DOM_AUTOMATION);
2017-02-10 23:44:11 +01:00
diff --git content/browser/web_contents/web_contents_view.h content/browser/web_contents/web_contents_view.h
index bff5b42b166c..4e21a23e364b 100644
2017-02-10 23:44:11 +01:00
--- content/browser/web_contents/web_contents_view.h
+++ content/browser/web_contents/web_contents_view.h
@@ -23,7 +23,7 @@ struct DropData;
// The WebContentsView is an interface that is implemented by the platform-
// dependent web contents views. The WebContents uses this interface to talk to
// them.
-class WebContentsView {
+class CONTENT_EXPORT WebContentsView {
public:
virtual ~WebContentsView() {}
@@ -83,13 +83,9 @@ class WebContentsView {
2017-02-10 23:44:11 +01:00
// Sets up the View that holds the rendered web page, receives messages for
// it and contains page plugins. The host view should be sized to the current
// size of the WebContents.
- //
- // |is_guest_view_hack| is temporary hack and will be removed once
- // RenderWidgetHostViewGuest is not dependent on platform view.
- // TODO(lazyboy): Remove |is_guest_view_hack| once http://crbug.com/330264 is
- // fixed.
virtual RenderWidgetHostViewBase* CreateViewForWidget(
- RenderWidgetHost* render_widget_host, bool is_guest_view_hack) = 0;
+ RenderWidgetHost* render_widget_host,
+ RenderWidgetHost* embedder_render_widget_host) = 0;
// Creates a new View that holds a non-top-level widget and receives messages
// for it.
2017-02-10 23:44:11 +01:00
diff --git content/browser/web_contents/web_contents_view_aura.cc content/browser/web_contents/web_contents_view_aura.cc
index fbefaf207527..093c9cfa2bd1 100644
2017-02-10 23:44:11 +01:00
--- content/browser/web_contents/web_contents_view_aura.cc
+++ content/browser/web_contents/web_contents_view_aura.cc
@@ -966,7 +966,8 @@ void WebContentsViewAura::CreateView(gfx::NativeView context) {
2017-02-10 23:44:11 +01:00
}
RenderWidgetHostViewBase* WebContentsViewAura::CreateViewForWidget(
- RenderWidgetHost* render_widget_host, bool is_guest_view_hack) {
+ RenderWidgetHost* render_widget_host,
+ RenderWidgetHost* embedder_render_widget_host) {
if (render_widget_host->GetView()) {
// During testing, the view will already be set up in most cases to the
// test view, so we don't want to clobber it with a real one. To verify that
@@ -978,6 +979,7 @@ RenderWidgetHostViewBase* WebContentsViewAura::CreateViewForWidget(
render_widget_host->GetView());
2017-02-10 23:44:11 +01:00
}
+ const bool is_guest_view_hack = !!embedder_render_widget_host;
2017-02-10 23:44:11 +01:00
RenderWidgetHostViewAura* view =
g_create_render_widget_host_view
? g_create_render_widget_host_view(render_widget_host,
2017-02-10 23:44:11 +01:00
diff --git content/browser/web_contents/web_contents_view_aura.h content/browser/web_contents/web_contents_view_aura.h
index 180f4fa00e46..05ec3dec8331 100644
2017-02-10 23:44:11 +01:00
--- content/browser/web_contents/web_contents_view_aura.h
+++ content/browser/web_contents/web_contents_view_aura.h
@@ -148,7 +148,7 @@ class CONTENT_EXPORT WebContentsViewAura
void CreateView(gfx::NativeView context) override;
2017-02-10 23:44:11 +01:00
RenderWidgetHostViewBase* CreateViewForWidget(
RenderWidgetHost* render_widget_host,
- bool is_guest_view_hack) override;
+ RenderWidgetHost* embedder_render_widget_host) override;
RenderWidgetHostViewBase* CreateViewForChildWidget(
2017-02-10 23:44:11 +01:00
RenderWidgetHost* render_widget_host) override;
void SetPageTitle(const base::string16& title) override;
diff --git content/browser/web_contents/web_contents_view_child_frame.cc content/browser/web_contents/web_contents_view_child_frame.cc
index a766385cf589..fa6832be0759 100644
2017-02-10 23:44:11 +01:00
--- content/browser/web_contents/web_contents_view_child_frame.cc
+++ content/browser/web_contents/web_contents_view_child_frame.cc
@@ -83,7 +83,7 @@ void WebContentsViewChildFrame::CreateView(gfx::NativeView context) {
2017-02-10 23:44:11 +01:00
RenderWidgetHostViewBase* WebContentsViewChildFrame::CreateViewForWidget(
RenderWidgetHost* render_widget_host,
- bool is_guest_view_hack) {
+ RenderWidgetHost* embedder_render_widget_host) {
return RenderWidgetHostViewChildFrame::Create(render_widget_host);
}
2017-02-10 23:44:11 +01:00
diff --git content/browser/web_contents/web_contents_view_child_frame.h content/browser/web_contents/web_contents_view_child_frame.h
index 412bb35e4b69..2f5f7ac02b20 100644
2017-02-10 23:44:11 +01:00
--- content/browser/web_contents/web_contents_view_child_frame.h
+++ content/browser/web_contents/web_contents_view_child_frame.h
@@ -39,7 +39,7 @@ class WebContentsViewChildFrame : public WebContentsView,
void CreateView(gfx::NativeView context) override;
2017-02-10 23:44:11 +01:00
RenderWidgetHostViewBase* CreateViewForWidget(
RenderWidgetHost* render_widget_host,
- bool is_guest_view_hack) override;
+ RenderWidgetHost* embedder_render_widget_host) override;
RenderWidgetHostViewBase* CreateViewForChildWidget(
2017-02-10 23:44:11 +01:00
RenderWidgetHost* render_widget_host) override;
void SetPageTitle(const base::string16& title) override;
diff --git content/browser/web_contents/web_contents_view_guest.cc content/browser/web_contents/web_contents_view_guest.cc
index c45581fd22b7..f9507a4e7db5 100644
2017-02-10 23:44:11 +01:00
--- content/browser/web_contents/web_contents_view_guest.cc
+++ content/browser/web_contents/web_contents_view_guest.cc
@@ -68,6 +68,8 @@ gfx::NativeWindow WebContentsViewGuest::GetTopLevelNativeWindow() const {
2017-02-10 23:44:11 +01:00
void WebContentsViewGuest::OnGuestAttached(WebContentsView* parent_view) {
#if defined(USE_AURA)
+ if (!platform_view_->GetNativeView())
+ return;
// In aura, ScreenPositionClient doesn't work properly if we do
// not have the native view associated with this WebContentsViewGuest in the
// view hierarchy. We add this view as embedder's child here.
@@ -78,6 +80,8 @@ void WebContentsViewGuest::OnGuestAttached(WebContentsView* parent_view) {
}
2017-02-10 23:44:11 +01:00
void WebContentsViewGuest::OnGuestDetached(WebContentsView* old_parent_view) {
+ if (!platform_view_->GetNativeView())
+ return;
#if defined(USE_AURA)
old_parent_view->GetNativeView()->RemoveChild(
platform_view_->GetNativeView());
@@ -118,7 +122,8 @@ void WebContentsViewGuest::CreateView(gfx::NativeView context) {
2017-02-10 23:44:11 +01:00
}
RenderWidgetHostViewBase* WebContentsViewGuest::CreateViewForWidget(
- RenderWidgetHost* render_widget_host, bool is_guest_view_hack) {
+ RenderWidgetHost* render_widget_host,
+ RenderWidgetHost* embedder_render_widget_host) {
if (render_widget_host->GetView()) {
// During testing, the view will already be set up in most cases to the
// test view, so we don't want to clobber it with a real one. To verify that
@@ -130,11 +135,19 @@ RenderWidgetHostViewBase* WebContentsViewGuest::CreateViewForWidget(
2017-02-10 23:44:11 +01:00
render_widget_host->GetView());
}
+ embedder_render_widget_host =
+ guest_->embedder_web_contents()->GetRenderViewHost()->GetWidget();
RenderWidgetHostViewBase* platform_widget =
- platform_view_->CreateViewForWidget(render_widget_host, true);
+ platform_view_->CreateViewForWidget(render_widget_host,
+ embedder_render_widget_host);
- return RenderWidgetHostViewGuest::Create(render_widget_host, guest_,
- platform_widget->GetWeakPtr());
+ RenderWidgetHostViewGuest* guest_view =
+ RenderWidgetHostViewGuest::Create(render_widget_host, guest_,
+ platform_widget->GetWeakPtr());
+ platform_widget->InitAsGuest(embedder_render_widget_host->GetView(),
+ guest_view);
+
2017-02-10 23:44:11 +01:00
+ return guest_view;
}
RenderWidgetHostViewBase* WebContentsViewGuest::CreateViewForChildWidget(
2017-02-10 23:44:11 +01:00
diff --git content/browser/web_contents/web_contents_view_guest.h content/browser/web_contents/web_contents_view_guest.h
index 12aa7cd4799d..bcd4e242c2f7 100644
2017-02-10 23:44:11 +01:00
--- content/browser/web_contents/web_contents_view_guest.h
+++ content/browser/web_contents/web_contents_view_guest.h
@@ -57,7 +57,7 @@ class WebContentsViewGuest : public WebContentsView,
void CreateView(gfx::NativeView context) override;
2017-02-10 23:44:11 +01:00
RenderWidgetHostViewBase* CreateViewForWidget(
RenderWidgetHost* render_widget_host,
- bool is_guest_view_hack) override;
+ RenderWidgetHost* embedder_render_widget_host) override;
RenderWidgetHostViewBase* CreateViewForChildWidget(
2017-02-10 23:44:11 +01:00
RenderWidgetHost* render_widget_host) override;
void SetPageTitle(const base::string16& title) override;
diff --git content/browser/web_contents/web_contents_view_mac.h content/browser/web_contents/web_contents_view_mac.h
index 6fdec8c0a5e2..f57dc03069a5 100644
2017-02-10 23:44:11 +01:00
--- content/browser/web_contents/web_contents_view_mac.h
+++ content/browser/web_contents/web_contents_view_mac.h
@@ -76,7 +76,7 @@ class WebContentsViewMac : public WebContentsView,
void CreateView(gfx::NativeView context) override;
2017-02-10 23:44:11 +01:00
RenderWidgetHostViewBase* CreateViewForWidget(
RenderWidgetHost* render_widget_host,
- bool is_guest_view_hack) override;
+ RenderWidgetHost* embedder_render_widget_host) override;
RenderWidgetHostViewBase* CreateViewForChildWidget(
2017-02-10 23:44:11 +01:00
RenderWidgetHost* render_widget_host) override;
void SetPageTitle(const base::string16& title) override;
diff --git content/browser/web_contents/web_contents_view_mac.mm content/browser/web_contents/web_contents_view_mac.mm
index 4721a9b3f511..dfdd46d0c5d2 100644
2017-02-10 23:44:11 +01:00
--- content/browser/web_contents/web_contents_view_mac.mm
+++ content/browser/web_contents/web_contents_view_mac.mm
@@ -326,7 +326,8 @@ void WebContentsViewMac::CreateView(gfx::NativeView context) {
2017-02-10 23:44:11 +01:00
}
RenderWidgetHostViewBase* WebContentsViewMac::CreateViewForWidget(
- RenderWidgetHost* render_widget_host, bool is_guest_view_hack) {
+ RenderWidgetHost* render_widget_host,
+ RenderWidgetHost* embedder_render_widget_host) {
if (render_widget_host->GetView()) {
// During testing, the view will already be set up in most cases to the
// test view, so we don't want to clobber it with a real one. To verify that
@@ -338,6 +339,7 @@ RenderWidgetHostViewBase* WebContentsViewMac::CreateViewForWidget(
render_widget_host->GetView());
2017-02-10 23:44:11 +01:00
}
+ const bool is_guest_view_hack = !!embedder_render_widget_host;
RenderWidgetHostViewMac* view =
g_create_render_widget_host_view
? g_create_render_widget_host_view(render_widget_host,
2017-02-10 23:44:11 +01:00
diff --git extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc
Add support for MimeHandlerViewInCrossProcessFrame (fixes issue #2727) The PDF loading documentation in extension_system.cc has be updated to describe the new code paths. To support delivery of input events to the mime handler renderer process it is now necessary to route events via the correct RWHV interface. For Aura-based platforms (Windows/Linux) this means RWHVAura::On*Event and for macOS this means RWHVMac::RouteOrProcess*Event. Since Aura uses UI event types these have become the source of truth on Aura-based platforms with conversion to Web event types when needed (primarily for OSR). This change also adds a timeout for CefProcessHostMsg_GetNewBrowserInfo to avoid a hung renderer process if the guest WebContents route is not registered via CefMimeHandlerViewGuestDelegate::OnGuestDetached as expected prior to CefBrowserInfoManager::OnGetNewBrowserInfo being called. This timeout can be disabled for testing purposes by passing the `--disable-new-browser-info-timeout` command-line flag. The `--disable-features=MimeHandlerViewInCrossProcessFrame` command-line flag can be used for a limited time to restore the previous implementation based on BrowserPlugin. That implementation will be deleted starting with the 3897 branch update. Known issues: - ExecuteJavaScript calls on the frame hosting the PDF extension will not be routed to the mime handler renderer process. - The PDF extension will not load successfully if blocked by ChromePluginPlaceholder and then manually continued via the "Run this plugin" context menu option (see https://crbug.com/533069#c41).
2020-01-23 22:58:01 +01:00
index fa13ab856de9..81216c2bc8ff 100644
2017-02-10 23:44:11 +01:00
--- extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc
+++ extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc
@@ -215,6 +215,8 @@ void MimeHandlerViewGuest::CreateWebContents(
2017-02-10 23:44:11 +01:00
WebContents::CreateParams params(browser_context(),
guest_site_instance.get());
params.guest_delegate = this;
+ if (delegate_)
+ delegate_->OverrideWebContentsCreateParams(&params);
// TODO(erikchen): Fix ownership semantics for guest views.
// https://crbug.com/832879.
std::move(callback).Run(
Add support for MimeHandlerViewInCrossProcessFrame (fixes issue #2727) The PDF loading documentation in extension_system.cc has be updated to describe the new code paths. To support delivery of input events to the mime handler renderer process it is now necessary to route events via the correct RWHV interface. For Aura-based platforms (Windows/Linux) this means RWHVAura::On*Event and for macOS this means RWHVMac::RouteOrProcess*Event. Since Aura uses UI event types these have become the source of truth on Aura-based platforms with conversion to Web event types when needed (primarily for OSR). This change also adds a timeout for CefProcessHostMsg_GetNewBrowserInfo to avoid a hung renderer process if the guest WebContents route is not registered via CefMimeHandlerViewGuestDelegate::OnGuestDetached as expected prior to CefBrowserInfoManager::OnGetNewBrowserInfo being called. This timeout can be disabled for testing purposes by passing the `--disable-new-browser-info-timeout` command-line flag. The `--disable-features=MimeHandlerViewInCrossProcessFrame` command-line flag can be used for a limited time to restore the previous implementation based on BrowserPlugin. That implementation will be deleted starting with the 3897 branch update. Known issues: - ExecuteJavaScript calls on the frame hosting the PDF extension will not be routed to the mime handler renderer process. - The PDF extension will not load successfully if blocked by ChromePluginPlaceholder and then manually continued via the "Run this plugin" context menu option (see https://crbug.com/533069#c41).
2020-01-23 22:58:01 +01:00
@@ -230,6 +232,9 @@ void MimeHandlerViewGuest::CreateWebContents(
2017-02-10 23:44:11 +01:00
}
Add support for MimeHandlerViewInCrossProcessFrame (fixes issue #2727) The PDF loading documentation in extension_system.cc has be updated to describe the new code paths. To support delivery of input events to the mime handler renderer process it is now necessary to route events via the correct RWHV interface. For Aura-based platforms (Windows/Linux) this means RWHVAura::On*Event and for macOS this means RWHVMac::RouteOrProcess*Event. Since Aura uses UI event types these have become the source of truth on Aura-based platforms with conversion to Web event types when needed (primarily for OSR). This change also adds a timeout for CefProcessHostMsg_GetNewBrowserInfo to avoid a hung renderer process if the guest WebContents route is not registered via CefMimeHandlerViewGuestDelegate::OnGuestDetached as expected prior to CefBrowserInfoManager::OnGetNewBrowserInfo being called. This timeout can be disabled for testing purposes by passing the `--disable-new-browser-info-timeout` command-line flag. The `--disable-features=MimeHandlerViewInCrossProcessFrame` command-line flag can be used for a limited time to restore the previous implementation based on BrowserPlugin. That implementation will be deleted starting with the 3897 branch update. Known issues: - ExecuteJavaScript calls on the frame hosting the PDF extension will not be routed to the mime handler renderer process. - The PDF extension will not load successfully if blocked by ChromePluginPlaceholder and then manually continued via the "Run this plugin" context menu option (see https://crbug.com/533069#c41).
2020-01-23 22:58:01 +01:00
void MimeHandlerViewGuest::DidAttachToEmbedder() {
2017-02-10 23:44:11 +01:00
+ if (delegate_)
Add support for MimeHandlerViewInCrossProcessFrame (fixes issue #2727) The PDF loading documentation in extension_system.cc has be updated to describe the new code paths. To support delivery of input events to the mime handler renderer process it is now necessary to route events via the correct RWHV interface. For Aura-based platforms (Windows/Linux) this means RWHVAura::On*Event and for macOS this means RWHVMac::RouteOrProcess*Event. Since Aura uses UI event types these have become the source of truth on Aura-based platforms with conversion to Web event types when needed (primarily for OSR). This change also adds a timeout for CefProcessHostMsg_GetNewBrowserInfo to avoid a hung renderer process if the guest WebContents route is not registered via CefMimeHandlerViewGuestDelegate::OnGuestDetached as expected prior to CefBrowserInfoManager::OnGetNewBrowserInfo being called. This timeout can be disabled for testing purposes by passing the `--disable-new-browser-info-timeout` command-line flag. The `--disable-features=MimeHandlerViewInCrossProcessFrame` command-line flag can be used for a limited time to restore the previous implementation based on BrowserPlugin. That implementation will be deleted starting with the 3897 branch update. Known issues: - ExecuteJavaScript calls on the frame hosting the PDF extension will not be routed to the mime handler renderer process. - The PDF extension will not load successfully if blocked by ChromePluginPlaceholder and then manually continued via the "Run this plugin" context menu option (see https://crbug.com/533069#c41).
2020-01-23 22:58:01 +01:00
+ delegate_->OnGuestAttached();
2017-02-10 23:44:11 +01:00
+
Add support for MimeHandlerViewInCrossProcessFrame (fixes issue #2727) The PDF loading documentation in extension_system.cc has be updated to describe the new code paths. To support delivery of input events to the mime handler renderer process it is now necessary to route events via the correct RWHV interface. For Aura-based platforms (Windows/Linux) this means RWHVAura::On*Event and for macOS this means RWHVMac::RouteOrProcess*Event. Since Aura uses UI event types these have become the source of truth on Aura-based platforms with conversion to Web event types when needed (primarily for OSR). This change also adds a timeout for CefProcessHostMsg_GetNewBrowserInfo to avoid a hung renderer process if the guest WebContents route is not registered via CefMimeHandlerViewGuestDelegate::OnGuestDetached as expected prior to CefBrowserInfoManager::OnGetNewBrowserInfo being called. This timeout can be disabled for testing purposes by passing the `--disable-new-browser-info-timeout` command-line flag. The `--disable-features=MimeHandlerViewInCrossProcessFrame` command-line flag can be used for a limited time to restore the previous implementation based on BrowserPlugin. That implementation will be deleted starting with the 3897 branch update. Known issues: - ExecuteJavaScript calls on the frame hosting the PDF extension will not be routed to the mime handler renderer process. - The PDF extension will not load successfully if blocked by ChromePluginPlaceholder and then manually continued via the "Run this plugin" context menu option (see https://crbug.com/533069#c41).
2020-01-23 22:58:01 +01:00
web_contents()->GetController().LoadURL(
stream_->handler_url(), content::Referrer(),
ui::PAGE_TRANSITION_AUTO_TOPLEVEL, std::string());
@@ -259,6 +264,11 @@ bool MimeHandlerViewGuest::ShouldDestroyOnDetach() const {
return true;
}
+void MimeHandlerViewGuest::WillDestroy() {
2017-02-10 23:44:11 +01:00
+ if (delegate_)
Add support for MimeHandlerViewInCrossProcessFrame (fixes issue #2727) The PDF loading documentation in extension_system.cc has be updated to describe the new code paths. To support delivery of input events to the mime handler renderer process it is now necessary to route events via the correct RWHV interface. For Aura-based platforms (Windows/Linux) this means RWHVAura::On*Event and for macOS this means RWHVMac::RouteOrProcess*Event. Since Aura uses UI event types these have become the source of truth on Aura-based platforms with conversion to Web event types when needed (primarily for OSR). This change also adds a timeout for CefProcessHostMsg_GetNewBrowserInfo to avoid a hung renderer process if the guest WebContents route is not registered via CefMimeHandlerViewGuestDelegate::OnGuestDetached as expected prior to CefBrowserInfoManager::OnGetNewBrowserInfo being called. This timeout can be disabled for testing purposes by passing the `--disable-new-browser-info-timeout` command-line flag. The `--disable-features=MimeHandlerViewInCrossProcessFrame` command-line flag can be used for a limited time to restore the previous implementation based on BrowserPlugin. That implementation will be deleted starting with the 3897 branch update. Known issues: - ExecuteJavaScript calls on the frame hosting the PDF extension will not be routed to the mime handler renderer process. - The PDF extension will not load successfully if blocked by ChromePluginPlaceholder and then manually continued via the "Run this plugin" context menu option (see https://crbug.com/533069#c41).
2020-01-23 22:58:01 +01:00
+ delegate_->OnGuestDetached();
2017-02-10 23:44:11 +01:00
+}
+
WebContents* MimeHandlerViewGuest::OpenURLFromTab(
WebContents* source,
const content::OpenURLParams& params) {
diff --git extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h
Add support for MimeHandlerViewInCrossProcessFrame (fixes issue #2727) The PDF loading documentation in extension_system.cc has be updated to describe the new code paths. To support delivery of input events to the mime handler renderer process it is now necessary to route events via the correct RWHV interface. For Aura-based platforms (Windows/Linux) this means RWHVAura::On*Event and for macOS this means RWHVMac::RouteOrProcess*Event. Since Aura uses UI event types these have become the source of truth on Aura-based platforms with conversion to Web event types when needed (primarily for OSR). This change also adds a timeout for CefProcessHostMsg_GetNewBrowserInfo to avoid a hung renderer process if the guest WebContents route is not registered via CefMimeHandlerViewGuestDelegate::OnGuestDetached as expected prior to CefBrowserInfoManager::OnGetNewBrowserInfo being called. This timeout can be disabled for testing purposes by passing the `--disable-new-browser-info-timeout` command-line flag. The `--disable-features=MimeHandlerViewInCrossProcessFrame` command-line flag can be used for a limited time to restore the previous implementation based on BrowserPlugin. That implementation will be deleted starting with the 3897 branch update. Known issues: - ExecuteJavaScript calls on the frame hosting the PDF extension will not be routed to the mime handler renderer process. - The PDF extension will not load successfully if blocked by ChromePluginPlaceholder and then manually continued via the "Run this plugin" context menu option (see https://crbug.com/533069#c41).
2020-01-23 22:58:01 +01:00
index 3d0b70d06fe7..06d5e5d4e9e3 100644
2017-02-10 23:44:11 +01:00
--- extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h
+++ extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h
Add support for MimeHandlerViewInCrossProcessFrame (fixes issue #2727) The PDF loading documentation in extension_system.cc has be updated to describe the new code paths. To support delivery of input events to the mime handler renderer process it is now necessary to route events via the correct RWHV interface. For Aura-based platforms (Windows/Linux) this means RWHVAura::On*Event and for macOS this means RWHVMac::RouteOrProcess*Event. Since Aura uses UI event types these have become the source of truth on Aura-based platforms with conversion to Web event types when needed (primarily for OSR). This change also adds a timeout for CefProcessHostMsg_GetNewBrowserInfo to avoid a hung renderer process if the guest WebContents route is not registered via CefMimeHandlerViewGuestDelegate::OnGuestDetached as expected prior to CefBrowserInfoManager::OnGetNewBrowserInfo being called. This timeout can be disabled for testing purposes by passing the `--disable-new-browser-info-timeout` command-line flag. The `--disable-features=MimeHandlerViewInCrossProcessFrame` command-line flag can be used for a limited time to restore the previous implementation based on BrowserPlugin. That implementation will be deleted starting with the 3897 branch update. Known issues: - ExecuteJavaScript calls on the frame hosting the PDF extension will not be routed to the mime handler renderer process. - The PDF extension will not load successfully if blocked by ChromePluginPlaceholder and then manually continued via the "Run this plugin" context menu option (see https://crbug.com/533069#c41).
2020-01-23 22:58:01 +01:00
@@ -127,6 +127,7 @@ class MimeHandlerViewGuest
void EmbedderFullscreenToggled(bool entered_fullscreen) final;
2017-02-10 23:44:11 +01:00
bool ZoomPropagatesFromEmbedderToGuest() const final;
bool ShouldDestroyOnDetach() const final;
Add support for MimeHandlerViewInCrossProcessFrame (fixes issue #2727) The PDF loading documentation in extension_system.cc has be updated to describe the new code paths. To support delivery of input events to the mime handler renderer process it is now necessary to route events via the correct RWHV interface. For Aura-based platforms (Windows/Linux) this means RWHVAura::On*Event and for macOS this means RWHVMac::RouteOrProcess*Event. Since Aura uses UI event types these have become the source of truth on Aura-based platforms with conversion to Web event types when needed (primarily for OSR). This change also adds a timeout for CefProcessHostMsg_GetNewBrowserInfo to avoid a hung renderer process if the guest WebContents route is not registered via CefMimeHandlerViewGuestDelegate::OnGuestDetached as expected prior to CefBrowserInfoManager::OnGetNewBrowserInfo being called. This timeout can be disabled for testing purposes by passing the `--disable-new-browser-info-timeout` command-line flag. The `--disable-features=MimeHandlerViewInCrossProcessFrame` command-line flag can be used for a limited time to restore the previous implementation based on BrowserPlugin. That implementation will be deleted starting with the 3897 branch update. Known issues: - ExecuteJavaScript calls on the frame hosting the PDF extension will not be routed to the mime handler renderer process. - The PDF extension will not load successfully if blocked by ChromePluginPlaceholder and then manually continued via the "Run this plugin" context menu option (see https://crbug.com/533069#c41).
2020-01-23 22:58:01 +01:00
+ void WillDestroy() override;
2017-02-10 23:44:11 +01:00
// WebContentsDelegate implementation.
content::WebContents* OpenURLFromTab(
diff --git extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest_delegate.h extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest_delegate.h
Add support for MimeHandlerViewInCrossProcessFrame (fixes issue #2727) The PDF loading documentation in extension_system.cc has be updated to describe the new code paths. To support delivery of input events to the mime handler renderer process it is now necessary to route events via the correct RWHV interface. For Aura-based platforms (Windows/Linux) this means RWHVAura::On*Event and for macOS this means RWHVMac::RouteOrProcess*Event. Since Aura uses UI event types these have become the source of truth on Aura-based platforms with conversion to Web event types when needed (primarily for OSR). This change also adds a timeout for CefProcessHostMsg_GetNewBrowserInfo to avoid a hung renderer process if the guest WebContents route is not registered via CefMimeHandlerViewGuestDelegate::OnGuestDetached as expected prior to CefBrowserInfoManager::OnGetNewBrowserInfo being called. This timeout can be disabled for testing purposes by passing the `--disable-new-browser-info-timeout` command-line flag. The `--disable-features=MimeHandlerViewInCrossProcessFrame` command-line flag can be used for a limited time to restore the previous implementation based on BrowserPlugin. That implementation will be deleted starting with the 3897 branch update. Known issues: - ExecuteJavaScript calls on the frame hosting the PDF extension will not be routed to the mime handler renderer process. - The PDF extension will not load successfully if blocked by ChromePluginPlaceholder and then manually continued via the "Run this plugin" context menu option (see https://crbug.com/533069#c41).
2020-01-23 22:58:01 +01:00
index 98689e261460..a1b08274f455 100644
2017-02-10 23:44:11 +01:00
--- extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest_delegate.h
+++ extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest_delegate.h
@@ -8,9 +8,9 @@
#include <string>
2017-02-10 23:44:11 +01:00
#include "base/macros.h"
+#include "content/public/browser/web_contents.h"
namespace content {
-class WebContents;
struct ContextMenuParams;
} // namespace content
@@ -22,6 +22,14 @@ class MimeHandlerViewGuestDelegate {
2017-02-10 23:44:11 +01:00
MimeHandlerViewGuestDelegate() {}
virtual ~MimeHandlerViewGuestDelegate() {}
2017-02-10 23:44:11 +01:00
+ // Provides an opportunity to supply a custom view implementation.
+ virtual void OverrideWebContentsCreateParams(
+ content::WebContents::CreateParams* params) {}
+
+ // Called when a guest is attached or detached.
Add support for MimeHandlerViewInCrossProcessFrame (fixes issue #2727) The PDF loading documentation in extension_system.cc has be updated to describe the new code paths. To support delivery of input events to the mime handler renderer process it is now necessary to route events via the correct RWHV interface. For Aura-based platforms (Windows/Linux) this means RWHVAura::On*Event and for macOS this means RWHVMac::RouteOrProcess*Event. Since Aura uses UI event types these have become the source of truth on Aura-based platforms with conversion to Web event types when needed (primarily for OSR). This change also adds a timeout for CefProcessHostMsg_GetNewBrowserInfo to avoid a hung renderer process if the guest WebContents route is not registered via CefMimeHandlerViewGuestDelegate::OnGuestDetached as expected prior to CefBrowserInfoManager::OnGetNewBrowserInfo being called. This timeout can be disabled for testing purposes by passing the `--disable-new-browser-info-timeout` command-line flag. The `--disable-features=MimeHandlerViewInCrossProcessFrame` command-line flag can be used for a limited time to restore the previous implementation based on BrowserPlugin. That implementation will be deleted starting with the 3897 branch update. Known issues: - ExecuteJavaScript calls on the frame hosting the PDF extension will not be routed to the mime handler renderer process. - The PDF extension will not load successfully if blocked by ChromePluginPlaceholder and then manually continued via the "Run this plugin" context menu option (see https://crbug.com/533069#c41).
2020-01-23 22:58:01 +01:00
+ virtual void OnGuestAttached() {}
+ virtual void OnGuestDetached() {}
+
2017-02-10 23:44:11 +01:00
// Handles context menu, or returns false if unhandled.
virtual bool HandleContextMenu(content::WebContents* web_contents,
const content::ContextMenuParams& params);