mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2024-12-13 10:06:28 +01:00
6573df6cc3
- Windows: 10.0.19041 SDK is now required. - macOS: 10.15.1 SDK (at least Xcode 11.2) is now required. - Remove CefMediaSource::IsValid and CefMediaSink::IsValid which would always return true.
270 lines
11 KiB
Diff
270 lines
11 KiB
Diff
diff --git chrome/browser/plugins/plugin_info_host_impl.cc chrome/browser/plugins/plugin_info_host_impl.cc
|
|
index d49a1df73622..9a389e4383f0 100644
|
|
--- chrome/browser/plugins/plugin_info_host_impl.cc
|
|
+++ chrome/browser/plugins/plugin_info_host_impl.cc
|
|
@@ -18,6 +18,7 @@
|
|
#include "base/task_runner_util.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"
|
|
@@ -54,6 +55,11 @@
|
|
#include "url/gurl.h"
|
|
#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"
|
|
@@ -100,6 +106,9 @@ bool IsPluginLoadingAccessibleResourceInWebView(
|
|
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;
|
|
@@ -128,9 +137,6 @@ bool IsPluginLoadingAccessibleResourceInWebView(
|
|
|
|
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)) {
|
|
@@ -138,6 +144,13 @@ PluginInfoHostImpl::Context::Context(int render_process_id, Profile* profile)
|
|
profile->GetPrefs());
|
|
run_all_flash_in_allow_mode_.Init(prefs::kRunAllFlashInAllowMode,
|
|
profile->GetPrefs());
|
|
+
|
|
+#if BUILDFLAG(ENABLE_EXTENSIONS)
|
|
+#if BUILDFLAG(ENABLE_CEF)
|
|
+ if (extensions::ExtensionsEnabled())
|
|
+#endif
|
|
+ extension_registry_ = extensions::ExtensionRegistry::Get(profile);
|
|
+#endif
|
|
}
|
|
|
|
PluginInfoHostImpl::Context::~Context() {}
|
|
@@ -208,6 +221,7 @@ void PluginInfoHostImpl::PluginsLoaded(
|
|
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.
|
|
std::unique_ptr<component_updater::ComponentInfo> cus_plugin_info =
|
|
@@ -216,7 +230,9 @@ void PluginInfoHostImpl::PluginsLoaded(
|
|
ComponentPluginLookupDone(params, std::move(output), std::move(callback),
|
|
std::move(plugin_metadata),
|
|
std::move(cus_plugin_info));
|
|
- } else {
|
|
+ } else
|
|
+#endif // !BUILDFLAG(ENABLE_CEF)
|
|
+ {
|
|
GetPluginInfoFinish(params, std::move(output), std::move(callback),
|
|
std::move(plugin_metadata));
|
|
}
|
|
@@ -229,6 +245,14 @@ void PluginInfoHostImpl::Context::DecidePluginStatus(
|
|
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;
|
|
@@ -337,16 +361,35 @@ bool PluginInfoHostImpl::Context::FindEnabledPlugin(
|
|
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,
|
|
+ url, is_main_frame, main_frame_origin,
|
|
+ &matching_plugins[i], status)) {
|
|
+ break;
|
|
+ }
|
|
+ }
|
|
+#else // !BUILDFLAG(ENABLE_CEF)
|
|
content::PluginServiceFilter* filter =
|
|
PluginService::GetInstance()->GetFilter();
|
|
size_t i = 0;
|
|
for (; i < matching_plugins.size(); ++i) {
|
|
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])) {
|
|
break;
|
|
}
|
|
}
|
|
+#endif // !BUILDFLAG(ENABLE_CEF)
|
|
|
|
// If we broke out of the loop, we have found an enabled plugin.
|
|
bool enabled = i < matching_plugins.size();
|
|
diff --git chrome/browser/plugins/plugin_utils.cc chrome/browser/plugins/plugin_utils.cc
|
|
index 4e64db143b8a..3dc127b7b992 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/runtime.h"
|
|
#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"
|
|
@@ -14,6 +15,10 @@
|
|
#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)
|
|
#include "chrome/common/pref_names.h"
|
|
#include "components/prefs/pref_service.h"
|
|
@@ -182,6 +187,12 @@ base::flat_map<std::string, std::string>
|
|
PluginUtils::GetMimeTypeToExtensionIdMap(
|
|
content::BrowserContext* browser_context) {
|
|
base::flat_map<std::string, std::string> mime_type_to_extension_id_map;
|
|
+
|
|
+#if BUILDFLAG(ENABLE_CEF)
|
|
+ if (cef::IsAlloyRuntimeEnabled() && !extensions::ExtensionsEnabled())
|
|
+ return mime_type_to_extension_id_map;
|
|
+#endif
|
|
+
|
|
#if BUILDFLAG(ENABLE_EXTENSIONS)
|
|
Profile* profile = Profile::FromBrowserContext(browser_context);
|
|
std::vector<std::string> whitelist = MimeTypesHandler::GetMIMETypeWhitelist();
|
|
diff --git chrome/common/google_url_loader_throttle.cc chrome/common/google_url_loader_throttle.cc
|
|
index c1870b0f56ef..d32b8d54fb3f 100644
|
|
--- chrome/common/google_url_loader_throttle.cc
|
|
+++ chrome/common/google_url_loader_throttle.cc
|
|
@@ -7,12 +7,17 @@
|
|
#include "base/feature_list.h"
|
|
#include "base/metrics/histogram_functions.h"
|
|
#include "build/build_config.h"
|
|
+#include "cef/libcef/features/runtime.h"
|
|
#include "chrome/common/chrome_features.h"
|
|
#include "chrome/common/net/safe_search_util.h"
|
|
#include "components/google/core/common/google_util.h"
|
|
#include "net/base/url_util.h"
|
|
#include "services/network/public/mojom/url_response_head.mojom.h"
|
|
|
|
+#if BUILDFLAG(ENABLE_CEF)
|
|
+#include "cef/libcef/common/extensions/extensions_util.h"
|
|
+#endif
|
|
+
|
|
#if BUILDFLAG(ENABLE_EXTENSIONS)
|
|
#include "extensions/common/extension_urls.h"
|
|
#endif
|
|
@@ -152,6 +157,11 @@ void GoogleURLLoaderThrottle::WillProcessResponse(
|
|
const GURL& response_url,
|
|
network::mojom::URLResponseHead* response_head,
|
|
bool* defer) {
|
|
+#if BUILDFLAG(ENABLE_CEF)
|
|
+ if (cef::IsAlloyRuntimeEnabled() && !extensions::ExtensionsEnabled())
|
|
+ return;
|
|
+#endif
|
|
+
|
|
// Built-in additional protection for the chrome web store origin.
|
|
GURL webstore_url(extension_urls::GetWebstoreLaunchURL());
|
|
if (response_url.SchemeIsHTTPOrHTTPS() &&
|
|
diff --git chrome/renderer/chrome_content_renderer_client.cc chrome/renderer/chrome_content_renderer_client.cc
|
|
index 03d1e6a07843..2fd040ed87b5 100644
|
|
--- chrome/renderer/chrome_content_renderer_client.cc
|
|
+++ chrome/renderer/chrome_content_renderer_client.cc
|
|
@@ -842,6 +842,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;
|
|
@@ -1045,7 +1046,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: {
|
|
@@ -1054,7 +1056,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: {
|
|
@@ -1064,7 +1067,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;
|
|
}
|
|
case chrome::mojom::PluginStatus::kBlockedNoLoading: {
|
|
@@ -1072,7 +1076,8 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin(
|
|
IDR_BLOCKED_PLUGIN_HTML,
|
|
l10n_util::GetStringFUTF16(IDS_PLUGIN_BLOCKED_NO_LOADING,
|
|
group_name));
|
|
- content_settings_agent->DidBlockContentType(content_type);
|
|
+ if (content_settings_agent)
|
|
+ content_settings_agent->DidBlockContentType(content_type);
|
|
break;
|
|
}
|
|
case chrome::mojom::PluginStatus::kComponentUpdateRequired: {
|
|
diff --git chrome/renderer/plugins/chrome_plugin_placeholder.cc chrome/renderer/plugins/chrome_plugin_placeholder.cc
|
|
index d662fe9310c9..c4c406d16b95 100644
|
|
--- chrome/renderer/plugins/chrome_plugin_placeholder.cc
|
|
+++ chrome/renderer/plugins/chrome_plugin_placeholder.cc
|
|
@@ -360,8 +360,11 @@ void ChromePluginPlaceholder::OnBlockedContent(
|
|
|
|
if (status ==
|
|
content::RenderFrame::PeripheralContentStatus::CONTENT_STATUS_TINY) {
|
|
- content_settings::ContentSettingsAgentImpl::Get(render_frame())
|
|
- ->DidBlockContentType(ContentSettingsType::PLUGINS);
|
|
+ content_settings::ContentSettingsAgentImpl *content_settings_agent =
|
|
+ content_settings::ContentSettingsAgentImpl::Get(render_frame());
|
|
+ if (content_settings_agent) {
|
|
+ content_settings_agent->DidBlockContentType(ContentSettingsType::PLUGINS);
|
|
+ }
|
|
}
|
|
|
|
std::string message = base::StringPrintf(
|