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
|
2020-08-29 00:39:23 +02:00
|
|
|
index d789ee040ac5..58b45d5a56f2 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 @@
|
2017-12-07 22:44:24 +01:00
|
|
|
#include "base/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"
|
|
|
|
+#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"
|
2020-02-10 18:10:17 +01:00
|
|
|
@@ -54,6 +55,11 @@
|
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/browser/plugins/plugin_service_filter.h"
|
|
|
|
+#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"
|
2020-02-10 18:10:17 +01:00
|
|
|
@@ -100,6 +106,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;
|
2020-02-10 18:10:17 +01:00
|
|
|
@@ -128,9 +137,6 @@ 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)) {
|
2020-02-10 18:10:17 +01:00
|
|
|
@@ -138,6 +144,13 @@ PluginInfoHostImpl::Context::Context(int render_process_id, Profile* profile)
|
2019-10-01 15:55:16 +02:00
|
|
|
profile->GetPrefs());
|
|
|
|
run_all_flash_in_allow_mode_.Init(prefs::kRunAllFlashInAllowMode,
|
|
|
|
profile->GetPrefs());
|
|
|
|
+
|
2017-12-07 22:44:24 +01:00
|
|
|
+#if BUILDFLAG(ENABLE_EXTENSIONS)
|
|
|
|
+#if BUILDFLAG(ENABLE_CEF)
|
|
|
|
+ if (extensions::ExtensionsEnabled())
|
|
|
|
+#endif
|
|
|
|
+ extension_registry_ = extensions::ExtensionRegistry::Get(profile);
|
|
|
|
+#endif
|
2019-10-01 15:55:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
PluginInfoHostImpl::Context::~Context() {}
|
2020-02-10 18:10:17 +01:00
|
|
|
@@ -208,6 +221,7 @@ void PluginInfoHostImpl::PluginsLoaded(
|
2018-02-12 22:22:51 +01:00
|
|
|
plugin_metadata->identifier(), &output->status);
|
|
|
|
}
|
|
|
|
|
|
|
|
+#if !BUILDFLAG(ENABLE_CEF)
|
|
|
|
if (output->status == chrome::mojom::PluginStatus::kNotFound) {
|
|
|
|
// Check to see if the component updater can fetch an implementation.
|
2019-10-01 15:55:16 +02:00
|
|
|
std::unique_ptr<component_updater::ComponentInfo> cus_plugin_info =
|
2020-02-10 18:10:17 +01:00
|
|
|
@@ -216,7 +230,9 @@ void PluginInfoHostImpl::PluginsLoaded(
|
2019-10-01 15:55:16 +02:00
|
|
|
ComponentPluginLookupDone(params, std::move(output), std::move(callback),
|
|
|
|
std::move(plugin_metadata),
|
|
|
|
std::move(cus_plugin_info));
|
2018-02-12 22:22:51 +01:00
|
|
|
- } else {
|
|
|
|
+ } else
|
|
|
|
+#endif // !BUILDFLAG(ENABLE_CEF)
|
|
|
|
+ {
|
|
|
|
GetPluginInfoFinish(params, std::move(output), std::move(callback),
|
|
|
|
std::move(plugin_metadata));
|
|
|
|
}
|
2020-02-10 18:10:17 +01:00
|
|
|
@@ -229,6 +245,14 @@ void PluginInfoHostImpl::Context::DecidePluginStatus(
|
2017-12-07 22:44:24 +01:00
|
|
|
PluginMetadata::SecurityStatus security_status,
|
|
|
|
const std::string& plugin_identifier,
|
|
|
|
chrome::mojom::PluginStatus* status) const {
|
|
|
|
+#if BUILDFLAG(ENABLE_CEF)
|
|
|
|
+ // Don't override the user decision.
|
|
|
|
+ if (*status == chrome::mojom::PluginStatus::kBlocked ||
|
|
|
|
+ *status == chrome::mojom::PluginStatus::kDisabled) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
if (security_status == PluginMetadata::SECURITY_STATUS_FULLY_TRUSTED) {
|
|
|
|
*status = chrome::mojom::PluginStatus::kAllowed;
|
|
|
|
return;
|
2020-02-10 18:10:17 +01:00
|
|
|
@@ -337,16 +361,35 @@ bool PluginInfoHostImpl::Context::FindEnabledPlugin(
|
2017-12-07 22:44:24 +01:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ const bool is_main_frame =
|
|
|
|
+ main_frame_origin.IsSameOriginWith(url::Origin::Create(url));
|
|
|
|
+
|
|
|
|
+#if BUILDFLAG(ENABLE_CEF)
|
|
|
|
+ CefPluginServiceFilter* filter = static_cast<CefPluginServiceFilter*>(
|
|
|
|
+ PluginService::GetInstance()->GetFilter());
|
|
|
|
+ DCHECK(filter);
|
|
|
|
+
|
|
|
|
+ size_t i = 0;
|
|
|
|
+ for (; i < matching_plugins.size(); ++i) {
|
|
|
|
+ if (filter->IsPluginAvailable(render_process_id_, render_frame_id,
|
2019-10-01 15:55:16 +02:00
|
|
|
+ url, is_main_frame, main_frame_origin,
|
|
|
|
+ &matching_plugins[i], status)) {
|
2017-12-07 22:44:24 +01:00
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+#else // !BUILDFLAG(ENABLE_CEF)
|
|
|
|
content::PluginServiceFilter* filter =
|
|
|
|
PluginService::GetInstance()->GetFilter();
|
|
|
|
size_t i = 0;
|
|
|
|
for (; i < matching_plugins.size(); ++i) {
|
2019-10-01 15:55:16 +02:00
|
|
|
if (!filter ||
|
|
|
|
filter->IsPluginAvailable(render_process_id_, render_frame_id, url,
|
|
|
|
- main_frame_origin, &matching_plugins[i])) {
|
|
|
|
+ is_main_frame, main_frame_origin,
|
|
|
|
+ &matching_plugins[i])) {
|
2017-12-07 22:44:24 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
+#endif // !BUILDFLAG(ENABLE_CEF)
|
|
|
|
|
|
|
|
// If we broke out of the loop, we have found an enabled plugin.
|
|
|
|
bool enabled = i < matching_plugins.size();
|
2019-05-01 21:09:59 +02:00
|
|
|
diff --git chrome/browser/plugins/plugin_utils.cc chrome/browser/plugins/plugin_utils.cc
|
2020-08-29 00:39:23 +02:00
|
|
|
index 1471b8f2a414..a856ce635719 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"
|
2019-05-01 21:09:59 +02:00
|
|
|
#include "chrome/browser/profiles/profile_io_data.h"
|
|
|
|
#include "chrome/common/plugin_utils.h"
|
|
|
|
#include "components/content_settings/core/browser/host_content_settings_map.h"
|
2020-07-01 02:57:00 +02:00
|
|
|
@@ -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"
|
2020-08-29 00:39:23 +02:00
|
|
|
@@ -181,6 +186,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
|
2020-07-08 19:23:29 +02:00
|
|
|
index c1870b0f56ef..d32b8d54fb3f 100644
|
2019-10-07 10:22:46 +02:00
|
|
|
--- chrome/common/google_url_loader_throttle.cc
|
|
|
|
+++ chrome/common/google_url_loader_throttle.cc
|
2020-07-08 19:23:29 +02:00
|
|
|
@@ -7,12 +7,17 @@
|
|
|
|
#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"
|
2020-07-08 19:23:29 +02:00
|
|
|
#include "net/base/url_util.h"
|
2019-11-12 17:11:44 +01:00
|
|
|
#include "services/network/public/mojom/url_response_head.mojom.h"
|
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
|
2020-07-08 19:23:29 +02:00
|
|
|
@@ -152,6 +157,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
|
|
|
|
+
|
|
|
|
// Built-in additional protection for the chrome web store origin.
|
|
|
|
GURL webstore_url(extension_urls::GetWebstoreLaunchURL());
|
|
|
|
if (response_url.SchemeIsHTTPOrHTTPS() &&
|
2017-12-07 22:44:24 +01:00
|
|
|
diff --git chrome/renderer/chrome_content_renderer_client.cc chrome/renderer/chrome_content_renderer_client.cc
|
2020-08-29 00:39:23 +02:00
|
|
|
index eb6e5d353b33..62994a141421 100644
|
2017-12-07 22:44:24 +01:00
|
|
|
--- chrome/renderer/chrome_content_renderer_client.cc
|
|
|
|
+++ chrome/renderer/chrome_content_renderer_client.cc
|
2020-08-29 00:39:23 +02:00
|
|
|
@@ -823,6 +823,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;
|
2020-08-29 00:39:23 +02:00
|
|
|
@@ -1026,7 +1027,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: {
|
2020-08-29 00:39:23 +02:00
|
|
|
@@ -1035,7 +1037,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: {
|
2020-08-29 00:39:23 +02:00
|
|
|
@@ -1045,7 +1048,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: {
|
2020-08-29 00:39:23 +02:00
|
|
|
@@ -1053,7 +1057,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;
|
|
|
|
}
|
|
|
|
case chrome::mojom::PluginStatus::kComponentUpdateRequired: {
|
2018-02-03 01:01:36 +01:00
|
|
|
diff --git chrome/renderer/plugins/chrome_plugin_placeholder.cc chrome/renderer/plugins/chrome_plugin_placeholder.cc
|
2020-08-29 00:39:23 +02:00
|
|
|
index 4e883820f752..267c6af2af6b 100644
|
2018-02-03 01:01:36 +01:00
|
|
|
--- chrome/renderer/plugins/chrome_plugin_placeholder.cc
|
|
|
|
+++ chrome/renderer/plugins/chrome_plugin_placeholder.cc
|
2020-08-29 00:39:23 +02:00
|
|
|
@@ -364,8 +364,11 @@ void ChromePluginPlaceholder::OnBlockedContent(
|
2018-02-03 01:01:36 +01:00
|
|
|
|
|
|
|
if (status ==
|
|
|
|
content::RenderFrame::PeripheralContentStatus::CONTENT_STATUS_TINY) {
|
2020-06-09 19:48:00 +02:00
|
|
|
- content_settings::ContentSettingsAgentImpl::Get(render_frame())
|
2020-02-10 18:10:17 +01:00
|
|
|
- ->DidBlockContentType(ContentSettingsType::PLUGINS);
|
2020-06-09 19:48:00 +02:00
|
|
|
+ content_settings::ContentSettingsAgentImpl *content_settings_agent =
|
|
|
|
+ content_settings::ContentSettingsAgentImpl::Get(render_frame());
|
2020-02-10 18:10:17 +01:00
|
|
|
+ if (content_settings_agent) {
|
|
|
|
+ content_settings_agent->DidBlockContentType(ContentSettingsType::PLUGINS);
|
|
|
|
+ }
|
2018-02-03 01:01:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
std::string message = base::StringPrintf(
|
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
|
|
|
|
index c44044339647..3cdb3fb4bb63 100644
|
|
|
|
--- content/browser/browser_plugin/browser_plugin_guest.h
|
|
|
|
+++ content/browser/browser_plugin/browser_plugin_guest.h
|
|
|
|
@@ -130,6 +130,11 @@ class CONTENT_EXPORT BrowserPluginGuest : public GuestHost,
|
|
|
|
void EmbedderSystemDragEnded();
|
|
|
|
void EndSystemDragIfApplicable();
|
|
|
|
|
|
|
|
+ // Returns the embedder frame for this guest.
|
|
|
|
+ RenderFrameHost* GetEmbedderFrame() const {
|
|
|
|
+ return delegate_->GetEmbedderFrame();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
protected:
|
|
|
|
// BrowserPluginGuest is a WebContentsObserver of |web_contents| and
|
|
|
|
// |web_contents| has to stay valid for the lifetime of BrowserPluginGuest.
|