mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2024-12-13 01:56:20 +01:00
c7ea0c5958
- Mac: 10.13 is now the minimum required macOS version
98 lines
4.1 KiB
Diff
98 lines
4.1 KiB
Diff
diff --git content/browser/web_contents/web_contents_view.h content/browser/web_contents/web_contents_view.h
|
|
index 17f203b11ce39..0a5277b686d61 100644
|
|
--- content/browser/web_contents/web_contents_view.h
|
|
+++ content/browser/web_contents/web_contents_view.h
|
|
@@ -25,7 +25,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() = default;
|
|
|
|
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
|
|
index aef9d1a79fcea..015206dd88756 100644
|
|
--- extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc
|
|
+++ extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc
|
|
@@ -224,6 +224,8 @@ void MimeHandlerViewGuest::CreateWebContents(
|
|
WebContents::CreateParams params(browser_context(),
|
|
guest_site_instance.get());
|
|
params.guest_delegate = this;
|
|
+ if (delegate_)
|
|
+ delegate_->OverrideWebContentsCreateParams(¶ms);
|
|
// TODO(erikchen): Fix ownership semantics for guest views.
|
|
// https://crbug.com/832879.
|
|
std::move(callback).Run(
|
|
@@ -234,6 +236,10 @@ void MimeHandlerViewGuest::CreateWebContents(
|
|
}
|
|
|
|
void MimeHandlerViewGuest::DidAttachToEmbedder() {
|
|
+ is_guest_attached_ = true;
|
|
+ if (delegate_)
|
|
+ delegate_->OnGuestAttached();
|
|
+
|
|
DCHECK(stream_->handler_url().SchemeIs(extensions::kExtensionScheme));
|
|
web_contents()->GetController().LoadURL(
|
|
stream_->handler_url(), content::Referrer(),
|
|
@@ -264,6 +270,11 @@ bool MimeHandlerViewGuest::ShouldDestroyOnDetach() const {
|
|
return true;
|
|
}
|
|
|
|
+void MimeHandlerViewGuest::WillDestroy() {
|
|
+ if (is_guest_attached_ && delegate_)
|
|
+ delegate_->OnGuestDetached();
|
|
+}
|
|
+
|
|
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
|
|
index ef6faf317dd41..8675c305d489c 100644
|
|
--- extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h
|
|
+++ extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h
|
|
@@ -143,6 +143,7 @@ class MimeHandlerViewGuest
|
|
void EmbedderFullscreenToggled(bool entered_fullscreen) final;
|
|
bool ZoomPropagatesFromEmbedderToGuest() const final;
|
|
bool ShouldDestroyOnDetach() const final;
|
|
+ void WillDestroy() override;
|
|
|
|
// WebContentsDelegate implementation.
|
|
content::WebContents* OpenURLFromTab(
|
|
@@ -200,6 +201,7 @@ class MimeHandlerViewGuest
|
|
content::ChildProcessHost::kInvalidUniqueID, MSG_ROUTING_NONE};
|
|
int embedder_widget_routing_id_ = MSG_ROUTING_NONE;
|
|
|
|
+ bool is_guest_attached_ = false;
|
|
bool is_guest_fullscreen_ = false;
|
|
bool is_embedder_fullscreen_ = false;
|
|
bool plugin_can_save_ = false;
|
|
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
|
|
index d97b054a8d6c7..9fd96a8f7826d 100644
|
|
--- 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
|
|
@@ -7,6 +7,8 @@
|
|
|
|
#include <string>
|
|
|
|
+#include "content/public/browser/web_contents.h"
|
|
+
|
|
namespace content {
|
|
class RenderFrameHost;
|
|
struct ContextMenuParams;
|
|
@@ -25,6 +27,14 @@ class MimeHandlerViewGuestDelegate {
|
|
|
|
virtual ~MimeHandlerViewGuestDelegate() {}
|
|
|
|
+ // Provides an opportunity to supply a custom view implementation.
|
|
+ virtual void OverrideWebContentsCreateParams(
|
|
+ content::WebContents::CreateParams* params) {}
|
|
+
|
|
+ // Called when a guest is attached or detached.
|
|
+ virtual void OnGuestAttached() {}
|
|
+ virtual void OnGuestDetached() {}
|
|
+
|
|
// Handles context menu, or returns false if unhandled.
|
|
//
|
|
// The `render_frame_host` represents the frame that requests the context menu
|