summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzabolcs David <davidsz@inf.u-szeged.hu>2022-05-18 15:40:00 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2022-11-09 11:48:07 +0100
commite1567b30816368b2ccf5bc2101b39979a54fb63b (patch)
tree3669cbae180a609298bbc5c60e6a697c4047792c
parent4b619a20fda6891f0512946ac87cc85c34f13d7e (diff)
downloadqtwebengine-chromium-e1567b30816368b2ccf5bc2101b39979a54fb63b.tar.gz
Add back frame_id argument to PluginServiceFilter::IsPluginAvailable()
It was removed in 98-based because Chrome stores plugin availibility per profile. Add it back to help query plugin settings from view-level WebEngineSettings. Change-Id: I1de52792fbdca099d220cbc7a579553cac2c05d2 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
-rw-r--r--chromium/content/browser/loader/navigation_url_loader_impl.cc7
-rw-r--r--chromium/content/browser/plugin_service_impl.cc6
-rw-r--r--chromium/content/browser/plugin_service_impl.h4
-rw-r--r--chromium/content/browser/renderer_host/plugin_registry_impl.cc3
-rw-r--r--chromium/content/browser/renderer_host/render_frame_host_impl.cc2
-rw-r--r--chromium/content/public/browser/plugin_service.h10
-rw-r--r--chromium/content/public/browser/plugin_service_filter.h4
7 files changed, 25 insertions, 11 deletions
diff --git a/chromium/content/browser/loader/navigation_url_loader_impl.cc b/chromium/content/browser/loader/navigation_url_loader_impl.cc
index 033c273833c..98fbab0303f 100644
--- a/chromium/content/browser/loader/navigation_url_loader_impl.cc
+++ b/chromium/content/browser/loader/navigation_url_loader_impl.cc
@@ -893,8 +893,13 @@ void NavigationURLLoaderImpl::CheckPluginAndContinueOnReceiveResponse(
const std::vector<WebPluginInfo>& plugins) {
bool stale;
WebPluginInfo plugin;
+ FrameTreeNode* frame_tree_node =
+ FrameTreeNode::GloballyFindByID(frame_tree_node_id_);
+ int render_process_id =
+ frame_tree_node->current_frame_host()->GetProcess()->GetID();
+ int routing_id = frame_tree_node->current_frame_host()->GetRoutingID();
bool has_plugin = PluginService::GetInstance()->GetPluginInfo(
- browser_context_, resource_request_->url, head->mime_type,
+ render_process_id, routing_id, browser_context_, resource_request_->url, head->mime_type,
/*allow_wildcard=*/false, &stale, &plugin, nullptr);
if (stale) {
diff --git a/chromium/content/browser/plugin_service_impl.cc b/chromium/content/browser/plugin_service_impl.cc
index d5c621ead56..33c8ad338a4 100644
--- a/chromium/content/browser/plugin_service_impl.cc
+++ b/chromium/content/browser/plugin_service_impl.cc
@@ -204,7 +204,9 @@ bool PluginServiceImpl::GetPluginInfoArray(
url, mime_type, allow_wildcard, plugins, actual_mime_types);
}
-bool PluginServiceImpl::GetPluginInfo(content::BrowserContext* browser_context,
+bool PluginServiceImpl::GetPluginInfo(int render_process_id,
+ int render_frame_id,
+ content::BrowserContext* browser_context,
const GURL& url,
const std::string& mime_type,
bool allow_wildcard,
@@ -221,7 +223,7 @@ bool PluginServiceImpl::GetPluginInfo(content::BrowserContext* browser_context,
*is_stale = stale;
for (size_t i = 0; i < plugins.size(); ++i) {
- if (!filter_ || filter_->IsPluginAvailable(browser_context, plugins[i])) {
+ if (!filter_ || filter_->IsPluginAvailable(render_process_id, render_frame_id, browser_context, plugins[i])) {
*info = plugins[i];
if (actual_mime_type)
*actual_mime_type = mime_types[i];
diff --git a/chromium/content/browser/plugin_service_impl.h b/chromium/content/browser/plugin_service_impl.h
index cb25f84096f..9d4e5f8d6ed 100644
--- a/chromium/content/browser/plugin_service_impl.h
+++ b/chromium/content/browser/plugin_service_impl.h
@@ -56,7 +56,9 @@ class CONTENT_EXPORT PluginServiceImpl : public PluginService {
bool allow_wildcard,
std::vector<WebPluginInfo>* info,
std::vector<std::string>* actual_mime_types) override;
- bool GetPluginInfo(content::BrowserContext* browser_context,
+ bool GetPluginInfo(int render_process_id,
+ int render_frame_id,
+ content::BrowserContext* browser_context,
const GURL& url,
const std::string& mime_type,
bool allow_wildcard,
diff --git a/chromium/content/browser/renderer_host/plugin_registry_impl.cc b/chromium/content/browser/renderer_host/plugin_registry_impl.cc
index 18873e85bcd..53652142062 100644
--- a/chromium/content/browser/renderer_host/plugin_registry_impl.cc
+++ b/chromium/content/browser/renderer_host/plugin_registry_impl.cc
@@ -67,9 +67,10 @@ void PluginRegistryImpl::GetPluginsComplete(
GetContentClient()->browser()->GetPluginMimeTypesWithExternalHandlers(
rph->GetBrowserContext());
+ const int routing_id = MSG_ROUTING_NONE;
for (const auto& plugin : all_plugins) {
if (!filter ||
- filter->IsPluginAvailable(rph->GetBrowserContext(), plugin)) {
+ filter->IsPluginAvailable(render_process_id_, routing_id, rph->GetBrowserContext(), plugin)) {
auto plugin_blink = blink::mojom::PluginInfo::New();
plugin_blink->name = plugin.name;
plugin_blink->description = plugin.desc;
diff --git a/chromium/content/browser/renderer_host/render_frame_host_impl.cc b/chromium/content/browser/renderer_host/render_frame_host_impl.cc
index 7ccfd585c69..24ce7f139a6 100644
--- a/chromium/content/browser/renderer_host/render_frame_host_impl.cc
+++ b/chromium/content/browser/renderer_host/render_frame_host_impl.cc
@@ -13936,7 +13936,7 @@ void RenderFrameHostImpl::GetPluginInfo(const GURL& url,
WebPluginInfo info;
std::string actual_mime_type;
bool found = PluginServiceImpl::GetInstance()->GetPluginInfo(
- GetBrowserContext(), url, mime_type, allow_wildcard, nullptr, &info,
+ GetProcess()->GetID(), routing_id_, GetBrowserContext(), url, mime_type, allow_wildcard, nullptr, &info,
&actual_mime_type);
std::move(callback).Run(found, info, actual_mime_type);
}
diff --git a/chromium/content/public/browser/plugin_service.h b/chromium/content/public/browser/plugin_service.h
index ad336180d00..8b1ed72ef9c 100644
--- a/chromium/content/public/browser/plugin_service.h
+++ b/chromium/content/public/browser/plugin_service.h
@@ -68,10 +68,12 @@ class CONTENT_EXPORT PluginService {
std::vector<std::string>* actual_mime_types) = 0;
// Gets plugin info for an individual plugin and filters the plugins using
- // the |browser_context|. This will report whether the data is stale via
- // |is_stale| and returns whether or not the plugin can be found. This must be
- // called from the UI thread.
- virtual bool GetPluginInfo(content::BrowserContext* browser_context,
+ // the |context| and renderer IDs. This will report whether the data is stale
+ // via |is_stale| and returns whether or not the plugin can be found.
+ // This must be called from the UI thread.
+ virtual bool GetPluginInfo(int render_process_id,
+ int render_frame_id,
+ content::BrowserContext* browser_context,
const GURL& url,
const std::string& mime_type,
bool allow_wildcard,
diff --git a/chromium/content/public/browser/plugin_service_filter.h b/chromium/content/public/browser/plugin_service_filter.h
index 548d8501d04..c89df0efc79 100644
--- a/chromium/content/public/browser/plugin_service_filter.h
+++ b/chromium/content/public/browser/plugin_service_filter.h
@@ -22,7 +22,9 @@ class PluginServiceFilter {
// Whether `plugin` is available. The client can return false to hide the
// plugin. The result may be cached, and should be consistent between calls.
- virtual bool IsPluginAvailable(content::BrowserContext* browser_context,
+ virtual bool IsPluginAvailable(int render_process_id,
+ int render_frame_id,
+ content::BrowserContext* browser_context,
const WebPluginInfo& plugin) = 0;
// Whether the renderer has permission to load available `plugin`.