2017-12-07 22:44:24 +01:00
|
|
|
diff --git chrome/browser/plugins/plugin_info_host_impl.cc chrome/browser/plugins/plugin_info_host_impl.cc
|
2023-02-27 19:52:38 +01:00
|
|
|
index cb9253cf1ab6a..b46c6b92a30ce 100644
|
2017-12-07 22:44:24 +01:00
|
|
|
--- chrome/browser/plugins/plugin_info_host_impl.cc
|
|
|
|
+++ chrome/browser/plugins/plugin_info_host_impl.cc
|
2023-02-27 19:52:38 +01:00
|
|
|
@@ -140,6 +140,10 @@ bool IsPluginLoadingAccessibleResourceInWebView(
|
2017-12-07 22:44:24 +01:00
|
|
|
extensions::ExtensionRegistry* extension_registry,
|
|
|
|
int process_id,
|
|
|
|
const GURL& resource) {
|
2023-01-05 19:55:00 +01:00
|
|
|
+ // May be nullptr if using CEF Alloy with extensions disabled.
|
2017-12-07 22:44:24 +01:00
|
|
|
+ if (!extension_registry)
|
|
|
|
+ return false;
|
|
|
|
+
|
|
|
|
extensions::WebViewRendererState* renderer_state =
|
|
|
|
extensions::WebViewRendererState::GetInstance();
|
|
|
|
std::string partition_id;
|
2019-05-01 21:09:59 +02:00
|
|
|
diff --git chrome/browser/plugins/plugin_utils.cc chrome/browser/plugins/plugin_utils.cc
|
2023-01-05 19:55:00 +01:00
|
|
|
index 8b3f569882aeb..afc8007a6228b 100644
|
2019-05-01 21:09:59 +02:00
|
|
|
--- chrome/browser/plugins/plugin_utils.cc
|
|
|
|
+++ chrome/browser/plugins/plugin_utils.cc
|
2023-01-05 19:55:00 +01:00
|
|
|
@@ -70,6 +70,13 @@ PluginUtils::GetMimeTypeToExtensionIdMap(
|
2019-10-07 10:22:46 +02:00
|
|
|
content::BrowserContext* browser_context) {
|
|
|
|
base::flat_map<std::string, std::string> mime_type_to_extension_id_map;
|
2023-01-05 19:55:00 +01:00
|
|
|
#if BUILDFLAG(ENABLE_EXTENSIONS)
|
|
|
|
+ // May be nullptr if using CEF Alloy with extensions disabled.
|
|
|
|
+ extensions::ExtensionRegistry* registry =
|
|
|
|
+ extensions::ExtensionRegistry::Get(browser_context);
|
|
|
|
+ if (!registry) {
|
2019-10-07 10:22:46 +02:00
|
|
|
+ return mime_type_to_extension_id_map;
|
2023-01-05 19:55:00 +01:00
|
|
|
+ }
|
2019-10-07 10:22:46 +02:00
|
|
|
+
|
|
|
|
Profile* profile = Profile::FromBrowserContext(browser_context);
|
2023-01-03 00:34:43 +01:00
|
|
|
if (extensions::ChromeContentBrowserClientExtensionsPart::
|
2023-01-05 19:55:00 +01:00
|
|
|
AreExtensionsDisabledForProfile(profile)) {
|
|
|
|
@@ -80,9 +87,6 @@ PluginUtils::GetMimeTypeToExtensionIdMap(
|
|
|
|
MimeTypesHandler::GetMIMETypeAllowlist();
|
|
|
|
// Go through the allowed extensions and try to use them to intercept
|
|
|
|
// the URL request.
|
|
|
|
- extensions::ExtensionRegistry* registry =
|
|
|
|
- extensions::ExtensionRegistry::Get(browser_context);
|
|
|
|
- DCHECK(registry);
|
|
|
|
for (const std::string& extension_id : allowlist) {
|
|
|
|
const extensions::Extension* extension =
|
|
|
|
registry->enabled_extensions().GetByID(extension_id);
|
2017-12-07 22:44:24 +01:00
|
|
|
diff --git chrome/renderer/chrome_content_renderer_client.cc chrome/renderer/chrome_content_renderer_client.cc
|
2023-04-04 20:00:13 +02:00
|
|
|
index 846a2ee1b05d0..b77a01012bbbb 100644
|
2017-12-07 22:44:24 +01:00
|
|
|
--- chrome/renderer/chrome_content_renderer_client.cc
|
|
|
|
+++ chrome/renderer/chrome_content_renderer_client.cc
|
2023-04-04 20:00:13 +02:00
|
|
|
@@ -1009,6 +1009,7 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin(
|
2017-12-07 22:44:24 +01:00
|
|
|
|
|
|
|
if ((status == chrome::mojom::PluginStatus::kUnauthorized ||
|
|
|
|
status == chrome::mojom::PluginStatus::kBlocked) &&
|
2020-06-09 19:48:00 +02:00
|
|
|
+ content_settings_agent_delegate &&
|
|
|
|
content_settings_agent_delegate->IsPluginTemporarilyAllowed(
|
|
|
|
identifier)) {
|
2017-12-07 22:44:24 +01:00
|
|
|
status = chrome::mojom::PluginStatus::kAllowed;
|
2023-04-04 20:00:13 +02:00
|
|
|
@@ -1176,7 +1177,8 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin(
|
2017-12-07 22:44:24 +01:00
|
|
|
render_frame->GetRemoteAssociatedInterfaces()->GetInterface(
|
2019-11-12 17:11:44 +01:00
|
|
|
plugin_auth_host.BindNewEndpointAndPassReceiver());
|
2017-12-07 22:44:24 +01:00
|
|
|
plugin_auth_host->BlockedUnauthorizedPlugin(group_name, identifier);
|
2020-02-10 18:10:17 +01:00
|
|
|
- content_settings_agent->DidBlockContentType(content_type);
|
|
|
|
+ if (content_settings_agent)
|
|
|
|
+ content_settings_agent->DidBlockContentType(content_type);
|
2017-12-07 22:44:24 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case chrome::mojom::PluginStatus::kBlocked: {
|
2023-04-04 20:00:13 +02:00
|
|
|
@@ -1185,7 +1187,8 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin(
|
2017-12-07 22:44:24 +01:00
|
|
|
l10n_util::GetStringFUTF16(IDS_PLUGIN_BLOCKED, group_name));
|
|
|
|
placeholder->AllowLoading();
|
|
|
|
RenderThread::Get()->RecordAction(UserMetricsAction("Plugin_Blocked"));
|
2020-02-10 18:10:17 +01:00
|
|
|
- content_settings_agent->DidBlockContentType(content_type);
|
|
|
|
+ if (content_settings_agent)
|
|
|
|
+ content_settings_agent->DidBlockContentType(content_type);
|
2017-12-07 22:44:24 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case chrome::mojom::PluginStatus::kBlockedByPolicy: {
|
2023-04-04 20:00:13 +02:00
|
|
|
@@ -1195,7 +1198,8 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin(
|
2017-12-07 22:44:24 +01:00
|
|
|
group_name));
|
|
|
|
RenderThread::Get()->RecordAction(
|
|
|
|
UserMetricsAction("Plugin_BlockedByPolicy"));
|
2020-02-10 18:10:17 +01:00
|
|
|
- content_settings_agent->DidBlockContentType(content_type);
|
|
|
|
+ if (content_settings_agent)
|
|
|
|
+ content_settings_agent->DidBlockContentType(content_type);
|
2017-12-07 22:44:24 +01:00
|
|
|
break;
|
|
|
|
}
|
2021-03-04 23:36:57 +01:00
|
|
|
}
|
2021-12-16 23:35:54 +01:00
|
|
|
diff --git content/browser/browser_plugin/browser_plugin_embedder.h content/browser/browser_plugin/browser_plugin_embedder.h
|
2023-01-03 00:34:43 +01:00
|
|
|
index ad5f1925735fd..a871f4a7792a7 100644
|
2021-12-16 23:35:54 +01:00
|
|
|
--- content/browser/browser_plugin/browser_plugin_embedder.h
|
|
|
|
+++ content/browser/browser_plugin/browser_plugin_embedder.h
|
|
|
|
@@ -15,6 +15,7 @@
|
|
|
|
#define CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_EMBEDDER_H_
|
|
|
|
|
|
|
|
#include "base/memory/raw_ptr.h"
|
|
|
|
+#include "content/common/content_export.h"
|
|
|
|
|
|
|
|
namespace content {
|
|
|
|
|
|
|
|
@@ -26,7 +27,7 @@ struct NativeWebKeyboardEvent;
|
|
|
|
|
|
|
|
// TODO(wjmaclean): Get rid of "BrowserPlugin" in the name of this class.
|
|
|
|
// Perhaps "WebContentsEmbedderDelegate" would be better?
|
|
|
|
-class BrowserPluginEmbedder {
|
|
|
|
+class CONTENT_EXPORT BrowserPluginEmbedder {
|
|
|
|
public:
|
|
|
|
BrowserPluginEmbedder(const BrowserPluginEmbedder&) = delete;
|
|
|
|
BrowserPluginEmbedder& operator=(const BrowserPluginEmbedder&) = delete;
|
2022-09-26 21:30:45 +02:00
|
|
|
diff --git content/browser/browser_plugin/browser_plugin_guest.cc content/browser/browser_plugin/browser_plugin_guest.cc
|
2023-02-27 19:52:38 +01:00
|
|
|
index a7501a57c5149..1c148767f67a6 100644
|
2022-09-26 21:30:45 +02:00
|
|
|
--- content/browser/browser_plugin/browser_plugin_guest.cc
|
|
|
|
+++ content/browser/browser_plugin/browser_plugin_guest.cc
|
2023-01-03 00:34:43 +01:00
|
|
|
@@ -80,6 +80,8 @@ void BrowserPluginGuest::InitInternal(WebContentsImpl* owner_web_contents) {
|
2022-09-26 21:30:45 +02:00
|
|
|
GetWebContents()->GetOrCreateWebPreferences();
|
|
|
|
prefs.navigate_on_drag_drop = false;
|
|
|
|
GetWebContents()->SetWebPreferences(prefs);
|
|
|
|
+
|
|
|
|
+ owner_web_contents_ = owner_web_contents;
|
|
|
|
}
|
|
|
|
|
|
|
|
BrowserPluginGuest::~BrowserPluginGuest() = default;
|
2020-08-29 00:39:23 +02:00
|
|
|
diff --git content/browser/browser_plugin/browser_plugin_guest.h content/browser/browser_plugin/browser_plugin_guest.h
|
2023-02-27 19:52:38 +01:00
|
|
|
index 17e98b60e8f7e..41f05cdd88d40 100644
|
2020-08-29 00:39:23 +02:00
|
|
|
--- content/browser/browser_plugin/browser_plugin_guest.h
|
|
|
|
+++ content/browser/browser_plugin/browser_plugin_guest.h
|
2023-02-27 19:52:38 +01:00
|
|
|
@@ -70,6 +70,8 @@ class BrowserPluginGuest : public WebContentsObserver {
|
2022-09-26 21:30:45 +02:00
|
|
|
WebContentsImpl* GetWebContents() const;
|
2023-02-27 19:52:38 +01:00
|
|
|
RenderFrameHostImpl* GetProspectiveOuterDocument();
|
2020-08-29 00:39:23 +02:00
|
|
|
|
2020-10-08 21:54:42 +02:00
|
|
|
+ WebContentsImpl* owner_web_contents() const { return owner_web_contents_; }
|
2020-08-29 00:39:23 +02:00
|
|
|
+
|
2022-09-26 21:30:45 +02:00
|
|
|
private:
|
2020-08-29 00:39:23 +02:00
|
|
|
// BrowserPluginGuest is a WebContentsObserver of |web_contents| and
|
|
|
|
// |web_contents| has to stay valid for the lifetime of BrowserPluginGuest.
|
2023-02-27 19:52:38 +01:00
|
|
|
@@ -79,6 +81,8 @@ class BrowserPluginGuest : public WebContentsObserver {
|
2022-09-26 21:30:45 +02:00
|
|
|
void InitInternal(WebContentsImpl* owner_web_contents);
|
|
|
|
|
2022-11-15 18:50:53 +01:00
|
|
|
const raw_ptr<BrowserPluginGuestDelegate, DanglingUntriaged> delegate_;
|
2022-09-26 21:30:45 +02:00
|
|
|
+
|
|
|
|
+ raw_ptr<WebContentsImpl> owner_web_contents_ = nullptr;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace content
|