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-04-26 21:55:59 +02:00
|
|
|
index 95cd290b601a3..89e8ab892e5ea 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-06-26 12:13:38 +02:00
|
|
|
index 438276b719c2f..69635e429be78 100644
|
2019-05-01 21:09:59 +02:00
|
|
|
--- chrome/browser/plugins/plugin_utils.cc
|
|
|
|
+++ chrome/browser/plugins/plugin_utils.cc
|
2023-06-26 12:13:38 +02:00
|
|
|
@@ -68,6 +68,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)) {
|
2023-06-26 12:13:38 +02:00
|
|
|
@@ -78,9 +85,6 @@ PluginUtils::GetMimeTypeToExtensionIdMap(
|
2023-01-05 19:55:00 +01:00
|
|
|
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-07-21 00:11:34 +02:00
|
|
|
index 51e79ffb4cf1c..7b101f5ee4d56 100644
|
2017-12-07 22:44:24 +01:00
|
|
|
--- chrome/renderer/chrome_content_renderer_client.cc
|
|
|
|
+++ chrome/renderer/chrome_content_renderer_client.cc
|
2023-07-21 00:11:34 +02:00
|
|
|
@@ -970,6 +970,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-07-21 00:11:34 +02:00
|
|
|
@@ -1132,7 +1133,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-07-21 00:11:34 +02:00
|
|
|
@@ -1141,7 +1143,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-07-21 00:11:34 +02:00
|
|
|
@@ -1151,7 +1154,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-05-30 10:55:32 +02:00
|
|
|
index 2e47c128f4d5c..c27d76a8227f9 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-05-30 10:55:32 +02:00
|
|
|
@@ -81,6 +81,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-05-30 10:55:32 +02:00
|
|
|
index 7f3083029d45e..94a5cbed96a10 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-05-30 10:55:32 +02:00
|
|
|
@@ -80,6 +82,8 @@ class BrowserPluginGuest : public WebContentsObserver {
|
2022-09-26 21:30:45 +02:00
|
|
|
|
2023-05-30 10:55:32 +02:00
|
|
|
// May be null during guest destruction.
|
|
|
|
const base::WeakPtr<BrowserPluginGuestDelegate> delegate_;
|
2022-09-26 21:30:45 +02:00
|
|
|
+
|
|
|
|
+ raw_ptr<WebContentsImpl> owner_web_contents_ = nullptr;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace content
|