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
|
2024-04-30 03:09:17 +02:00
|
|
|
index 2bb525046619c..200fc9c1f0067 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
|
2024-04-30 03:09:17 +02:00
|
|
|
@@ -16,6 +16,7 @@
|
|
|
|
#include "base/memory/singleton.h"
|
|
|
|
#include "build/branding_buildflags.h"
|
|
|
|
#include "build/build_config.h"
|
|
|
|
+#include "cef/libcef/features/features.h"
|
|
|
|
#include "chrome/browser/browser_process.h"
|
|
|
|
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
|
|
|
|
#include "chrome/browser/plugins/chrome_plugin_service_filter.h"
|
|
|
|
@@ -140,6 +141,12 @@ bool IsPluginLoadingAccessibleResourceInWebView(
|
2017-12-07 22:44:24 +01:00
|
|
|
extensions::ExtensionRegistry* extension_registry,
|
|
|
|
int process_id,
|
|
|
|
const GURL& resource) {
|
2024-04-30 03:09:17 +02:00
|
|
|
+#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
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;
|
2024-04-30 03:09:17 +02:00
|
|
|
+#endif
|
2017-12-07 22:44:24 +01:00
|
|
|
+
|
|
|
|
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
|
2024-04-30 03:09:17 +02:00
|
|
|
index 438276b719c2f..e97fa0eaf2d7a 100644
|
2019-05-01 21:09:59 +02:00
|
|
|
--- chrome/browser/plugins/plugin_utils.cc
|
|
|
|
+++ chrome/browser/plugins/plugin_utils.cc
|
2024-04-30 03:09:17 +02:00
|
|
|
@@ -5,6 +5,7 @@
|
|
|
|
#include "chrome/browser/plugins/plugin_utils.h"
|
|
|
|
|
|
|
|
#include "base/values.h"
|
|
|
|
+#include "cef/libcef/features/features.h"
|
|
|
|
#include "chrome/browser/profiles/profile.h"
|
|
|
|
#include "components/content_settings/core/browser/host_content_settings_map.h"
|
|
|
|
#include "components/content_settings/core/common/content_settings_types.h"
|
|
|
|
@@ -68,6 +69,15 @@ 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)
|
2024-04-30 03:09:17 +02:00
|
|
|
+#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
2023-01-05 19:55:00 +01:00
|
|
|
+ // 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
|
|
|
+ }
|
2024-04-30 03:09:17 +02:00
|
|
|
+#endif
|
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)) {
|
2024-04-30 03:09:17 +02:00
|
|
|
@@ -78,9 +88,11 @@ 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.
|
2024-04-30 03:09:17 +02:00
|
|
|
+#if !BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
|
|
|
extensions::ExtensionRegistry* registry =
|
|
|
|
extensions::ExtensionRegistry::Get(browser_context);
|
|
|
|
DCHECK(registry);
|
|
|
|
+#endif
|
2023-01-05 19:55:00 +01:00
|
|
|
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
|
2024-04-23 22:06:00 +02:00
|
|
|
index 620f0ebad27d3..f36f4a6c5d1ee 100644
|
2017-12-07 22:44:24 +01:00
|
|
|
--- chrome/renderer/chrome_content_renderer_client.cc
|
|
|
|
+++ chrome/renderer/chrome_content_renderer_client.cc
|
2024-04-23 22:06:00 +02:00
|
|
|
@@ -1007,6 +1007,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;
|
2024-04-23 22:06:00 +02:00
|
|
|
@@ -1167,7 +1168,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: {
|
2024-04-23 22:06:00 +02:00
|
|
|
@@ -1176,7 +1178,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: {
|
2024-04-23 22:06:00 +02:00
|
|
|
@@ -1186,7 +1189,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-12-06 21:16:15 +01:00
|
|
|
index 8b26a93f7527e..17890bf20e481 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-09-15 21:51:43 +02:00
|
|
|
index f94fcfcf562db..066c66f46b7ae 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-09-15 21:51:43 +02:00
|
|
|
@@ -49,6 +49,8 @@ std::unique_ptr<WebContentsImpl> BrowserPluginGuest::CreateNewGuestWindow(
|
2022-09-26 21:30:45 +02:00
|
|
|
}
|
|
|
|
|
2023-09-15 21:51:43 +02:00
|
|
|
void BrowserPluginGuest::InitInternal(WebContentsImpl* owner_web_contents) {
|
|
|
|
+ owner_web_contents_ = owner_web_contents;
|
|
|
|
+
|
|
|
|
RenderWidgetHostImpl* rwhi =
|
|
|
|
GetWebContents()->GetPrimaryMainFrame()->GetRenderWidgetHost();
|
|
|
|
DCHECK(rwhi);
|
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
|