• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1diff --git chrome/browser/plugins/plugin_info_host_impl.cc chrome/browser/plugins/plugin_info_host_impl.cc
2index 2cf61c44809a9..e6948ab525700 100644
3--- chrome/browser/plugins/plugin_info_host_impl.cc
4+++ chrome/browser/plugins/plugin_info_host_impl.cc
5@@ -18,6 +18,7 @@
6 #include "base/task/task_runner_util.h"
7 #include "build/branding_buildflags.h"
8 #include "build/build_config.h"
9+#include "cef/libcef/features/runtime.h"
10 #include "chrome/browser/browser_process.h"
11 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
12 #include "chrome/browser/plugins/chrome_plugin_service_filter.h"
13@@ -53,6 +54,10 @@
14 #include "url/gurl.h"
15 #include "url/origin.h"
16
17+#if BUILDFLAG(ENABLE_CEF)
18+#include "cef/libcef/common/extensions/extensions_util.h"
19+#endif
20+
21 #if BUILDFLAG(ENABLE_EXTENSIONS)
22 #include "components/guest_view/browser/guest_view_base.h"
23 #include "extensions/browser/extension_registry.h"
24@@ -102,6 +107,9 @@ bool IsPluginLoadingAccessibleResourceInWebView(
25     extensions::ExtensionRegistry* extension_registry,
26     int process_id,
27     const GURL& resource) {
28+  if (!extension_registry)
29+    return false;
30+
31   extensions::WebViewRendererState* renderer_state =
32       extensions::WebViewRendererState::GetInstance();
33   std::string partition_id;
34@@ -130,14 +138,18 @@ bool IsPluginLoadingAccessibleResourceInWebView(
35
36 PluginInfoHostImpl::Context::Context(int render_process_id, Profile* profile)
37     : render_process_id_(render_process_id),
38-#if BUILDFLAG(ENABLE_EXTENSIONS)
39-      extension_registry_(extensions::ExtensionRegistry::Get(profile)),
40-#endif
41       host_content_settings_map_(
42           HostContentSettingsMapFactory::GetForProfile(profile)),
43       plugin_prefs_(PluginPrefs::GetForProfile(profile)) {
44   allow_outdated_plugins_.Init(prefs::kPluginsAllowOutdated,
45                                profile->GetPrefs());
46+
47+#if BUILDFLAG(ENABLE_EXTENSIONS)
48+#if BUILDFLAG(ENABLE_CEF)
49+  if (!cef::IsAlloyRuntimeEnabled() || extensions::ExtensionsEnabled())
50+#endif
51+    extension_registry_ = extensions::ExtensionRegistry::Get(profile);
52+#endif
53 }
54
55 PluginInfoHostImpl::Context::~Context() {}
56diff --git chrome/browser/plugins/plugin_utils.cc chrome/browser/plugins/plugin_utils.cc
57index b594c68673c19..b0e3cd149f760 100644
58--- chrome/browser/plugins/plugin_utils.cc
59+++ chrome/browser/plugins/plugin_utils.cc
60@@ -5,6 +5,7 @@
61 #include "chrome/browser/plugins/plugin_utils.h"
62
63 #include "base/values.h"
64+#include "cef/libcef/features/runtime.h"
65 #include "chrome/browser/profiles/profile.h"
66 #include "components/content_settings/core/browser/host_content_settings_map.h"
67 #include "components/content_settings/core/common/content_settings_types.h"
68@@ -14,6 +15,10 @@
69 #include "url/gurl.h"
70 #include "url/origin.h"
71
72+#if BUILDFLAG(ENABLE_CEF)
73+#include "cef/libcef/common/extensions/extensions_util.h"
74+#endif
75+
76 #if BUILDFLAG(ENABLE_EXTENSIONS)
77 #include "chrome/common/pref_names.h"
78 #include "components/prefs/pref_service.h"
79@@ -68,6 +73,12 @@ base::flat_map<std::string, std::string>
80 PluginUtils::GetMimeTypeToExtensionIdMap(
81     content::BrowserContext* browser_context) {
82   base::flat_map<std::string, std::string> mime_type_to_extension_id_map;
83+
84+#if BUILDFLAG(ENABLE_CEF)
85+  if (cef::IsAlloyRuntimeEnabled() && !extensions::ExtensionsEnabled())
86+    return mime_type_to_extension_id_map;
87+#endif
88+
89 #if BUILDFLAG(ENABLE_EXTENSIONS)
90   Profile* profile = Profile::FromBrowserContext(browser_context);
91   const std::vector<std::string>& allowlist =
92diff --git chrome/common/google_url_loader_throttle.cc chrome/common/google_url_loader_throttle.cc
93index 8b72897491669..546919dd70afc 100644
94--- chrome/common/google_url_loader_throttle.cc
95+++ chrome/common/google_url_loader_throttle.cc
96@@ -7,6 +7,7 @@
97 #include "base/feature_list.h"
98 #include "base/metrics/histogram_functions.h"
99 #include "build/build_config.h"
100+#include "cef/libcef/features/runtime.h"
101 #include "chrome/common/chrome_features.h"
102 #include "chrome/common/net/safe_search_util.h"
103 #include "components/google/core/common/google_util.h"
104@@ -19,6 +20,10 @@
105 #include "ui/base/device_form_factor.h"
106 #endif
107
108+#if BUILDFLAG(ENABLE_CEF)
109+#include "cef/libcef/common/extensions/extensions_util.h"
110+#endif
111+
112 #if BUILDFLAG(ENABLE_EXTENSIONS)
113 #include "extensions/common/extension_urls.h"
114 #endif
115@@ -158,6 +163,11 @@ void GoogleURLLoaderThrottle::WillProcessResponse(
116     const GURL& response_url,
117     network::mojom::URLResponseHead* response_head,
118     bool* defer) {
119+#if BUILDFLAG(ENABLE_CEF)
120+  if (cef::IsAlloyRuntimeEnabled() && !extensions::ExtensionsEnabled())
121+    return;
122+#endif
123+
124   // Built-in additional protection for the chrome web store origin by ensuring
125   // that the X-Frame-Options protection mechanism is set to either DENY or
126   // SAMEORIGIN.
127diff --git chrome/renderer/chrome_content_renderer_client.cc chrome/renderer/chrome_content_renderer_client.cc
128index 034a223e5803f..98e7c82671f5c 100644
129--- chrome/renderer/chrome_content_renderer_client.cc
130+++ chrome/renderer/chrome_content_renderer_client.cc
131@@ -940,6 +940,7 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin(
132
133     if ((status == chrome::mojom::PluginStatus::kUnauthorized ||
134          status == chrome::mojom::PluginStatus::kBlocked) &&
135+        content_settings_agent_delegate &&
136         content_settings_agent_delegate->IsPluginTemporarilyAllowed(
137             identifier)) {
138       status = chrome::mojom::PluginStatus::kAllowed;
139@@ -1141,7 +1142,8 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin(
140         render_frame->GetRemoteAssociatedInterfaces()->GetInterface(
141             plugin_auth_host.BindNewEndpointAndPassReceiver());
142         plugin_auth_host->BlockedUnauthorizedPlugin(group_name, identifier);
143-        content_settings_agent->DidBlockContentType(content_type);
144+        if (content_settings_agent)
145+          content_settings_agent->DidBlockContentType(content_type);
146         break;
147       }
148       case chrome::mojom::PluginStatus::kBlocked: {
149@@ -1150,7 +1152,8 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin(
150             l10n_util::GetStringFUTF16(IDS_PLUGIN_BLOCKED, group_name));
151         placeholder->AllowLoading();
152         RenderThread::Get()->RecordAction(UserMetricsAction("Plugin_Blocked"));
153-        content_settings_agent->DidBlockContentType(content_type);
154+        if (content_settings_agent)
155+          content_settings_agent->DidBlockContentType(content_type);
156         break;
157       }
158       case chrome::mojom::PluginStatus::kBlockedByPolicy: {
159@@ -1160,7 +1163,8 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin(
160                                        group_name));
161         RenderThread::Get()->RecordAction(
162             UserMetricsAction("Plugin_BlockedByPolicy"));
163-        content_settings_agent->DidBlockContentType(content_type);
164+        if (content_settings_agent)
165+          content_settings_agent->DidBlockContentType(content_type);
166         break;
167       }
168       case chrome::mojom::PluginStatus::kBlockedNoLoading: {
169@@ -1168,7 +1172,8 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin(
170             IDR_BLOCKED_PLUGIN_HTML,
171             l10n_util::GetStringFUTF16(IDS_PLUGIN_BLOCKED_NO_LOADING,
172                                        group_name));
173-        content_settings_agent->DidBlockContentType(content_type);
174+        if (content_settings_agent)
175+          content_settings_agent->DidBlockContentType(content_type);
176         break;
177       }
178     }
179diff --git content/browser/browser_plugin/browser_plugin_embedder.h content/browser/browser_plugin/browser_plugin_embedder.h
180index f2f7e4228f134..e724b36143238 100644
181--- content/browser/browser_plugin/browser_plugin_embedder.h
182+++ content/browser/browser_plugin/browser_plugin_embedder.h
183@@ -15,6 +15,7 @@
184 #define CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_EMBEDDER_H_
185
186 #include "base/memory/raw_ptr.h"
187+#include "content/common/content_export.h"
188
189 namespace content {
190
191@@ -26,7 +27,7 @@ struct NativeWebKeyboardEvent;
192
193 // TODO(wjmaclean): Get rid of "BrowserPlugin" in the name of this class.
194 // Perhaps "WebContentsEmbedderDelegate" would be better?
195-class BrowserPluginEmbedder {
196+class CONTENT_EXPORT BrowserPluginEmbedder {
197  public:
198   BrowserPluginEmbedder(const BrowserPluginEmbedder&) = delete;
199   BrowserPluginEmbedder& operator=(const BrowserPluginEmbedder&) = delete;
200diff --git content/browser/browser_plugin/browser_plugin_guest.h content/browser/browser_plugin/browser_plugin_guest.h
201index b58cdd14c9a58..927738fd22b80 100644
202--- content/browser/browser_plugin/browser_plugin_guest.h
203+++ content/browser/browser_plugin/browser_plugin_guest.h
204@@ -116,6 +116,8 @@ class BrowserPluginGuest : public GuestHost, public WebContentsObserver {
205
206   gfx::Point GetScreenCoordinates(const gfx::Point& relative_position) const;
207
208+  WebContentsImpl* owner_web_contents() const { return owner_web_contents_; }
209+
210  protected:
211   // BrowserPluginGuest is a WebContentsObserver of |web_contents| and
212   // |web_contents| has to stay valid for the lifetime of BrowserPluginGuest.
213