164 lines
7.4 KiB
Diff
164 lines
7.4 KiB
Diff
diff --git chrome/browser/plugins/plugin_info_host_impl.cc chrome/browser/plugins/plugin_info_host_impl.cc
|
|
index 0ca794a57bed3..ce171b7a01a8c 100644
|
|
--- chrome/browser/plugins/plugin_info_host_impl.cc
|
|
+++ chrome/browser/plugins/plugin_info_host_impl.cc
|
|
@@ -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(
|
|
extensions::ExtensionRegistry* extension_registry,
|
|
int process_id,
|
|
const GURL& resource) {
|
|
+#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
|
+ // May be nullptr if using CEF Alloy with extensions disabled.
|
|
+ if (!extension_registry)
|
|
+ return false;
|
|
+#endif
|
|
+
|
|
extensions::WebViewRendererState* renderer_state =
|
|
extensions::WebViewRendererState::GetInstance();
|
|
std::string partition_id;
|
|
diff --git chrome/browser/plugins/plugin_utils.cc chrome/browser/plugins/plugin_utils.cc
|
|
index 00dd9a34cd3fb..89d4588bdbe4e 100644
|
|
--- chrome/browser/plugins/plugin_utils.cc
|
|
+++ chrome/browser/plugins/plugin_utils.cc
|
|
@@ -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.h"
|
|
@@ -69,6 +70,15 @@ PluginUtils::GetMimeTypeToExtensionIdMap(
|
|
content::BrowserContext* browser_context) {
|
|
base::flat_map<std::string, std::string> mime_type_to_extension_id_map;
|
|
#if BUILDFLAG(ENABLE_EXTENSIONS)
|
|
+#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
|
+ // May be nullptr if using CEF Alloy with extensions disabled.
|
|
+ extensions::ExtensionRegistry* registry =
|
|
+ extensions::ExtensionRegistry::Get(browser_context);
|
|
+ if (!registry) {
|
|
+ return mime_type_to_extension_id_map;
|
|
+ }
|
|
+#endif
|
|
+
|
|
Profile* profile = Profile::FromBrowserContext(browser_context);
|
|
if (extensions::ChromeContentBrowserClientExtensionsPart::
|
|
AreExtensionsDisabledForProfile(profile)) {
|
|
@@ -79,9 +89,11 @@ PluginUtils::GetMimeTypeToExtensionIdMap(
|
|
MimeTypesHandler::GetMIMETypeAllowlist();
|
|
// Go through the allowed extensions and try to use them to intercept
|
|
// the URL request.
|
|
+#if !BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
|
extensions::ExtensionRegistry* registry =
|
|
extensions::ExtensionRegistry::Get(browser_context);
|
|
DCHECK(registry);
|
|
+#endif
|
|
for (const std::string& extension_id : allowlist) {
|
|
const extensions::Extension* extension =
|
|
registry->enabled_extensions().GetByID(extension_id);
|
|
diff --git chrome/renderer/chrome_content_renderer_client.cc chrome/renderer/chrome_content_renderer_client.cc
|
|
index 60bc3751cb325..ebce071c74a8b 100644
|
|
--- chrome/renderer/chrome_content_renderer_client.cc
|
|
+++ chrome/renderer/chrome_content_renderer_client.cc
|
|
@@ -1006,6 +1006,7 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin(
|
|
|
|
if ((status == chrome::mojom::PluginStatus::kUnauthorized ||
|
|
status == chrome::mojom::PluginStatus::kBlocked) &&
|
|
+ content_settings_agent_delegate &&
|
|
content_settings_agent_delegate->IsPluginTemporarilyAllowed(
|
|
identifier)) {
|
|
status = chrome::mojom::PluginStatus::kAllowed;
|
|
@@ -1166,7 +1167,8 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin(
|
|
render_frame->GetRemoteAssociatedInterfaces()->GetInterface(
|
|
plugin_auth_host.BindNewEndpointAndPassReceiver());
|
|
plugin_auth_host->BlockedUnauthorizedPlugin(group_name, identifier);
|
|
- content_settings_agent->DidBlockContentType(content_type);
|
|
+ if (content_settings_agent)
|
|
+ content_settings_agent->DidBlockContentType(content_type);
|
|
break;
|
|
}
|
|
case chrome::mojom::PluginStatus::kBlocked: {
|
|
@@ -1175,7 +1177,8 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin(
|
|
l10n_util::GetStringFUTF16(IDS_PLUGIN_BLOCKED, group_name));
|
|
placeholder->AllowLoading();
|
|
RenderThread::Get()->RecordAction(UserMetricsAction("Plugin_Blocked"));
|
|
- content_settings_agent->DidBlockContentType(content_type);
|
|
+ if (content_settings_agent)
|
|
+ content_settings_agent->DidBlockContentType(content_type);
|
|
break;
|
|
}
|
|
case chrome::mojom::PluginStatus::kBlockedByPolicy: {
|
|
@@ -1185,7 +1188,8 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin(
|
|
group_name));
|
|
RenderThread::Get()->RecordAction(
|
|
UserMetricsAction("Plugin_BlockedByPolicy"));
|
|
- content_settings_agent->DidBlockContentType(content_type);
|
|
+ if (content_settings_agent)
|
|
+ content_settings_agent->DidBlockContentType(content_type);
|
|
break;
|
|
}
|
|
}
|
|
diff --git content/browser/browser_plugin/browser_plugin_embedder.h content/browser/browser_plugin/browser_plugin_embedder.h
|
|
index 8b26a93f7527e..17890bf20e481 100644
|
|
--- 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;
|
|
diff --git content/browser/browser_plugin/browser_plugin_guest.cc content/browser/browser_plugin/browser_plugin_guest.cc
|
|
index 1ce20a2a42705..7a3ef88ec689b 100644
|
|
--- content/browser/browser_plugin/browser_plugin_guest.cc
|
|
+++ content/browser/browser_plugin/browser_plugin_guest.cc
|
|
@@ -49,6 +49,8 @@ std::unique_ptr<WebContentsImpl> BrowserPluginGuest::CreateNewGuestWindow(
|
|
}
|
|
|
|
void BrowserPluginGuest::InitInternal(WebContentsImpl* owner_web_contents) {
|
|
+ owner_web_contents_ = owner_web_contents;
|
|
+
|
|
RenderWidgetHostImpl* rwhi =
|
|
GetWebContents()->GetPrimaryMainFrame()->GetRenderWidgetHost();
|
|
DCHECK(rwhi);
|
|
diff --git content/browser/browser_plugin/browser_plugin_guest.h content/browser/browser_plugin/browser_plugin_guest.h
|
|
index 7f3083029d45e..94a5cbed96a10 100644
|
|
--- content/browser/browser_plugin/browser_plugin_guest.h
|
|
+++ content/browser/browser_plugin/browser_plugin_guest.h
|
|
@@ -70,6 +70,8 @@ class BrowserPluginGuest : public WebContentsObserver {
|
|
WebContentsImpl* GetWebContents() const;
|
|
RenderFrameHostImpl* GetProspectiveOuterDocument();
|
|
|
|
+ WebContentsImpl* owner_web_contents() const { return owner_web_contents_; }
|
|
+
|
|
private:
|
|
// BrowserPluginGuest is a WebContentsObserver of |web_contents| and
|
|
// |web_contents| has to stay valid for the lifetime of BrowserPluginGuest.
|
|
@@ -80,6 +82,8 @@ class BrowserPluginGuest : public WebContentsObserver {
|
|
|
|
// May be null during guest destruction.
|
|
const base::WeakPtr<BrowserPluginGuestDelegate> delegate_;
|
|
+
|
|
+ raw_ptr<WebContentsImpl> owner_web_contents_ = nullptr;
|
|
};
|
|
|
|
} // namespace content
|