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
|
2020-03-30 22:13:42 +02:00
|
|
|
index c0cd19506973..956d80443c11 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
|
2019-04-16 16:38:48 +02:00
|
|
|
@@ -23,7 +23,7 @@ struct DropData;
|
2017-07-27 01:19:27 +02:00
|
|
|
// 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() {}
|
|
|
|
|
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
|
2020-03-04 01:29:39 +01:00
|
|
|
index 068b22336fac..a970f5be0428 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
|
2020-02-10 18:10:17 +01:00
|
|
|
@@ -207,6 +207,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(¶ms);
|
2018-05-18 12:45:18 +02:00
|
|
|
// TODO(erikchen): Fix ownership semantics for guest views.
|
|
|
|
// https://crbug.com/832879.
|
2018-07-02 19:11:49 +02:00
|
|
|
std::move(callback).Run(
|
2020-02-10 18:10:17 +01:00
|
|
|
@@ -217,6 +219,9 @@ void MimeHandlerViewGuest::CreateWebContents(
|
2017-02-10 23:44:11 +01:00
|
|
|
}
|
|
|
|
|
2020-01-23 22:58:01 +01:00
|
|
|
void MimeHandlerViewGuest::DidAttachToEmbedder() {
|
2017-02-10 23:44:11 +01:00
|
|
|
+ if (delegate_)
|
2020-01-23 22:58:01 +01:00
|
|
|
+ delegate_->OnGuestAttached();
|
2017-02-10 23:44:11 +01:00
|
|
|
+
|
2020-01-23 22:58:01 +01:00
|
|
|
web_contents()->GetController().LoadURL(
|
|
|
|
stream_->handler_url(), content::Referrer(),
|
|
|
|
ui::PAGE_TRANSITION_AUTO_TOPLEVEL, std::string());
|
2020-02-10 18:10:17 +01:00
|
|
|
@@ -246,6 +251,11 @@ bool MimeHandlerViewGuest::ShouldDestroyOnDetach() const {
|
2020-01-23 22:58:01 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
+void MimeHandlerViewGuest::WillDestroy() {
|
2017-02-10 23:44:11 +01:00
|
|
|
+ if (delegate_)
|
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
|
2020-02-10 18:10:17 +01:00
|
|
|
index 242db17f8f3b..80e9a5663588 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
|
2020-02-10 18:10:17 +01:00
|
|
|
@@ -130,6 +130,7 @@ class MimeHandlerViewGuest
|
2020-01-23 22:58:01 +01:00
|
|
|
void EmbedderFullscreenToggled(bool entered_fullscreen) final;
|
2017-02-10 23:44:11 +01:00
|
|
|
bool ZoomPropagatesFromEmbedderToGuest() const final;
|
2017-09-06 23:40:58 +02:00
|
|
|
bool ShouldDestroyOnDetach() const final;
|
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
|
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
|
2019-07-16 19:59:21 +02:00
|
|
|
@@ -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
|
|
|
|
|
2019-07-16 19:59:21 +02:00
|
|
|
@@ -22,6 +22,14 @@ class MimeHandlerViewGuestDelegate {
|
2017-02-10 23:44:11 +01:00
|
|
|
MimeHandlerViewGuestDelegate() {}
|
|
|
|
virtual ~MimeHandlerViewGuestDelegate() {}
|
2017-04-27 03:59:52 +02:00
|
|
|
|
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.
|
2020-01-23 22:58:01 +01:00
|
|
|
+ virtual void OnGuestAttached() {}
|
|
|
|
+ virtual void OnGuestDetached() {}
|
2017-04-27 03:59:52 +02:00
|
|
|
+
|
2017-02-10 23:44:11 +01:00
|
|
|
// Handles context menu, or returns false if unhandled.
|
|
|
|
virtual bool HandleContextMenu(content::WebContents* web_contents,
|
2017-04-27 03:59:52 +02:00
|
|
|
const content::ContextMenuParams& params);
|