summaryrefslogtreecommitdiffstats
path: root/src/core/extensions/plugin_service_filter_qt.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/extensions/plugin_service_filter_qt.cpp')
-rw-r--r--src/core/extensions/plugin_service_filter_qt.cpp38
1 files changed, 16 insertions, 22 deletions
diff --git a/src/core/extensions/plugin_service_filter_qt.cpp b/src/core/extensions/plugin_service_filter_qt.cpp
index 778f803c3..51349ff68 100644
--- a/src/core/extensions/plugin_service_filter_qt.cpp
+++ b/src/core/extensions/plugin_service_filter_qt.cpp
@@ -39,10 +39,11 @@
#include "extensions/plugin_service_filter_qt.h"
-#include "content/public/browser/render_frame_host.h"
-#include "content/public/browser/web_contents.h"
+#include "content/public/browser/render_process_host.h"
-#include "web_contents_delegate_qt.h"
+#include "profile_adapter.h"
+#include "profile_adapter_client.h"
+#include "profile_qt.h"
#include "web_engine_settings.h"
using namespace QtWebEngineCore;
@@ -50,31 +51,24 @@ using namespace QtWebEngineCore;
namespace extensions {
// static
-PluginServiceFilterQt *PluginServiceFilterQt::GetInstance() {
+PluginServiceFilterQt *PluginServiceFilterQt::GetInstance()
+{
return base::Singleton<PluginServiceFilterQt>::get();
}
bool PluginServiceFilterQt::IsPluginAvailable(int render_process_id,
- int render_frame_id,
- const GURL &url,
- const url::Origin &main_frame_origin,
- content::WebPluginInfo *plugin)
+ const content::WebPluginInfo &plugin)
{
- content::RenderFrameHost *frame_host = content::RenderFrameHost::FromID(render_process_id, render_frame_id);
- content::WebContents *web_contents = content::WebContents::FromRenderFrameHost(frame_host);
- if (!web_contents) {
- // Availability checked somewhere before/during WebContents initialization. Let it load and enable
- // all the plugins at this phase. This information will be queried again when receiving the response
- // for the requested content. Postponing our decision and enabling/blocking there makes WebEngineSettings
- // modifiable in runtime without reconstructing WebContents.
- return true;
- }
+ Q_UNUSED(plugin);
+ content::RenderProcessHost *rph = content::RenderProcessHost::FromID(render_process_id);
+ if (!rph)
+ return false;
- if (web_contents->IsInnerWebContentsForGuest())
- web_contents = web_contents->GetOuterWebContents();
-
- if (auto *delegate = static_cast<WebContentsDelegateQt *>(web_contents->GetDelegate())) {
- const WebEngineSettings *settings = delegate->webEngineSettings();
+ ProfileQt *profile = static_cast<ProfileQt *>(rph->GetBrowserContext());
+ for (auto *client : profile->profileAdapter()->clients()) {
+ const WebEngineSettings *settings = client->coreSettings();
+ if (!settings)
+ return false;
if (!settings->testAttribute(QWebEngineSettings::PdfViewerEnabled)
|| !settings->testAttribute(QWebEngineSettings::PluginsEnabled))
return false;