mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2024-12-12 09:37:37 +01:00
74db00fc89
- Linux ARM builds require use_vaapi=false (see https://crbug.com/1185348) - Windows official builds require use_thin_lto=false (see https://crbug.com/1177001)
255 lines
10 KiB
Diff
255 lines
10 KiB
Diff
diff --git chrome/browser/plugins/plugin_info_host_impl.cc chrome/browser/plugins/plugin_info_host_impl.cc
|
|
index 6de814c6ed1e..302d6dcc789a 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/runtime.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"
|
|
@@ -53,6 +54,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"
|
|
@@ -99,6 +105,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;
|
|
@@ -127,9 +136,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)) {
|
|
@@ -137,6 +143,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 (!cef::IsAlloyRuntimeEnabled() || extensions::ExtensionsEnabled())
|
|
+#endif
|
|
+ extension_registry_ = extensions::ExtensionRegistry::Get(profile);
|
|
+#endif
|
|
}
|
|
|
|
PluginInfoHostImpl::Context::~Context() {}
|
|
@@ -218,6 +231,15 @@ 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 (cef::IsAlloyRuntimeEnabled() &&
|
|
+ (*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;
|
|
@@ -334,17 +356,41 @@ bool PluginInfoHostImpl::Context::FindEnabledPlugin(
|
|
return false;
|
|
}
|
|
|
|
+ const bool is_main_frame =
|
|
+ main_frame_origin.IsSameOriginWith(url::Origin::Create(url));
|
|
+ size_t i = 0;
|
|
+
|
|
+#if BUILDFLAG(ENABLE_CEF)
|
|
+ if (cef::IsAlloyRuntimeEnabled()) {
|
|
+ CefPluginServiceFilter* filter = static_cast<CefPluginServiceFilter*>(
|
|
+ PluginService::GetInstance()->GetFilter());
|
|
+ DCHECK(filter);
|
|
+
|
|
+ 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 {
|
|
+#endif // 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;
|
|
}
|
|
}
|
|
|
|
+#if BUILDFLAG(ENABLE_CEF)
|
|
+ }
|
|
+#endif
|
|
+
|
|
// If we broke out of the loop, we have found an enabled plugin.
|
|
bool enabled = i < matching_plugins.size();
|
|
if (!enabled) {
|
|
diff --git chrome/browser/plugins/plugin_utils.cc chrome/browser/plugins/plugin_utils.cc
|
|
index e547d5f00617..831d5794ecde 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"
|
|
@@ -15,6 +16,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"
|
|
@@ -77,6 +82,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);
|
|
const std::vector<std::string>& allowlist =
|
|
diff --git chrome/common/google_url_loader_throttle.cc chrome/common/google_url_loader_throttle.cc
|
|
index 6555dfc37d5c..d54030b6f236 100644
|
|
--- chrome/common/google_url_loader_throttle.cc
|
|
+++ chrome/common/google_url_loader_throttle.cc
|
|
@@ -7,6 +7,7 @@
|
|
#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"
|
|
@@ -18,6 +19,10 @@
|
|
#include "ui/base/device_form_factor.h"
|
|
#endif
|
|
|
|
+#if BUILDFLAG(ENABLE_CEF)
|
|
+#include "cef/libcef/common/extensions/extensions_util.h"
|
|
+#endif
|
|
+
|
|
#if BUILDFLAG(ENABLE_EXTENSIONS)
|
|
#include "extensions/common/extension_urls.h"
|
|
#endif
|
|
@@ -168,6 +173,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 by ensuring
|
|
// that the X-Frame-Options protection mechanism is set to either DENY or
|
|
// SAMEORIGIN.
|
|
diff --git chrome/renderer/chrome_content_renderer_client.cc chrome/renderer/chrome_content_renderer_client.cc
|
|
index b6fe493a6ddc..bc2f6487044f 100644
|
|
--- chrome/renderer/chrome_content_renderer_client.cc
|
|
+++ chrome/renderer/chrome_content_renderer_client.cc
|
|
@@ -858,6 +858,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;
|
|
@@ -1053,7 +1054,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: {
|
|
@@ -1062,7 +1064,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: {
|
|
@@ -1072,7 +1075,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: {
|
|
@@ -1080,7 +1084,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;
|
|
}
|
|
}
|
|
diff --git content/browser/browser_plugin/browser_plugin_guest.h content/browser/browser_plugin/browser_plugin_guest.h
|
|
index 06b6875bd37e..13c197b532ad 100644
|
|
--- content/browser/browser_plugin/browser_plugin_guest.h
|
|
+++ content/browser/browser_plugin/browser_plugin_guest.h
|
|
@@ -115,6 +115,8 @@ class CONTENT_EXPORT BrowserPluginGuest : public GuestHost,
|
|
|
|
gfx::Point GetScreenCoordinates(const gfx::Point& relative_position) const;
|
|
|
|
+ WebContentsImpl* owner_web_contents() const { return owner_web_contents_; }
|
|
+
|
|
protected:
|
|
// BrowserPluginGuest is a WebContentsObserver of |web_contents| and
|
|
// |web_contents| has to stay valid for the lifetime of BrowserPluginGuest.
|