refactor: remove references to non-existent webui (#20867)
This commit is contained in:
parent
f645ca015f
commit
85647dfced
17 changed files with 395 additions and 174 deletions
107
shell/renderer/electron_renderer_pepper_host_factory.cc
Normal file
107
shell/renderer/electron_renderer_pepper_host_factory.cc
Normal file
|
@ -0,0 +1,107 @@
|
|||
// 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 "base/logging.h"
|
||||
#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() {}
|
||||
|
||||
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 whitelisted 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;
|
||||
}
|
37
shell/renderer/electron_renderer_pepper_host_factory.h
Normal file
37
shell/renderer/electron_renderer_pepper_host_factory.h
Normal file
|
@ -0,0 +1,37 @@
|
|||
// 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 SHELL_RENDERER_ELECTRON_RENDERER_PEPPER_HOST_FACTORY_H_
|
||||
#define SHELL_RENDERER_ELECTRON_RENDERER_PEPPER_HOST_FACTORY_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "base/compiler_specific.h"
|
||||
#include "base/macros.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;
|
||||
|
||||
// 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.
|
||||
content::RendererPpapiHost* host_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(ElectronRendererPepperHostFactory);
|
||||
};
|
||||
|
||||
#endif // SHELL_RENDERER_ELECTRON_RENDERER_PEPPER_HOST_FACTORY_H_
|
33
shell/renderer/pepper_helper.cc
Normal file
33
shell/renderer/pepper_helper.cc
Normal file
|
@ -0,0 +1,33 @@
|
|||
// 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() {}
|
||||
|
||||
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;
|
||||
}
|
28
shell/renderer/pepper_helper.h
Normal file
28
shell/renderer/pepper_helper.h
Normal file
|
@ -0,0 +1,28 @@
|
|||
// 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 SHELL_RENDERER_PEPPER_HELPER_H_
|
||||
#define SHELL_RENDERER_PEPPER_HELPER_H_
|
||||
|
||||
#include "base/compiler_specific.h"
|
||||
#include "base/component_export.h"
|
||||
#include "base/macros.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 : public content::RenderFrameObserver {
|
||||
public:
|
||||
explicit PepperHelper(content::RenderFrame* render_frame);
|
||||
~PepperHelper() override;
|
||||
|
||||
// RenderFrameObserver.
|
||||
void DidCreatePepperPlugin(content::RendererPpapiHost* host) override;
|
||||
void OnDestruct() override;
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(PepperHelper);
|
||||
};
|
||||
|
||||
#endif // SHELL_RENDERER_PEPPER_HELPER_H_
|
|
@ -55,9 +55,9 @@
|
|||
#include "shell/common/atom_constants.h"
|
||||
#endif // BUILDFLAG(ENABLE_PDF_VIEWER)
|
||||
|
||||
#if BUILDFLAG(ENABLE_PEPPER_FLASH)
|
||||
#include "chrome/renderer/pepper/pepper_helper.h"
|
||||
#endif // BUILDFLAG(ENABLE_PEPPER_FLASH)
|
||||
#if BUILDFLAG(ENABLE_PLUGINS)
|
||||
#include "shell/renderer/pepper_helper.h"
|
||||
#endif // BUILDFLAG(ENABLE_PLUGINS)
|
||||
|
||||
#if BUILDFLAG(ENABLE_PRINTING)
|
||||
#include "components/printing/renderer/print_render_frame_helper.h"
|
||||
|
@ -227,7 +227,7 @@ void RendererClientBase::RenderFrameCreated(
|
|||
new AutofillAgent(render_frame,
|
||||
render_frame->GetAssociatedInterfaceRegistry());
|
||||
#endif
|
||||
#if BUILDFLAG(ENABLE_PEPPER_FLASH)
|
||||
#if BUILDFLAG(ENABLE_PLUGINS)
|
||||
new PepperHelper(render_frame);
|
||||
#endif
|
||||
new ContentSettingsObserver(render_frame);
|
||||
|
@ -244,12 +244,6 @@ void RendererClientBase::RenderFrameCreated(
|
|||
base::BindRepeating(&ElectronApiServiceImpl::BindTo,
|
||||
service->GetWeakPtr()));
|
||||
|
||||
#if BUILDFLAG(ENABLE_PDF_VIEWER)
|
||||
// Allow access to file scheme from pdf viewer.
|
||||
blink::WebSecurityPolicy::AddOriginAccessWhitelistEntry(
|
||||
GURL(kPdfViewerUIOrigin), "file", "", true);
|
||||
#endif // BUILDFLAG(ENABLE_PDF_VIEWER)
|
||||
|
||||
content::RenderView* render_view = render_frame->GetRenderView();
|
||||
if (render_frame->IsMainFrame() && render_view) {
|
||||
blink::WebView* webview = render_view->GetWebView();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue