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
|
2021-11-10 22:57:31 +01:00
|
|
|
index 2cf61c44809a9..e6948ab525700 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
|
2018-10-02 14:14:11 +02:00
|
|
|
@@ -18,6 +18,7 @@
|
2021-11-10 22:57:31 +01:00
|
|
|
#include "base/task/task_runner_util.h"
|
2019-10-01 15:55:16 +02:00
|
|
|
#include "build/branding_buildflags.h"
|
2017-12-07 22:44:24 +01:00
|
|
|
#include "build/build_config.h"
|
2020-09-25 03:40:47 +02:00
|
|
|
+#include "cef/libcef/features/runtime.h"
|
2017-12-07 22:44:24 +01:00
|
|
|
#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"
|
2021-11-10 22:57:31 +01:00
|
|
|
@@ -53,6 +54,10 @@
|
2018-02-15 01:12:09 +01:00
|
|
|
#include "url/gurl.h"
|
2017-12-07 22:44:24 +01:00
|
|
|
#include "url/origin.h"
|
|
|
|
|
|
|
|
+#if BUILDFLAG(ENABLE_CEF)
|
|
|
|
+#include "cef/libcef/common/extensions/extensions_util.h"
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
#if BUILDFLAG(ENABLE_EXTENSIONS)
|
|
|
|
#include "components/guest_view/browser/guest_view_base.h"
|
|
|
|
#include "extensions/browser/extension_registry.h"
|
2021-11-10 22:57:31 +01:00
|
|
|
@@ -102,6 +107,9 @@ bool IsPluginLoadingAccessibleResourceInWebView(
|
2017-12-07 22:44:24 +01:00
|
|
|
extensions::ExtensionRegistry* extension_registry,
|
|
|
|
int process_id,
|
|
|
|
const GURL& resource) {
|
|
|
|
+ if (!extension_registry)
|
|
|
|
+ return false;
|
|
|
|
+
|
|
|
|
extensions::WebViewRendererState* renderer_state =
|
|
|
|
extensions::WebViewRendererState::GetInstance();
|
|
|
|
std::string partition_id;
|
2021-11-10 22:57:31 +01:00
|
|
|
@@ -130,14 +138,18 @@ bool IsPluginLoadingAccessibleResourceInWebView(
|
2019-10-01 15:55:16 +02:00
|
|
|
|
2017-12-07 22:44:24 +01:00
|
|
|
PluginInfoHostImpl::Context::Context(int render_process_id, Profile* profile)
|
|
|
|
: render_process_id_(render_process_id),
|
|
|
|
-#if BUILDFLAG(ENABLE_EXTENSIONS)
|
|
|
|
- extension_registry_(extensions::ExtensionRegistry::Get(profile)),
|
|
|
|
-#endif
|
|
|
|
host_content_settings_map_(
|
|
|
|
HostContentSettingsMapFactory::GetForProfile(profile)),
|
|
|
|
plugin_prefs_(PluginPrefs::GetForProfile(profile)) {
|
2021-04-21 00:52:34 +02:00
|
|
|
allow_outdated_plugins_.Init(prefs::kPluginsAllowOutdated,
|
2019-10-01 15:55:16 +02:00
|
|
|
profile->GetPrefs());
|
|
|
|
+
|
2017-12-07 22:44:24 +01:00
|
|
|
+#if BUILDFLAG(ENABLE_EXTENSIONS)
|
|
|
|
+#if BUILDFLAG(ENABLE_CEF)
|
2020-09-25 03:40:47 +02:00
|
|
|
+ if (!cef::IsAlloyRuntimeEnabled() || extensions::ExtensionsEnabled())
|
2017-12-07 22:44:24 +01:00
|
|
|
+#endif
|
|
|
|
+ extension_registry_ = extensions::ExtensionRegistry::Get(profile);
|
|
|
|
+#endif
|
2019-10-01 15:55:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
PluginInfoHostImpl::Context::~Context() {}
|
2019-05-01 21:09:59 +02:00
|
|
|
diff --git chrome/browser/plugins/plugin_utils.cc chrome/browser/plugins/plugin_utils.cc
|
2021-11-10 22:57:31 +01:00
|
|
|
index 7999b960694ab..5c1848a0afadf 100644
|
2019-05-01 21:09:59 +02:00
|
|
|
--- 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"
|
2020-07-01 02:57:00 +02:00
|
|
|
+#include "cef/libcef/features/runtime.h"
|
2021-04-21 00:52:34 +02:00
|
|
|
#include "chrome/browser/profiles/profile.h"
|
2019-05-01 21:09:59 +02:00
|
|
|
#include "components/content_settings/core/browser/host_content_settings_map.h"
|
2021-11-10 22:57:31 +01:00
|
|
|
#include "components/content_settings/core/common/content_settings_types.h"
|
|
|
|
@@ -14,6 +15,10 @@
|
2019-05-01 21:09:59 +02:00
|
|
|
#include "url/gurl.h"
|
|
|
|
#include "url/origin.h"
|
|
|
|
|
|
|
|
+#if BUILDFLAG(ENABLE_CEF)
|
|
|
|
+#include "cef/libcef/common/extensions/extensions_util.h"
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
#if BUILDFLAG(ENABLE_EXTENSIONS)
|
2019-09-04 17:13:32 +02:00
|
|
|
#include "chrome/common/pref_names.h"
|
|
|
|
#include "components/prefs/pref_service.h"
|
2021-11-10 22:57:31 +01:00
|
|
|
@@ -69,6 +74,12 @@ base::flat_map<std::string, std::string>
|
2019-10-07 10:22:46 +02:00
|
|
|
PluginUtils::GetMimeTypeToExtensionIdMap(
|
|
|
|
content::BrowserContext* browser_context) {
|
|
|
|
base::flat_map<std::string, std::string> mime_type_to_extension_id_map;
|
|
|
|
+
|
|
|
|
+#if BUILDFLAG(ENABLE_CEF)
|
2020-07-01 02:57:00 +02:00
|
|
|
+ if (cef::IsAlloyRuntimeEnabled() && !extensions::ExtensionsEnabled())
|
2019-10-07 10:22:46 +02:00
|
|
|
+ return mime_type_to_extension_id_map;
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
#if BUILDFLAG(ENABLE_EXTENSIONS)
|
|
|
|
Profile* profile = Profile::FromBrowserContext(browser_context);
|
2020-08-29 00:39:23 +02:00
|
|
|
const std::vector<std::string>& allowlist =
|
2019-10-07 10:22:46 +02:00
|
|
|
diff --git chrome/common/google_url_loader_throttle.cc chrome/common/google_url_loader_throttle.cc
|
2021-08-20 01:40:49 +02:00
|
|
|
index 8c2547056ec26..2ab3252dca708 100644
|
2019-10-07 10:22:46 +02:00
|
|
|
--- chrome/common/google_url_loader_throttle.cc
|
|
|
|
+++ chrome/common/google_url_loader_throttle.cc
|
2021-01-28 00:13:12 +01:00
|
|
|
@@ -7,6 +7,7 @@
|
2020-07-08 19:23:29 +02:00
|
|
|
#include "base/feature_list.h"
|
|
|
|
#include "base/metrics/histogram_functions.h"
|
2020-03-30 22:13:42 +02:00
|
|
|
#include "build/build_config.h"
|
2020-07-08 19:23:29 +02:00
|
|
|
+#include "cef/libcef/features/runtime.h"
|
|
|
|
#include "chrome/common/chrome_features.h"
|
2019-10-07 10:22:46 +02:00
|
|
|
#include "chrome/common/net/safe_search_util.h"
|
2020-03-30 22:13:42 +02:00
|
|
|
#include "components/google/core/common/google_util.h"
|
2021-08-20 01:40:49 +02:00
|
|
|
@@ -19,6 +20,10 @@
|
2021-03-04 23:36:57 +01:00
|
|
|
#include "ui/base/device_form_factor.h"
|
|
|
|
#endif
|
2019-10-07 10:22:46 +02:00
|
|
|
|
|
|
|
+#if BUILDFLAG(ENABLE_CEF)
|
|
|
|
+#include "cef/libcef/common/extensions/extensions_util.h"
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
#if BUILDFLAG(ENABLE_EXTENSIONS)
|
|
|
|
#include "extensions/common/extension_urls.h"
|
|
|
|
#endif
|
2021-08-20 01:40:49 +02:00
|
|
|
@@ -158,6 +163,11 @@ void GoogleURLLoaderThrottle::WillProcessResponse(
|
2019-10-07 10:22:46 +02:00
|
|
|
const GURL& response_url,
|
2020-02-10 18:10:17 +01:00
|
|
|
network::mojom::URLResponseHead* response_head,
|
2019-10-07 10:22:46 +02:00
|
|
|
bool* defer) {
|
|
|
|
+#if BUILDFLAG(ENABLE_CEF)
|
2020-07-08 19:23:29 +02:00
|
|
|
+ if (cef::IsAlloyRuntimeEnabled() && !extensions::ExtensionsEnabled())
|
2019-10-07 10:22:46 +02:00
|
|
|
+ return;
|
|
|
|
+#endif
|
|
|
|
+
|
2021-01-28 00:13:12 +01:00
|
|
|
// Built-in additional protection for the chrome web store origin by ensuring
|
|
|
|
// that the X-Frame-Options protection mechanism is set to either DENY or
|
|
|
|
// SAMEORIGIN.
|
2017-12-07 22:44:24 +01:00
|
|
|
diff --git chrome/renderer/chrome_content_renderer_client.cc chrome/renderer/chrome_content_renderer_client.cc
|
2021-12-16 23:35:54 +01:00
|
|
|
index 7c601387ea0ec..03b0f494dd7e9 100644
|
2017-12-07 22:44:24 +01:00
|
|
|
--- chrome/renderer/chrome_content_renderer_client.cc
|
|
|
|
+++ chrome/renderer/chrome_content_renderer_client.cc
|
2021-12-16 23:35:54 +01:00
|
|
|
@@ -937,6 +937,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;
|
2021-12-16 23:35:54 +01:00
|
|
|
@@ -1138,7 +1139,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: {
|
2021-12-16 23:35:54 +01:00
|
|
|
@@ -1147,7 +1149,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: {
|
2021-12-16 23:35:54 +01:00
|
|
|
@@ -1157,7 +1160,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;
|
|
|
|
}
|
|
|
|
case chrome::mojom::PluginStatus::kBlockedNoLoading: {
|
2021-12-16 23:35:54 +01:00
|
|
|
@@ -1165,7 +1169,8 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin(
|
2017-12-07 22:44:24 +01:00
|
|
|
IDR_BLOCKED_PLUGIN_HTML,
|
|
|
|
l10n_util::GetStringFUTF16(IDS_PLUGIN_BLOCKED_NO_LOADING,
|
|
|
|
group_name));
|
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
|
|
|
|
index f2f7e4228f134..e724b36143238 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;
|
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
|
2021-12-16 23:35:54 +01:00
|
|
|
index 8b87024388168..86a22f66e1cba 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
|
2021-12-16 23:35:54 +01:00
|
|
|
@@ -116,6 +116,8 @@ class BrowserPluginGuest : public GuestHost, public WebContentsObserver {
|
2021-01-28 00:13:12 +01:00
|
|
|
|
|
|
|
gfx::Point GetScreenCoordinates(const gfx::Point& relative_position) const;
|
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
|
|
|
+
|
|
|
|
protected:
|
|
|
|
// BrowserPluginGuest is a WebContentsObserver of |web_contents| and
|
|
|
|
// |web_contents| has to stay valid for the lifetime of BrowserPluginGuest.
|