mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
refactor: remove ppapi dependency
PPAPI removal - https://issues.chromium.org/issues/40511450 PDF viewer migration - https://issues.chromium.org/issues/40511452
This commit is contained in:
16
BUILD.gn
16
BUILD.gn
@@ -425,7 +425,8 @@ source_set("electron_lib") {
|
||||
"buildflags",
|
||||
"chromium_src:chrome",
|
||||
"chromium_src:chrome_spellchecker",
|
||||
"shell/common/api:mojo",
|
||||
"shell/common:mojo",
|
||||
"shell/common:plugin",
|
||||
"shell/services/node/public/mojom",
|
||||
"//base:base_static",
|
||||
"//base/allocator:buildflags",
|
||||
@@ -672,22 +673,9 @@ source_set("electron_lib") {
|
||||
}
|
||||
|
||||
if (enable_plugins) {
|
||||
deps += [ "chromium_src:plugins" ]
|
||||
sources += [
|
||||
"shell/common/plugin_info.cc",
|
||||
"shell/common/plugin_info.h",
|
||||
"shell/renderer/electron_renderer_pepper_host_factory.cc",
|
||||
"shell/renderer/electron_renderer_pepper_host_factory.h",
|
||||
"shell/renderer/pepper_helper.cc",
|
||||
"shell/renderer/pepper_helper.h",
|
||||
]
|
||||
}
|
||||
|
||||
if (enable_ppapi) {
|
||||
deps += [
|
||||
"//ppapi/host",
|
||||
"//ppapi/proxy",
|
||||
"//ppapi/shared_impl",
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ import("//build/config/ozone.gni")
|
||||
import("//build/config/ui.gni")
|
||||
import("//components/spellcheck/spellcheck_build_features.gni")
|
||||
import("//electron/buildflags/buildflags.gni")
|
||||
import("//ppapi/buildflags/buildflags.gni")
|
||||
import("//printing/buildflags/buildflags.gni")
|
||||
import("//third_party/widevine/cdm/widevine.gni")
|
||||
|
||||
@@ -421,46 +420,6 @@ static_library("chrome") {
|
||||
}
|
||||
}
|
||||
|
||||
source_set("plugins") {
|
||||
sources = []
|
||||
deps = []
|
||||
frameworks = []
|
||||
|
||||
# browser side
|
||||
sources += [
|
||||
"//chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.cc",
|
||||
"//chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.h",
|
||||
"//chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.cc",
|
||||
"//chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.h",
|
||||
]
|
||||
|
||||
# renderer side
|
||||
sources += [
|
||||
"//chrome/renderer/pepper/chrome_renderer_pepper_host_factory.cc",
|
||||
"//chrome/renderer/pepper/chrome_renderer_pepper_host_factory.h",
|
||||
"//chrome/renderer/pepper/pepper_shared_memory_message_filter.cc",
|
||||
"//chrome/renderer/pepper/pepper_shared_memory_message_filter.h",
|
||||
]
|
||||
|
||||
deps += [
|
||||
"//components/strings",
|
||||
"//media:media_buildflags",
|
||||
"//services/device/public/mojom",
|
||||
"//skia",
|
||||
"//storage/browser",
|
||||
]
|
||||
|
||||
if (enable_ppapi) {
|
||||
deps += [
|
||||
"//ppapi/buildflags",
|
||||
"//ppapi/host",
|
||||
"//ppapi/proxy",
|
||||
"//ppapi/proxy:ipc",
|
||||
"//ppapi/shared_impl",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
# This source set is just so we don't have to depend on all of //chrome/browser
|
||||
# You may have to add new files here during the upgrade if //chrome/browser/spellchecker
|
||||
# gets more files
|
||||
|
||||
@@ -378,6 +378,8 @@ filenames = {
|
||||
"shell/browser/electron_navigation_throttle.h",
|
||||
"shell/browser/electron_permission_manager.cc",
|
||||
"shell/browser/electron_permission_manager.h",
|
||||
"shell/browser/electron_plugin_info_host_impl.cc",
|
||||
"shell/browser/electron_plugin_info_host_impl.h",
|
||||
"shell/browser/electron_speech_recognition_manager_delegate.cc",
|
||||
"shell/browser/electron_speech_recognition_manager_delegate.h",
|
||||
"shell/browser/electron_web_contents_utility_handler_impl.cc",
|
||||
|
||||
@@ -10,7 +10,6 @@ webview_cross_drag.patch
|
||||
gin_enable_disable_v8_platform.patch
|
||||
enable_reset_aspect_ratio.patch
|
||||
boringssl_build_gn.patch
|
||||
pepper_plugin_support.patch
|
||||
gtk_visibility.patch
|
||||
resource_file_conflict.patch
|
||||
scroll_bounce_flag.patch
|
||||
@@ -25,7 +24,6 @@ dump_syms.patch
|
||||
command-ismediakey.patch
|
||||
printing.patch
|
||||
support_mixed_sandbox_with_zygote.patch
|
||||
unsandboxed_ppapi_processes_skip_zygote.patch
|
||||
build_add_electron_tracing_category.patch
|
||||
worker_context_will_destroy.patch
|
||||
frame_host_manager.patch
|
||||
@@ -131,3 +129,4 @@ feat_enable_passing_exit_code_on_service_process_crash.patch
|
||||
chore_remove_reference_to_chrome_browser_themes.patch
|
||||
feat_enable_customizing_symbol_color_in_framecaptionbutton.patch
|
||||
fix_potential_draggable_region_crash_when_no_mainframeimpl.patch
|
||||
build_expose_webplugininfo_interface_to_electron.patch
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: deepak1556 <hop2deep@gmail.com>
|
||||
Date: Fri, 9 Aug 2024 22:39:47 +0900
|
||||
Subject: build: expose webplugininfo interface to electron
|
||||
|
||||
Allows implementing electron::mojom::ElectronPluginInfoHost interface
|
||||
which provides plugin details between browser<->renderer.
|
||||
|
||||
diff --git a/content/public/common/BUILD.gn b/content/public/common/BUILD.gn
|
||||
index 0b7e43edf99ce901141ca9271f7130658525fd23..88dbc54c6b7d857cc0c572eb831d457348af236c 100644
|
||||
--- a/content/public/common/BUILD.gn
|
||||
+++ b/content/public/common/BUILD.gn
|
||||
@@ -370,6 +370,7 @@ mojom("interfaces") {
|
||||
"//content/common/*",
|
||||
"//extensions/common:mojom",
|
||||
"//extensions/common:mojom_blink",
|
||||
+ "//electron/shell/common:plugin",
|
||||
]
|
||||
|
||||
sources = [
|
||||
@@ -1,219 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: deepak1556 <hop2deep@gmail.com>
|
||||
Date: Thu, 20 Sep 2018 17:46:17 -0700
|
||||
Subject: pepper plugin support
|
||||
|
||||
This tweaks Chrome's pepper flash and PDF plugin support to make it
|
||||
usable from Electron.
|
||||
|
||||
diff --git a/chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.cc b/chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.cc
|
||||
index 46513bf122445f822917a1a80d5d9079f288e1b4..7becf2e72ca677335dbd241fa0fef30768a3fc28 100644
|
||||
--- a/chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.cc
|
||||
+++ b/chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.cc
|
||||
@@ -12,17 +12,21 @@
|
||||
#include <stddef.h>
|
||||
|
||||
#include "base/task/sequenced_task_runner.h"
|
||||
+#if 0
|
||||
#include "chrome/browser/browser_process.h"
|
||||
#include "chrome/browser/profiles/profile.h"
|
||||
#include "chrome/browser/profiles/profile_manager.h"
|
||||
#include "chrome/common/chrome_switches.h"
|
||||
#include "chrome/common/pepper_permission_util.h"
|
||||
+#endif
|
||||
#include "content/public/browser/browser_ppapi_host.h"
|
||||
#include "content/public/browser/browser_task_traits.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
#include "content/public/browser/child_process_security_policy.h"
|
||||
#include "content/public/browser/render_view_host.h"
|
||||
+#if 0
|
||||
#include "extensions/buildflags/buildflags.h"
|
||||
+#endif
|
||||
#include "ppapi/c/pp_errors.h"
|
||||
#include "ppapi/host/dispatch_host_message.h"
|
||||
#include "ppapi/host/host_message_context.h"
|
||||
@@ -31,12 +35,11 @@
|
||||
#include "ppapi/shared_impl/file_system_util.h"
|
||||
#include "storage/browser/file_system/isolated_context.h"
|
||||
|
||||
-#if BUILDFLAG(ENABLE_EXTENSIONS)
|
||||
+#if 0
|
||||
#include "extensions/browser/extension_registry.h"
|
||||
#include "extensions/common/constants.h"
|
||||
#include "extensions/common/extension.h"
|
||||
#include "extensions/common/extension_set.h"
|
||||
-#endif
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -46,6 +49,7 @@ const char* kPredefinedAllowedCrxFsOrigins[] = {
|
||||
};
|
||||
|
||||
} // namespace
|
||||
+#endif
|
||||
|
||||
// static
|
||||
PepperIsolatedFileSystemMessageFilter*
|
||||
@@ -69,11 +73,16 @@ PepperIsolatedFileSystemMessageFilter::PepperIsolatedFileSystemMessageFilter(
|
||||
const base::FilePath& profile_directory,
|
||||
const GURL& document_url,
|
||||
ppapi::host::PpapiHost* ppapi_host)
|
||||
+#if 0
|
||||
: render_process_id_(render_process_id),
|
||||
profile_directory_(profile_directory),
|
||||
document_url_(document_url) {
|
||||
for (size_t i = 0; i < std::size(kPredefinedAllowedCrxFsOrigins); ++i)
|
||||
allowed_crxfs_origins_.insert(kPredefinedAllowedCrxFsOrigins[i]);
|
||||
+#else
|
||||
+ : profile_directory_(profile_directory),
|
||||
+ document_url_(document_url) {
|
||||
+#endif
|
||||
}
|
||||
|
||||
PepperIsolatedFileSystemMessageFilter::
|
||||
@@ -98,6 +107,7 @@ int32_t PepperIsolatedFileSystemMessageFilter::OnResourceMessageReceived(
|
||||
return PP_ERROR_FAILED;
|
||||
}
|
||||
|
||||
+#if 0
|
||||
Profile* PepperIsolatedFileSystemMessageFilter::GetProfile() {
|
||||
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
||||
ProfileManager* profile_manager = g_browser_process->profile_manager();
|
||||
@@ -122,6 +132,7 @@ PepperIsolatedFileSystemMessageFilter::CreateCrxFileSystem(Profile* profile) {
|
||||
return storage::IsolatedContext::ScopedFSHandle();
|
||||
#endif
|
||||
}
|
||||
+#endif
|
||||
|
||||
int32_t PepperIsolatedFileSystemMessageFilter::OnOpenFileSystem(
|
||||
ppapi::host::HostMessageContext* context,
|
||||
@@ -130,7 +141,7 @@ int32_t PepperIsolatedFileSystemMessageFilter::OnOpenFileSystem(
|
||||
case PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_INVALID:
|
||||
break;
|
||||
case PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_CRX:
|
||||
- return OpenCrxFileSystem(context);
|
||||
+ return PP_ERROR_NOTSUPPORTED;
|
||||
}
|
||||
NOTREACHED_IN_MIGRATION();
|
||||
context->reply_msg =
|
||||
@@ -138,6 +149,7 @@ int32_t PepperIsolatedFileSystemMessageFilter::OnOpenFileSystem(
|
||||
return PP_ERROR_FAILED;
|
||||
}
|
||||
|
||||
+#if 0
|
||||
int32_t PepperIsolatedFileSystemMessageFilter::OpenCrxFileSystem(
|
||||
ppapi::host::HostMessageContext* context) {
|
||||
#if BUILDFLAG(ENABLE_EXTENSIONS)
|
||||
@@ -178,3 +190,4 @@ int32_t PepperIsolatedFileSystemMessageFilter::OpenCrxFileSystem(
|
||||
return PP_ERROR_NOTSUPPORTED;
|
||||
#endif
|
||||
}
|
||||
+#endif
|
||||
diff --git a/chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.h b/chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.h
|
||||
index 716f5f9abe27a4411f7cc47c37d80d9a72099369..77a5cd69317db2c02a4ca75b91cea9405ea99de5 100644
|
||||
--- a/chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.h
|
||||
+++ b/chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.h
|
||||
@@ -20,7 +20,9 @@
|
||||
#include "storage/browser/file_system/isolated_context.h"
|
||||
#include "url/gurl.h"
|
||||
|
||||
+#if 0
|
||||
class Profile;
|
||||
+#endif
|
||||
|
||||
namespace content {
|
||||
class BrowserPpapiHost;
|
||||
@@ -59,6 +61,7 @@ class PepperIsolatedFileSystemMessageFilter
|
||||
|
||||
~PepperIsolatedFileSystemMessageFilter() override;
|
||||
|
||||
+#if 0
|
||||
Profile* GetProfile();
|
||||
|
||||
// Returns filesystem id of isolated filesystem if valid, or empty string
|
||||
@@ -66,18 +69,23 @@ class PepperIsolatedFileSystemMessageFilter
|
||||
// allows access on that thread.
|
||||
storage::IsolatedContext::ScopedFSHandle CreateCrxFileSystem(
|
||||
Profile* profile);
|
||||
+#endif
|
||||
|
||||
int32_t OnOpenFileSystem(ppapi::host::HostMessageContext* context,
|
||||
PP_IsolatedFileSystemType_Private type);
|
||||
+#if 0
|
||||
int32_t OpenCrxFileSystem(ppapi::host::HostMessageContext* context);
|
||||
|
||||
const int render_process_id_;
|
||||
+#endif
|
||||
// Keep a copy from original thread.
|
||||
const base::FilePath profile_directory_;
|
||||
const GURL document_url_;
|
||||
|
||||
+#if 0
|
||||
// Set of origins that can use CrxFs private APIs from NaCl.
|
||||
std::set<std::string> allowed_crxfs_origins_;
|
||||
+#endif
|
||||
};
|
||||
|
||||
#endif // CHROME_BROWSER_RENDERER_HOST_PEPPER_PEPPER_ISOLATED_FILE_SYSTEM_MESSAGE_FILTER_H_
|
||||
diff --git a/chrome/renderer/pepper/chrome_renderer_pepper_host_factory.cc b/chrome/renderer/pepper/chrome_renderer_pepper_host_factory.cc
|
||||
index 8687c49c7b8b96b1d51eae1a482154c21bb7e20c..983ef9a013184344514b69e8ef2a48a75e67ed01 100644
|
||||
--- a/chrome/renderer/pepper/chrome_renderer_pepper_host_factory.cc
|
||||
+++ b/chrome/renderer/pepper/chrome_renderer_pepper_host_factory.cc
|
||||
@@ -5,7 +5,9 @@
|
||||
#include "chrome/renderer/pepper/chrome_renderer_pepper_host_factory.h"
|
||||
|
||||
#include "base/check_op.h"
|
||||
+#if 0
|
||||
#include "chrome/renderer/pepper/pepper_uma_host.h"
|
||||
+#endif
|
||||
#include "content/public/renderer/renderer_ppapi_host.h"
|
||||
#include "ppapi/host/ppapi_host.h"
|
||||
#include "ppapi/host/resource_host.h"
|
||||
@@ -33,6 +35,7 @@ ChromeRendererPepperHostFactory::CreateResourceHost(
|
||||
if (!host_->IsValidInstance(instance))
|
||||
return nullptr;
|
||||
|
||||
+#if 0
|
||||
// Permissions for the following interfaces will be checked at the
|
||||
// time of the corresponding instance's method calls. Currently these
|
||||
// interfaces are available only for whitelisted apps which may not have
|
||||
@@ -42,6 +45,7 @@ ChromeRendererPepperHostFactory::CreateResourceHost(
|
||||
return std::make_unique<PepperUMAHost>(host_, instance, resource);
|
||||
}
|
||||
}
|
||||
+#endif
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
diff --git a/chrome/renderer/pepper/pepper_helper.h b/chrome/renderer/pepper/pepper_helper.h
|
||||
index 3270fecaeae81ff98995268613cbe4f834195b53..9b8156a8e188f97647288c96d664a2d733e02afd 100644
|
||||
--- a/chrome/renderer/pepper/pepper_helper.h
|
||||
+++ b/chrome/renderer/pepper/pepper_helper.h
|
||||
@@ -5,11 +5,13 @@
|
||||
#ifndef CHROME_RENDERER_PEPPER_PEPPER_HELPER_H_
|
||||
#define CHROME_RENDERER_PEPPER_PEPPER_HELPER_H_
|
||||
|
||||
+#include "base/component_export.h"
|
||||
#include "content/public/renderer/render_frame_observer.h"
|
||||
|
||||
// This class listens for Pepper creation events from the RenderFrame and
|
||||
// attaches the parts required for Chrome-specific plugin support.
|
||||
-class PepperHelper : public content::RenderFrameObserver {
|
||||
+class COMPONENT_EXPORT(PEPPER_FLASH) PepperHelper
|
||||
+ : public content::RenderFrameObserver {
|
||||
public:
|
||||
explicit PepperHelper(content::RenderFrame* render_frame);
|
||||
|
||||
diff --git a/ppapi/buildflags/buildflags.gni b/ppapi/buildflags/buildflags.gni
|
||||
index 0bc0e153dff7ef5c093dce4f73b709ac36024d63..fba1a83be000ed58170ff800be1b43862f7d3359 100644
|
||||
--- a/ppapi/buildflags/buildflags.gni
|
||||
+++ b/ppapi/buildflags/buildflags.gni
|
||||
@@ -19,7 +19,7 @@ declare_args() {
|
||||
# Enables Pepper API (PPAPI) plugin support.
|
||||
# The only remaining PPAPI plugin supported is NaCl and if is disabled
|
||||
# we can disable PPAPI.
|
||||
- enable_ppapi = enable_plugins && enable_nacl && !is_fuchsia
|
||||
+ enable_ppapi = enable_plugins && !is_fuchsia
|
||||
}
|
||||
|
||||
assert(enable_plugins || !enable_ppapi)
|
||||
@@ -1,29 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jeremy Apthorp <nornagon@nornagon.net>
|
||||
Date: Tue, 16 Apr 2019 11:25:08 -0700
|
||||
Subject: unsandboxed_ppapi_processes_skip_zygote.patch
|
||||
|
||||
Unsandboxed ppapi processes should skip zygote.
|
||||
|
||||
diff --git a/content/browser/ppapi_plugin_sandboxed_process_launcher_delegate.cc b/content/browser/ppapi_plugin_sandboxed_process_launcher_delegate.cc
|
||||
index 62cc6bca4793447c35b6ab435b461e57c2c59f4f..d9bb02a43b48d731d7e85537f255bc7ba1b128c9 100644
|
||||
--- a/content/browser/ppapi_plugin_sandboxed_process_launcher_delegate.cc
|
||||
+++ b/content/browser/ppapi_plugin_sandboxed_process_launcher_delegate.cc
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "build/build_config.h"
|
||||
#include "content/public/common/content_switches.h"
|
||||
#include "sandbox/policy/mojom/sandbox.mojom.h"
|
||||
+#include "sandbox/policy/switches.h"
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
#include "sandbox/policy/win/sandbox_win.h"
|
||||
@@ -56,6 +57,9 @@ bool PpapiPluginSandboxedProcessLauncherDelegate::AllowWindowsFontsDir() {
|
||||
ZygoteCommunication* PpapiPluginSandboxedProcessLauncherDelegate::GetZygote() {
|
||||
const base::CommandLine& browser_command_line =
|
||||
*base::CommandLine::ForCurrentProcess();
|
||||
+ if (browser_command_line.HasSwitch(sandbox::policy::switches::kNoSandbox)) {
|
||||
+ return nullptr;
|
||||
+ }
|
||||
base::CommandLine::StringType plugin_launcher =
|
||||
browser_command_line.GetSwitchValueNative(switches::kPpapiPluginLauncher);
|
||||
if (!plugin_launcher.empty())
|
||||
@@ -29,7 +29,8 @@ env.PATH = `${env.PATH}${path.delimiter}${DEPOT_TOOLS}`;
|
||||
const gnCheckDirs = [
|
||||
'//electron:electron_lib',
|
||||
'//electron:electron_app',
|
||||
'//electron/shell/common/api:mojo'
|
||||
'//electron/shell/common:mojo',
|
||||
'//electron/shell/common:plugin'
|
||||
];
|
||||
|
||||
for (const dir of gnCheckDirs) {
|
||||
|
||||
@@ -41,9 +41,7 @@
|
||||
|
||||
#if BUILDFLAG(ENABLE_PLUGINS)
|
||||
#include "content/public/common/content_plugin_info.h"
|
||||
#include "ppapi/shared_impl/ppapi_permissions.h"
|
||||
#include "ppapi/shared_impl/ppapi_switches.h" // nogncheck crbug.com/1125897
|
||||
#endif // BUILDFLAG(ENABLE_PLUGINS)
|
||||
#endif // BUILDFLAG(ENABLE_PLUGINS)
|
||||
|
||||
namespace electron {
|
||||
|
||||
@@ -180,7 +178,7 @@ void ElectronContentClient::AddAdditionalSchemes(Schemes* schemes) {
|
||||
|
||||
void ElectronContentClient::AddPlugins(
|
||||
std::vector<content::ContentPluginInfo>* plugins) {
|
||||
#if BUILDFLAG(ENABLE_PLUGINS) && BUILDFLAG(ENABLE_PDF_VIEWER)
|
||||
#if BUILDFLAG(ENABLE_PDF_VIEWER)
|
||||
static constexpr char kPDFPluginExtension[] = "pdf";
|
||||
static constexpr char kPDFPluginDescription[] = "Portable Document Format";
|
||||
|
||||
@@ -195,7 +193,7 @@ void ElectronContentClient::AddPlugins(
|
||||
pdf::kInternalPluginMimeType, kPDFPluginExtension, kPDFPluginDescription);
|
||||
pdf_info.mime_types.push_back(pdf_mime_type);
|
||||
plugins->push_back(pdf_info);
|
||||
#endif // BUILDFLAG(ENABLE_PLUGINS) && BUILDFLAG(ENABLE_PDF_VIEWER)
|
||||
#endif // BUILDFLAG(ENABLE_PDF_VIEWER)
|
||||
}
|
||||
|
||||
void ElectronContentClient::AddContentDecryptionModules(
|
||||
|
||||
@@ -205,7 +205,6 @@ std::string ElectronCrashReporterClient::GetUploadUrl() {
|
||||
bool ElectronCrashReporterClient::EnableBreakpadForProcess(
|
||||
const std::string& process_type) {
|
||||
return process_type == switches::kRendererProcess ||
|
||||
process_type == switches::kPpapiPluginProcess ||
|
||||
process_type == switches::kZygoteProcess ||
|
||||
process_type == switches::kGpuProcess ||
|
||||
process_type == switches::kUtilityProcess || process_type == "node";
|
||||
|
||||
@@ -97,7 +97,6 @@ bool SubprocessNeedsResourceBundle(const std::string& process_type) {
|
||||
// profiles.
|
||||
process_type == ::switches::kGpuProcess ||
|
||||
#endif
|
||||
process_type == ::switches::kPpapiPluginProcess ||
|
||||
process_type == ::switches::kRendererProcess ||
|
||||
process_type == ::switches::kUtilityProcess;
|
||||
}
|
||||
|
||||
@@ -77,7 +77,6 @@
|
||||
#include "mojo/public/cpp/bindings/pending_receiver.h"
|
||||
#include "mojo/public/cpp/bindings/remote.h"
|
||||
#include "mojo/public/cpp/system/platform_handle.h"
|
||||
#include "ppapi/buildflags/buildflags.h"
|
||||
#include "printing/buildflags/buildflags.h"
|
||||
#include "services/resource_coordinator/public/cpp/memory_instrumentation/memory_instrumentation.h"
|
||||
#include "services/service_manager/public/cpp/interface_provider.h"
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
#include "content/browser/keyboard_lock/keyboard_lock_service_impl.h" // nogncheck
|
||||
#include "content/browser/site_instance_impl.h" // nogncheck
|
||||
#include "content/public/browser/browser_main_runner.h"
|
||||
#include "content/public/browser/browser_ppapi_host.h"
|
||||
#include "content/public/browser/browser_task_traits.h"
|
||||
#include "content/public/browser/client_certificate_delegate.h"
|
||||
#include "content/public/browser/login_delegate.h"
|
||||
@@ -59,10 +58,9 @@
|
||||
#include "extensions/browser/extension_navigation_ui_data.h"
|
||||
#include "extensions/common/extension_id.h"
|
||||
#include "mojo/public/cpp/bindings/binder_map.h"
|
||||
#include "mojo/public/cpp/bindings/self_owned_associated_receiver.h"
|
||||
#include "net/ssl/ssl_cert_request_info.h"
|
||||
#include "net/ssl/ssl_private_key.h"
|
||||
#include "ppapi/buildflags/buildflags.h"
|
||||
#include "ppapi/host/ppapi_host.h"
|
||||
#include "printing/buildflags/buildflags.h"
|
||||
#include "services/device/public/cpp/geolocation/geolocation_system_permission_manager.h"
|
||||
#include "services/device/public/cpp/geolocation/location_provider.h"
|
||||
@@ -86,6 +84,7 @@
|
||||
#include "shell/browser/electron_browser_context.h"
|
||||
#include "shell/browser/electron_browser_main_parts.h"
|
||||
#include "shell/browser/electron_navigation_throttle.h"
|
||||
#include "shell/browser/electron_plugin_info_host_impl.h"
|
||||
#include "shell/browser/electron_speech_recognition_manager_delegate.h"
|
||||
#include "shell/browser/electron_web_contents_utility_handler_impl.h"
|
||||
#include "shell/browser/font_defaults.h"
|
||||
@@ -117,6 +116,7 @@
|
||||
#include "shell/common/logging.h"
|
||||
#include "shell/common/options_switches.h"
|
||||
#include "shell/common/platform_util.h"
|
||||
#include "shell/common/plugin.mojom.h"
|
||||
#include "shell/common/thread_restrictions.h"
|
||||
#include "third_party/blink/public/common/associated_interfaces/associated_interface_registry.h"
|
||||
#include "third_party/blink/public/common/loader/url_loader_throttle.h"
|
||||
@@ -580,9 +580,6 @@ void ElectronBrowserClient::AppendExtraCommandLineSwitches(
|
||||
}
|
||||
}
|
||||
|
||||
void ElectronBrowserClient::DidCreatePpapiPlugin(
|
||||
content::BrowserPpapiHost* host) {}
|
||||
|
||||
// attempt to get api key from env
|
||||
std::string ElectronBrowserClient::GetGeolocationApiKey() {
|
||||
auto env = base::Environment::Create();
|
||||
@@ -1460,6 +1457,16 @@ void ElectronBrowserClient::
|
||||
render_frame_host);
|
||||
},
|
||||
&render_frame_host));
|
||||
associated_registry.AddInterface<mojom::ElectronPluginInfoHost>(
|
||||
base::BindRepeating(
|
||||
[](content::RenderFrameHost* render_frame_host,
|
||||
mojo::PendingAssociatedReceiver<mojom::ElectronPluginInfoHost>
|
||||
receiver) {
|
||||
mojo::MakeSelfOwnedAssociatedReceiver(
|
||||
std::make_unique<ElectronPluginInfoHostImpl>(),
|
||||
std::move(receiver));
|
||||
},
|
||||
&render_frame_host));
|
||||
#if BUILDFLAG(ENABLE_PRINTING)
|
||||
associated_registry.AddInterface<printing::mojom::PrintManagerHost>(
|
||||
base::BindRepeating(
|
||||
|
||||
@@ -134,7 +134,6 @@ class ElectronBrowserClient : public content::ContentBrowserClient,
|
||||
content::SiteInstance* pending_site_instance) override;
|
||||
void AppendExtraCommandLineSwitches(base::CommandLine* command_line,
|
||||
int child_process_id) override;
|
||||
void DidCreatePpapiPlugin(content::BrowserPpapiHost* browser_host) override;
|
||||
std::string GetGeolocationApiKey() override;
|
||||
content::GeneratedCodeCacheSettings GetGeneratedCodeCacheSettings(
|
||||
content::BrowserContext* context) override;
|
||||
|
||||
61
shell/browser/electron_plugin_info_host_impl.cc
Normal file
61
shell/browser/electron_plugin_info_host_impl.cc
Normal file
@@ -0,0 +1,61 @@
|
||||
// Copyright 2012 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "shell/browser/electron_plugin_info_host_impl.h"
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "base/functional/bind.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
#include "content/public/browser/plugin_service.h"
|
||||
#include "content/public/common/content_constants.h"
|
||||
#include "url/gurl.h"
|
||||
#include "url/origin.h"
|
||||
|
||||
using content::PluginService;
|
||||
using content::WebPluginInfo;
|
||||
|
||||
namespace electron {
|
||||
|
||||
ElectronPluginInfoHostImpl::ElectronPluginInfoHostImpl() = default;
|
||||
|
||||
ElectronPluginInfoHostImpl::~ElectronPluginInfoHostImpl() = default;
|
||||
|
||||
struct ElectronPluginInfoHostImpl::GetPluginInfo_Params {
|
||||
GURL url;
|
||||
url::Origin main_frame_origin;
|
||||
std::string mime_type;
|
||||
};
|
||||
|
||||
void ElectronPluginInfoHostImpl::GetPluginInfo(const GURL& url,
|
||||
const url::Origin& origin,
|
||||
const std::string& mime_type,
|
||||
GetPluginInfoCallback callback) {
|
||||
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
||||
GetPluginInfo_Params params = {url, origin, mime_type};
|
||||
PluginService::GetInstance()->GetPlugins(
|
||||
base::BindOnce(&ElectronPluginInfoHostImpl::PluginsLoaded,
|
||||
weak_factory_.GetWeakPtr(), params, std::move(callback)));
|
||||
}
|
||||
|
||||
void ElectronPluginInfoHostImpl::PluginsLoaded(
|
||||
const GetPluginInfo_Params& params,
|
||||
GetPluginInfoCallback callback,
|
||||
const std::vector<WebPluginInfo>& plugins) {
|
||||
mojom::PluginInfoPtr output = mojom::PluginInfo::New();
|
||||
std::vector<WebPluginInfo> matching_plugins;
|
||||
std::vector<std::string> mime_types;
|
||||
PluginService::GetInstance()->GetPluginInfoArray(
|
||||
params.url, params.mime_type, true, &matching_plugins, &mime_types);
|
||||
if (!matching_plugins.empty()) {
|
||||
output->plugin = matching_plugins[0];
|
||||
output->actual_mime_type = mime_types[0];
|
||||
}
|
||||
|
||||
std::move(callback).Run(std::move(output));
|
||||
}
|
||||
|
||||
} // namespace electron
|
||||
56
shell/browser/electron_plugin_info_host_impl.h
Normal file
56
shell/browser/electron_plugin_info_host_impl.h
Normal file
@@ -0,0 +1,56 @@
|
||||
// Copyright 2012 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef SHELL_BROWSER_ELECTRON_PLUGIN_INFO_HOST_IMPL_H_
|
||||
#define SHELL_BROWSER_ELECTRON_PLUGIN_INFO_HOST_IMPL_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "shell/common/plugin.mojom.h"
|
||||
|
||||
class GURL;
|
||||
|
||||
namespace content {
|
||||
struct WebPluginInfo;
|
||||
} // namespace content
|
||||
|
||||
namespace url {
|
||||
class Origin;
|
||||
}
|
||||
|
||||
namespace electron {
|
||||
|
||||
// Implements ElectronPluginInfoHost interface.
|
||||
class ElectronPluginInfoHostImpl : public mojom::ElectronPluginInfoHost {
|
||||
public:
|
||||
struct GetPluginInfo_Params;
|
||||
|
||||
ElectronPluginInfoHostImpl();
|
||||
|
||||
ElectronPluginInfoHostImpl(const ElectronPluginInfoHostImpl&) = delete;
|
||||
ElectronPluginInfoHostImpl& operator=(const ElectronPluginInfoHostImpl&) =
|
||||
delete;
|
||||
|
||||
~ElectronPluginInfoHostImpl() override;
|
||||
|
||||
// mojom::ElectronPluginInfoHost
|
||||
void GetPluginInfo(const GURL& url,
|
||||
const url::Origin& origin,
|
||||
const std::string& mime_type,
|
||||
GetPluginInfoCallback callback) override;
|
||||
|
||||
private:
|
||||
// |params| wraps the parameters passed to |OnGetPluginInfo|, because
|
||||
// |base::Bind| doesn't support the required arity <http://crbug.com/98542>.
|
||||
void PluginsLoaded(const GetPluginInfo_Params& params,
|
||||
GetPluginInfoCallback callback,
|
||||
const std::vector<content::WebPluginInfo>& plugins);
|
||||
|
||||
base::WeakPtrFactory<ElectronPluginInfoHostImpl> weak_factory_{this};
|
||||
};
|
||||
|
||||
} // namespace electron
|
||||
|
||||
#endif // SHELL_BROWSER_ELECTRON_PLUGIN_INFO_HOST_IMPL_H_
|
||||
@@ -1,8 +1,7 @@
|
||||
import("//mojo/public/tools/bindings/mojom.gni")
|
||||
import("../../../buildflags/buildflags.gni")
|
||||
|
||||
mojom("mojo") {
|
||||
sources = [ "api.mojom" ]
|
||||
sources = [ "api/api.mojom" ]
|
||||
|
||||
public_deps = [
|
||||
"//mojo/public/mojom/base",
|
||||
@@ -15,3 +14,15 @@ mojom("mojo") {
|
||||
overridden_deps = [ "//third_party/blink/public/mojom:mojom_core" ]
|
||||
component_deps = [ "//third_party/blink/public/common" ]
|
||||
}
|
||||
|
||||
mojom("plugin") {
|
||||
# We don't want Blink variants of these bindings to be generated.
|
||||
disable_variants = true
|
||||
|
||||
sources = [ "plugin.mojom" ]
|
||||
|
||||
public_deps = [
|
||||
"//content/public/common:interfaces",
|
||||
"//mojo/public/mojom/base",
|
||||
]
|
||||
}
|
||||
@@ -195,12 +195,6 @@ namespace switches {
|
||||
// Enable chromium sandbox.
|
||||
const char kEnableSandbox[] = "enable-sandbox";
|
||||
|
||||
// Ppapi Flash path.
|
||||
const char kPpapiFlashPath[] = "ppapi-flash-path";
|
||||
|
||||
// Ppapi Flash version.
|
||||
const char kPpapiFlashVersion[] = "ppapi-flash-version";
|
||||
|
||||
// Disable HTTP cache.
|
||||
const char kDisableHttpCache[] = "disable-http-cache";
|
||||
|
||||
|
||||
@@ -102,8 +102,6 @@ extern const char kSpellcheck[];
|
||||
namespace switches {
|
||||
|
||||
extern const char kEnableSandbox[];
|
||||
extern const char kPpapiFlashPath[];
|
||||
extern const char kPpapiFlashVersion[];
|
||||
extern const char kDisableHttpCache[];
|
||||
extern const char kStandardSchemes[];
|
||||
extern const char kServiceWorkerSchemes[];
|
||||
|
||||
21
shell/common/plugin.mojom
Normal file
21
shell/common/plugin.mojom
Normal file
@@ -0,0 +1,21 @@
|
||||
module electron.mojom;
|
||||
|
||||
import "content/public/common/webplugininfo.mojom";
|
||||
import "mojo/public/mojom/base/string16.mojom";
|
||||
import "url/mojom/origin.mojom";
|
||||
import "url/mojom/url.mojom";
|
||||
|
||||
struct PluginInfo {
|
||||
content.mojom.WebPluginInfo plugin;
|
||||
string actual_mime_type;
|
||||
};
|
||||
|
||||
interface ElectronPluginInfoHost {
|
||||
// Return information about a plugin for the given URL and MIME type.
|
||||
// Includes specific reasons why a plugin can't be used, for example because
|
||||
// it's disabled.
|
||||
[Sync]
|
||||
GetPluginInfo(url.mojom.Url url,
|
||||
url.mojom.Origin origin,
|
||||
string mime_type) => (PluginInfo plugin_info);
|
||||
};
|
||||
@@ -1,107 +0,0 @@
|
||||
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "shell/renderer/electron_renderer_pepper_host_factory.h"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "content/public/renderer/renderer_ppapi_host.h"
|
||||
#include "ppapi/host/dispatch_host_message.h"
|
||||
#include "ppapi/host/ppapi_host.h"
|
||||
#include "ppapi/host/resource_host.h"
|
||||
#include "ppapi/proxy/ppapi_message_utils.h"
|
||||
#include "ppapi/proxy/ppapi_messages.h"
|
||||
#include "ppapi/shared_impl/ppapi_permissions.h"
|
||||
|
||||
using ppapi::host::ResourceHost;
|
||||
|
||||
// Stub class which ignores all messages
|
||||
class PepperUMAHost : public ppapi::host::ResourceHost {
|
||||
public:
|
||||
PepperUMAHost(content::RendererPpapiHost* host,
|
||||
PP_Instance instance,
|
||||
PP_Resource resource)
|
||||
: ResourceHost(host->GetPpapiHost(), instance, resource) {}
|
||||
~PepperUMAHost() override = default;
|
||||
|
||||
// ppapi::host::ResourceMessageHandler implementation.
|
||||
int32_t OnResourceMessageReceived(
|
||||
const IPC::Message& msg,
|
||||
ppapi::host::HostMessageContext* context) override {
|
||||
PPAPI_BEGIN_MESSAGE_MAP(PepperUMAHost, msg)
|
||||
PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_UMA_HistogramCustomTimes,
|
||||
OnHistogramCustomTimes)
|
||||
PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_UMA_HistogramCustomCounts,
|
||||
OnHistogramCustomCounts)
|
||||
PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_UMA_HistogramEnumeration,
|
||||
OnHistogramEnumeration)
|
||||
PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(
|
||||
PpapiHostMsg_UMA_IsCrashReportingEnabled, OnIsCrashReportingEnabled)
|
||||
PPAPI_END_MESSAGE_MAP()
|
||||
return PP_ERROR_FAILED;
|
||||
}
|
||||
|
||||
private:
|
||||
int32_t OnHistogramCustomTimes(ppapi::host::HostMessageContext* context,
|
||||
const std::string& name,
|
||||
int64_t sample,
|
||||
int64_t min,
|
||||
int64_t max,
|
||||
uint32_t bucket_count) {
|
||||
return PP_OK;
|
||||
}
|
||||
|
||||
int32_t OnHistogramCustomCounts(ppapi::host::HostMessageContext* context,
|
||||
const std::string& name,
|
||||
int32_t sample,
|
||||
int32_t min,
|
||||
int32_t max,
|
||||
uint32_t bucket_count) {
|
||||
return PP_OK;
|
||||
}
|
||||
|
||||
int32_t OnHistogramEnumeration(ppapi::host::HostMessageContext* context,
|
||||
const std::string& name,
|
||||
int32_t sample,
|
||||
int32_t boundary_value) {
|
||||
return PP_OK;
|
||||
}
|
||||
|
||||
int32_t OnIsCrashReportingEnabled(ppapi::host::HostMessageContext* context) {
|
||||
return PP_OK;
|
||||
}
|
||||
};
|
||||
|
||||
ElectronRendererPepperHostFactory::ElectronRendererPepperHostFactory(
|
||||
content::RendererPpapiHost* host)
|
||||
: host_(host) {}
|
||||
|
||||
ElectronRendererPepperHostFactory::~ElectronRendererPepperHostFactory() =
|
||||
default;
|
||||
|
||||
std::unique_ptr<ResourceHost>
|
||||
ElectronRendererPepperHostFactory::CreateResourceHost(
|
||||
ppapi::host::PpapiHost* host,
|
||||
PP_Resource resource,
|
||||
PP_Instance instance,
|
||||
const IPC::Message& message) {
|
||||
DCHECK_EQ(host_->GetPpapiHost(), host);
|
||||
|
||||
// Make sure the plugin is giving us a valid instance for this resource.
|
||||
if (!host_->IsValidInstance(instance))
|
||||
return nullptr;
|
||||
|
||||
// Permissions for the following interfaces will be checked at the
|
||||
// time of the corresponding instance's method calls. Currently these
|
||||
// interfaces are available only for specifically permitted apps which may
|
||||
// not have access to the other private interfaces.
|
||||
switch (message.type()) {
|
||||
case PpapiHostMsg_UMA_Create::ID: {
|
||||
return std::make_unique<PepperUMAHost>(host_, instance, resource);
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef ELECTRON_SHELL_RENDERER_ELECTRON_RENDERER_PEPPER_HOST_FACTORY_H_
|
||||
#define ELECTRON_SHELL_RENDERER_ELECTRON_RENDERER_PEPPER_HOST_FACTORY_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "base/memory/raw_ptr.h"
|
||||
#include "ppapi/host/host_factory.h"
|
||||
|
||||
namespace content {
|
||||
class RendererPpapiHost;
|
||||
}
|
||||
|
||||
class ElectronRendererPepperHostFactory : public ppapi::host::HostFactory {
|
||||
public:
|
||||
explicit ElectronRendererPepperHostFactory(content::RendererPpapiHost* host);
|
||||
~ElectronRendererPepperHostFactory() override;
|
||||
|
||||
// disable copy
|
||||
ElectronRendererPepperHostFactory(const ElectronRendererPepperHostFactory&) =
|
||||
delete;
|
||||
ElectronRendererPepperHostFactory& operator=(
|
||||
const ElectronRendererPepperHostFactory&) = delete;
|
||||
|
||||
// ppapi::host::HostFactory
|
||||
std::unique_ptr<ppapi::host::ResourceHost> CreateResourceHost(
|
||||
ppapi::host::PpapiHost* host,
|
||||
PP_Resource resource,
|
||||
PP_Instance instance,
|
||||
const IPC::Message& message) override;
|
||||
|
||||
private:
|
||||
// Not owned by this object.
|
||||
raw_ptr<content::RendererPpapiHost> host_;
|
||||
};
|
||||
|
||||
#endif // ELECTRON_SHELL_RENDERER_ELECTRON_RENDERER_PEPPER_HOST_FACTORY_H_
|
||||
@@ -1,33 +0,0 @@
|
||||
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "shell/renderer/pepper_helper.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "chrome/renderer/pepper/chrome_renderer_pepper_host_factory.h"
|
||||
#include "chrome/renderer/pepper/pepper_shared_memory_message_filter.h"
|
||||
#include "content/public/renderer/renderer_ppapi_host.h"
|
||||
#include "electron/shell/renderer/electron_renderer_pepper_host_factory.h"
|
||||
#include "ppapi/host/ppapi_host.h"
|
||||
|
||||
PepperHelper::PepperHelper(content::RenderFrame* render_frame)
|
||||
: RenderFrameObserver(render_frame) {}
|
||||
|
||||
PepperHelper::~PepperHelper() = default;
|
||||
|
||||
void PepperHelper::DidCreatePepperPlugin(content::RendererPpapiHost* host) {
|
||||
// TODO(brettw) figure out how to hook up the host factory. It needs some
|
||||
// kind of filter-like system to allow dynamic additions.
|
||||
host->GetPpapiHost()->AddHostFactoryFilter(
|
||||
std::make_unique<ChromeRendererPepperHostFactory>(host));
|
||||
host->GetPpapiHost()->AddHostFactoryFilter(
|
||||
std::make_unique<ElectronRendererPepperHostFactory>(host));
|
||||
host->GetPpapiHost()->AddInstanceMessageFilter(
|
||||
std::make_unique<PepperSharedMemoryMessageFilter>(host));
|
||||
}
|
||||
|
||||
void PepperHelper::OnDestruct() {
|
||||
delete this;
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef ELECTRON_SHELL_RENDERER_PEPPER_HELPER_H_
|
||||
#define ELECTRON_SHELL_RENDERER_PEPPER_HELPER_H_
|
||||
|
||||
#include "content/public/renderer/render_frame_observer.h"
|
||||
|
||||
// This class listens for Pepper creation events from the RenderFrame and
|
||||
// attaches the parts required for plugin support.
|
||||
class PepperHelper : private content::RenderFrameObserver {
|
||||
public:
|
||||
explicit PepperHelper(content::RenderFrame* render_frame);
|
||||
~PepperHelper() override;
|
||||
|
||||
// disable copy
|
||||
PepperHelper(const PepperHelper&) = delete;
|
||||
PepperHelper& operator=(const PepperHelper&) = delete;
|
||||
|
||||
private:
|
||||
// RenderFrameObserver.
|
||||
void DidCreatePepperPlugin(content::RendererPpapiHost* host) override;
|
||||
void OnDestruct() override;
|
||||
};
|
||||
|
||||
#endif // ELECTRON_SHELL_RENDERER_PEPPER_HELPER_H_
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "shell/common/node_includes.h"
|
||||
#include "shell/common/node_util.h"
|
||||
#include "shell/common/options_switches.h"
|
||||
#include "shell/common/plugin.mojom.h"
|
||||
#include "shell/common/world_ids.h"
|
||||
#include "shell/renderer/api/context_bridge/object_cache.h"
|
||||
#include "shell/renderer/api/electron_api_context_bridge.h"
|
||||
@@ -35,6 +36,7 @@
|
||||
#include "shell/renderer/content_settings_observer.h"
|
||||
#include "shell/renderer/electron_api_service_impl.h"
|
||||
#include "shell/renderer/electron_autofill_agent.h"
|
||||
#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
|
||||
#include "third_party/blink/public/common/associated_interfaces/associated_interface_registry.h"
|
||||
#include "third_party/blink/public/common/web_preferences/web_preferences.h"
|
||||
#include "third_party/blink/public/platform/web_runtime_features.h"
|
||||
@@ -80,7 +82,6 @@
|
||||
|
||||
#if BUILDFLAG(ENABLE_PLUGINS)
|
||||
#include "shell/common/plugin_info.h"
|
||||
#include "shell/renderer/pepper_helper.h"
|
||||
#endif // BUILDFLAG(ENABLE_PLUGINS)
|
||||
|
||||
#if BUILDFLAG(ENABLE_PRINTING)
|
||||
@@ -332,9 +333,6 @@ void RendererClientBase::RenderFrameCreated(
|
||||
#if defined(TOOLKIT_VIEWS)
|
||||
new AutofillAgent(render_frame,
|
||||
render_frame->GetAssociatedInterfaceRegistry());
|
||||
#endif
|
||||
#if BUILDFLAG(ENABLE_PLUGINS)
|
||||
new PepperHelper(render_frame);
|
||||
#endif
|
||||
new ContentSettingsObserver(render_frame);
|
||||
#if BUILDFLAG(ENABLE_PRINTING)
|
||||
@@ -423,32 +421,29 @@ bool RendererClientBase::IsPluginHandledExternally(
|
||||
#if BUILDFLAG(ENABLE_PDF_VIEWER)
|
||||
DCHECK(plugin_element.HasHTMLTagName("object") ||
|
||||
plugin_element.HasHTMLTagName("embed"));
|
||||
if (mime_type == pdf::kInternalPluginMimeType) {
|
||||
|
||||
mojo::AssociatedRemote<mojom::ElectronPluginInfoHost> plugin_info_host;
|
||||
render_frame->GetRemoteAssociatedInterfaces()->GetInterface(
|
||||
&plugin_info_host);
|
||||
mojom::PluginInfoPtr plugin_info = mojom::PluginInfo::New();
|
||||
plugin_info_host->GetPluginInfo(
|
||||
original_url, render_frame->GetWebFrame()->Top()->GetSecurityOrigin(),
|
||||
mime_type, &plugin_info);
|
||||
|
||||
if (plugin_info->actual_mime_type == pdf::kInternalPluginMimeType) {
|
||||
if (IsPdfInternalPluginAllowedOrigin(
|
||||
render_frame->GetWebFrame()->GetSecurityOrigin())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
content::WebPluginInfo info;
|
||||
info.type = content::WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS;
|
||||
info.name = base::ASCIIToUTF16(kPDFInternalPluginName);
|
||||
info.path = base::FilePath(kPdfPluginPath);
|
||||
info.background_color = content::WebPluginInfo::kDefaultBackgroundColor;
|
||||
info.mime_types.emplace_back(pdf::kInternalPluginMimeType, "pdf",
|
||||
"Portable Document Format");
|
||||
return extensions::MimeHandlerViewContainerManager::Get(
|
||||
content::RenderFrame::FromWebFrame(
|
||||
plugin_element.GetDocument().GetFrame()),
|
||||
true /* create_if_does_not_exist */)
|
||||
->CreateFrameContainer(plugin_element, original_url, mime_type, info);
|
||||
}
|
||||
|
||||
return extensions::MimeHandlerViewContainerManager::Get(
|
||||
content::RenderFrame::FromWebFrame(
|
||||
plugin_element.GetDocument().GetFrame()),
|
||||
true /* create_if_does_not_exist */)
|
||||
->CreateFrameContainer(plugin_element, original_url, mime_type,
|
||||
GetPDFPluginInfo());
|
||||
->CreateFrameContainer(plugin_element, original_url,
|
||||
plugin_info->actual_mime_type,
|
||||
plugin_info->plugin);
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
|
||||
@@ -28,7 +28,6 @@ group("chromium_unittests") {
|
||||
"//media/mojo:media_mojo_unittests",
|
||||
"//mojo:mojo_unittests",
|
||||
"//net:net_unittests",
|
||||
"//ppapi:ppapi_unittests",
|
||||
"//printing:printing_unittests",
|
||||
"//skia:skia_unittests",
|
||||
"//sql:sql_unittests",
|
||||
|
||||
@@ -48,7 +48,6 @@ tests:
|
||||
- SSLClientSocketTest.*
|
||||
- UDPSocketTest.ClientGetLocalPeerAddresses
|
||||
- UDPSocketTest.ClientSetDoNotFragment
|
||||
- ppapi_unittests
|
||||
- printing_unittests
|
||||
- skia_unittests
|
||||
- sql_unittests
|
||||
|
||||
Reference in New Issue
Block a user