chore: bump chromium to 129.0.6650.0 (main) (#43266)
* chore: bump chromium in DEPS to 129.0.6645.0 * chore: update patches * chore: bump chromium in DEPS to 129.0.6646.0 * refactor: remove ppapi dependency PPAPI removal - https://issues.chromium.org/issues/40511450 PDF viewer migration - https://issues.chromium.org/issues/40511452 * chore: update patches * chore: enable `content_enable_legacy_ipc` We were indirectly relying on this via `enable_ppapi=true`, with 633a57d9b62da7850ef7946f6b101ed440d04cdd ppapi is now disabled and this commit makes the dependency explicit. * fix: gn check --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: deepak1556 <hop2deep@gmail.com>
This commit is contained in:
parent
23bcca3ffc
commit
c9b7806418
65 changed files with 333 additions and 673 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue