fix: build when pdf component is disabled (#33513)
This commit is contained in:
parent
b711860d21
commit
afe0116d59
9 changed files with 58 additions and 60 deletions
6
BUILD.gn
6
BUILD.gn
|
@ -363,10 +363,6 @@ source_set("electron_lib") {
|
||||||
"//components/network_session_configurator/common",
|
"//components/network_session_configurator/common",
|
||||||
"//components/omnibox/browser:buildflags",
|
"//components/omnibox/browser:buildflags",
|
||||||
"//components/os_crypt",
|
"//components/os_crypt",
|
||||||
"//components/pdf/browser",
|
|
||||||
"//components/pdf/browser:interceptors",
|
|
||||||
"//components/pdf/common",
|
|
||||||
"//components/pdf/renderer",
|
|
||||||
"//components/pref_registry",
|
"//components/pref_registry",
|
||||||
"//components/prefs",
|
"//components/prefs",
|
||||||
"//components/security_state/content",
|
"//components/security_state/content",
|
||||||
|
@ -700,6 +696,8 @@ source_set("electron_lib") {
|
||||||
deps += [
|
deps += [
|
||||||
"//chrome/browser/resources/pdf:resources",
|
"//chrome/browser/resources/pdf:resources",
|
||||||
"//components/pdf/browser",
|
"//components/pdf/browser",
|
||||||
|
"//components/pdf/browser:interceptors",
|
||||||
|
"//components/pdf/common",
|
||||||
"//components/pdf/renderer",
|
"//components/pdf/renderer",
|
||||||
"//pdf",
|
"//pdf",
|
||||||
]
|
]
|
||||||
|
|
|
@ -307,6 +307,10 @@ static_library("chrome") {
|
||||||
"//chrome/browser/plugins/pdf_iframe_navigation_throttle.cc",
|
"//chrome/browser/plugins/pdf_iframe_navigation_throttle.cc",
|
||||||
"//chrome/browser/plugins/pdf_iframe_navigation_throttle.h",
|
"//chrome/browser/plugins/pdf_iframe_navigation_throttle.h",
|
||||||
]
|
]
|
||||||
|
deps += [
|
||||||
|
"//components/pdf/browser",
|
||||||
|
"//components/pdf/renderer",
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -334,15 +338,6 @@ source_set("plugins") {
|
||||||
"//chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.cc",
|
"//chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.cc",
|
||||||
"//chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.h",
|
"//chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.h",
|
||||||
]
|
]
|
||||||
deps += [
|
|
||||||
"//media:media_buildflags",
|
|
||||||
"//ppapi/buildflags",
|
|
||||||
"//ppapi/proxy:ipc",
|
|
||||||
"//services/device/public/mojom",
|
|
||||||
]
|
|
||||||
if (enable_pdf_viewer) {
|
|
||||||
deps += [ "//components/pdf/browser" ]
|
|
||||||
}
|
|
||||||
|
|
||||||
# renderer side
|
# renderer side
|
||||||
sources += [
|
sources += [
|
||||||
|
@ -351,16 +346,16 @@ source_set("plugins") {
|
||||||
"//chrome/renderer/pepper/pepper_shared_memory_message_filter.cc",
|
"//chrome/renderer/pepper/pepper_shared_memory_message_filter.cc",
|
||||||
"//chrome/renderer/pepper/pepper_shared_memory_message_filter.h",
|
"//chrome/renderer/pepper/pepper_shared_memory_message_filter.h",
|
||||||
]
|
]
|
||||||
if (enable_pdf_viewer) {
|
|
||||||
deps += [ "//components/pdf/renderer" ]
|
|
||||||
}
|
|
||||||
deps += [
|
deps += [
|
||||||
"//components/strings",
|
"//components/strings",
|
||||||
"//media:media_buildflags",
|
"//media:media_buildflags",
|
||||||
|
"//ppapi/buildflags",
|
||||||
"//ppapi/host",
|
"//ppapi/host",
|
||||||
"//ppapi/proxy",
|
"//ppapi/proxy",
|
||||||
"//ppapi/proxy:ipc",
|
"//ppapi/proxy:ipc",
|
||||||
"//ppapi/shared_impl",
|
"//ppapi/shared_impl",
|
||||||
|
"//services/device/public/mojom",
|
||||||
"//skia",
|
"//skia",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,8 @@
|
||||||
#endif // defined(WIDEVINE_CDM_AVAILABLE)
|
#endif // defined(WIDEVINE_CDM_AVAILABLE)
|
||||||
|
|
||||||
#if BUILDFLAG(ENABLE_PDF_VIEWER)
|
#if BUILDFLAG(ENABLE_PDF_VIEWER)
|
||||||
#include "components/pdf/renderer/internal_plugin_renderer_helpers.h"
|
#include "chrome/common/pdf_util.h"
|
||||||
|
#include "components/pdf/common/internal_plugin_helpers.h"
|
||||||
#include "pdf/pdf.h" // nogncheck
|
#include "pdf/pdf.h" // nogncheck
|
||||||
#include "shell/common/electron_constants.h"
|
#include "shell/common/electron_constants.h"
|
||||||
#endif // BUILDFLAG(ENABLE_PDF_VIEWER)
|
#endif // BUILDFLAG(ENABLE_PDF_VIEWER)
|
||||||
|
@ -111,11 +112,11 @@ void ComputeBuiltInPlugins(std::vector<content::PepperPluginInfo>* plugins) {
|
||||||
content::PepperPluginInfo pdf_info;
|
content::PepperPluginInfo pdf_info;
|
||||||
pdf_info.is_internal = true;
|
pdf_info.is_internal = true;
|
||||||
pdf_info.is_out_of_process = true;
|
pdf_info.is_out_of_process = true;
|
||||||
pdf_info.name = "Chromium PDF Viewer";
|
pdf_info.name = kPDFInternalPluginName;
|
||||||
pdf_info.description = "Portable Document Format";
|
pdf_info.description = "Portable Document Format";
|
||||||
// This isn't a real file path; it's just used as a unique identifier.
|
// This isn't a real file path; it's just used as a unique identifier.
|
||||||
pdf_info.path = base::FilePath(kPdfPluginPath);
|
pdf_info.path = base::FilePath(kPdfPluginPath);
|
||||||
content::WebPluginMimeType pdf_mime_type(kPdfPluginMimeType, "pdf",
|
content::WebPluginMimeType pdf_mime_type(pdf::kInternalPluginMimeType, "pdf",
|
||||||
"Portable Document Format");
|
"Portable Document Format");
|
||||||
pdf_info.mime_types.push_back(pdf_mime_type);
|
pdf_info.mime_types.push_back(pdf_mime_type);
|
||||||
plugins->push_back(pdf_info);
|
plugins->push_back(pdf_info);
|
||||||
|
@ -126,12 +127,11 @@ void ComputeBuiltInPlugins(std::vector<content::PepperPluginInfo>* plugins) {
|
||||||
// here.
|
// here.
|
||||||
content::WebPluginInfo info;
|
content::WebPluginInfo info;
|
||||||
info.type = content::WebPluginInfo::PLUGIN_TYPE_BROWSER_PLUGIN;
|
info.type = content::WebPluginInfo::PLUGIN_TYPE_BROWSER_PLUGIN;
|
||||||
info.name = u"Chromium PDF Viewer";
|
info.name = base::ASCIIToUTF16(kPDFExtensionPluginName);
|
||||||
// This isn't a real file path; it's just used as a unique identifier.
|
// This isn't a real file path; it's just used as a unique identifier.
|
||||||
info.path = base::FilePath::FromUTF8Unsafe(extension_misc::kPdfExtensionId);
|
info.path = base::FilePath::FromUTF8Unsafe(extension_misc::kPdfExtensionId);
|
||||||
info.background_color = content::WebPluginInfo::kDefaultBackgroundColor;
|
info.background_color = content::WebPluginInfo::kDefaultBackgroundColor;
|
||||||
info.mime_types.emplace_back("application/pdf", "pdf",
|
info.mime_types.emplace_back(kPDFMimeType, "pdf", "Portable Document Format");
|
||||||
"Portable Document Format");
|
|
||||||
content::PluginService::GetInstance()->RefreshPlugins();
|
content::PluginService::GetInstance()->RefreshPlugins();
|
||||||
content::PluginService::GetInstance()->RegisterInternalPlugin(info, true);
|
content::PluginService::GetInstance()->RegisterInternalPlugin(info, true);
|
||||||
#endif // BUILDFLAG(ENABLE_PDF_VIEWER)
|
#endif // BUILDFLAG(ENABLE_PDF_VIEWER)
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include "base/memory/weak_ptr.h"
|
#include "base/memory/weak_ptr.h"
|
||||||
#include "content/public/browser/web_contents_observer.h"
|
#include "content/public/browser/web_contents_observer.h"
|
||||||
#include "electron/shell/common/api/api.mojom.h"
|
#include "electron/shell/common/api/api.mojom.h"
|
||||||
|
#include "mojo/public/cpp/bindings/associated_receiver.h"
|
||||||
#include "shell/browser/api/electron_api_web_contents.h"
|
#include "shell/browser/api/electron_api_web_contents.h"
|
||||||
|
|
||||||
namespace content {
|
namespace content {
|
||||||
|
|
|
@ -27,16 +27,11 @@
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
#include "base/task/post_task.h"
|
#include "base/task/post_task.h"
|
||||||
#include "chrome/browser/browser_process.h"
|
#include "chrome/browser/browser_process.h"
|
||||||
#include "chrome/browser/pdf/chrome_pdf_stream_delegate.h"
|
|
||||||
#include "chrome/browser/plugins/pdf_iframe_navigation_throttle.h"
|
|
||||||
#include "chrome/common/chrome_paths.h"
|
#include "chrome/common/chrome_paths.h"
|
||||||
#include "chrome/common/chrome_switches.h"
|
#include "chrome/common/chrome_switches.h"
|
||||||
#include "chrome/common/chrome_version.h"
|
#include "chrome/common/chrome_version.h"
|
||||||
#include "components/net_log/chrome_net_log.h"
|
#include "components/net_log/chrome_net_log.h"
|
||||||
#include "components/network_hints/common/network_hints.mojom.h"
|
#include "components/network_hints/common/network_hints.mojom.h"
|
||||||
#include "components/pdf/browser/pdf_navigation_throttle.h"
|
|
||||||
#include "components/pdf/browser/pdf_url_loader_request_interceptor.h"
|
|
||||||
#include "components/pdf/common/internal_plugin_helpers.h"
|
|
||||||
#include "content/browser/keyboard_lock/keyboard_lock_service_impl.h" // nogncheck
|
#include "content/browser/keyboard_lock/keyboard_lock_service_impl.h" // nogncheck
|
||||||
#include "content/browser/site_instance_impl.h" // nogncheck
|
#include "content/browser/site_instance_impl.h" // nogncheck
|
||||||
#include "content/public/browser/browser_main_runner.h"
|
#include "content/public/browser/browser_main_runner.h"
|
||||||
|
@ -52,6 +47,7 @@
|
||||||
#include "content/public/browser/site_instance.h"
|
#include "content/public/browser/site_instance.h"
|
||||||
#include "content/public/browser/tts_controller.h"
|
#include "content/public/browser/tts_controller.h"
|
||||||
#include "content/public/browser/tts_platform.h"
|
#include "content/public/browser/tts_platform.h"
|
||||||
|
#include "content/public/browser/url_loader_request_interceptor.h"
|
||||||
#include "content/public/common/content_descriptors.h"
|
#include "content/public/common/content_descriptors.h"
|
||||||
#include "content/public/common/content_paths.h"
|
#include "content/public/common/content_paths.h"
|
||||||
#include "content/public/common/content_switches.h"
|
#include "content/public/common/content_switches.h"
|
||||||
|
@ -212,7 +208,12 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if BUILDFLAG(ENABLE_PDF_VIEWER)
|
#if BUILDFLAG(ENABLE_PDF_VIEWER)
|
||||||
|
#include "chrome/browser/pdf/chrome_pdf_stream_delegate.h"
|
||||||
|
#include "chrome/browser/plugins/pdf_iframe_navigation_throttle.h" // nogncheck
|
||||||
|
#include "components/pdf/browser/pdf_navigation_throttle.h"
|
||||||
|
#include "components/pdf/browser/pdf_url_loader_request_interceptor.h"
|
||||||
#include "components/pdf/browser/pdf_web_contents_helper.h" // nogncheck
|
#include "components/pdf/browser/pdf_web_contents_helper.h" // nogncheck
|
||||||
|
#include "components/pdf/common/internal_plugin_helpers.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using content::BrowserThread;
|
using content::BrowserThread;
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include "base/memory/weak_ptr.h"
|
#include "base/memory/weak_ptr.h"
|
||||||
#include "content/public/browser/web_contents_observer.h"
|
#include "content/public/browser/web_contents_observer.h"
|
||||||
#include "electron/shell/common/api/api.mojom.h"
|
#include "electron/shell/common/api/api.mojom.h"
|
||||||
|
#include "mojo/public/cpp/bindings/associated_receiver.h"
|
||||||
#include "shell/browser/api/electron_api_web_contents.h"
|
#include "shell/browser/api/electron_api_web_contents.h"
|
||||||
|
|
||||||
namespace content {
|
namespace content {
|
||||||
|
|
|
@ -30,7 +30,8 @@ const char kRunAsNode[] = "ELECTRON_RUN_AS_NODE";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if BUILDFLAG(ENABLE_PDF_VIEWER)
|
#if BUILDFLAG(ENABLE_PDF_VIEWER)
|
||||||
const char kPdfPluginMimeType[] = "application/x-google-chrome-pdf";
|
const char kPDFExtensionPluginName[] = "Chromium PDF Viewer";
|
||||||
|
const char kPDFInternalPluginName[] = "Chromium PDF Plugin";
|
||||||
const base::FilePath::CharType kPdfPluginPath[] =
|
const base::FilePath::CharType kPdfPluginPath[] =
|
||||||
FILE_PATH_LITERAL("internal-pdf-viewer");
|
FILE_PATH_LITERAL("internal-pdf-viewer");
|
||||||
#endif // BUILDFLAG(ENABLE_PDF_VIEWER)
|
#endif // BUILDFLAG(ENABLE_PDF_VIEWER)
|
||||||
|
|
|
@ -30,8 +30,8 @@ extern const char kRunAsNode[];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if BUILDFLAG(ENABLE_PDF_VIEWER)
|
#if BUILDFLAG(ENABLE_PDF_VIEWER)
|
||||||
// The MIME type used for the PDF plugin.
|
extern const char kPDFExtensionPluginName[];
|
||||||
extern const char kPdfPluginMimeType[];
|
extern const char kPDFInternalPluginName[];
|
||||||
extern const base::FilePath::CharType kPdfPluginPath[];
|
extern const base::FilePath::CharType kPdfPluginPath[];
|
||||||
#endif // BUILDFLAG(ENABLE_PDF_VIEWER)
|
#endif // BUILDFLAG(ENABLE_PDF_VIEWER)
|
||||||
|
|
||||||
|
|
|
@ -12,9 +12,7 @@
|
||||||
#include "base/command_line.h"
|
#include "base/command_line.h"
|
||||||
#include "base/strings/string_split.h"
|
#include "base/strings/string_split.h"
|
||||||
#include "base/strings/stringprintf.h"
|
#include "base/strings/stringprintf.h"
|
||||||
#include "chrome/common/pdf_util.h"
|
|
||||||
#include "components/network_hints/renderer/web_prescient_networking_impl.h"
|
#include "components/network_hints/renderer/web_prescient_networking_impl.h"
|
||||||
#include "components/pdf/renderer/pdf_internal_plugin_delegate.h"
|
|
||||||
#include "content/common/buildflags.h"
|
#include "content/common/buildflags.h"
|
||||||
#include "content/public/common/content_constants.h"
|
#include "content/public/common/content_constants.h"
|
||||||
#include "content/public/common/content_switches.h"
|
#include "content/public/common/content_switches.h"
|
||||||
|
@ -68,6 +66,9 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if BUILDFLAG(ENABLE_PDF_VIEWER)
|
#if BUILDFLAG(ENABLE_PDF_VIEWER)
|
||||||
|
#include "chrome/common/pdf_util.h"
|
||||||
|
#include "components/pdf/common/internal_plugin_helpers.h"
|
||||||
|
#include "components/pdf/renderer/pdf_internal_plugin_delegate.h"
|
||||||
#include "shell/common/electron_constants.h"
|
#include "shell/common/electron_constants.h"
|
||||||
#endif // BUILDFLAG(ENABLE_PDF_VIEWER)
|
#endif // BUILDFLAG(ENABLE_PDF_VIEWER)
|
||||||
|
|
||||||
|
@ -111,6 +112,25 @@ std::vector<std::string> ParseSchemesCLISwitch(base::CommandLine* command_line,
|
||||||
base::SPLIT_WANT_NONEMPTY);
|
base::SPLIT_WANT_NONEMPTY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if BUILDFLAG(ENABLE_PDF_VIEWER)
|
||||||
|
class ChromePdfInternalPluginDelegate final
|
||||||
|
: public pdf::PdfInternalPluginDelegate {
|
||||||
|
public:
|
||||||
|
ChromePdfInternalPluginDelegate() = default;
|
||||||
|
ChromePdfInternalPluginDelegate(const ChromePdfInternalPluginDelegate&) =
|
||||||
|
delete;
|
||||||
|
ChromePdfInternalPluginDelegate& operator=(
|
||||||
|
const ChromePdfInternalPluginDelegate&) = delete;
|
||||||
|
~ChromePdfInternalPluginDelegate() override = default;
|
||||||
|
|
||||||
|
// `pdf::PdfInternalPluginDelegate`:
|
||||||
|
bool IsAllowedOrigin(const url::Origin& origin) const override {
|
||||||
|
return origin.scheme() == extensions::kExtensionScheme &&
|
||||||
|
origin.host() == extension_misc::kPdfExtensionId;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
#endif // BUILDFLAG(ENABLE_PDF_VIEWER)
|
||||||
|
|
||||||
// static
|
// static
|
||||||
RendererClientBase* g_renderer_client_base = nullptr;
|
RendererClientBase* g_renderer_client_base = nullptr;
|
||||||
|
|
||||||
|
@ -311,29 +331,12 @@ void RendererClientBase::DidClearWindowObject(
|
||||||
render_frame->GetWebFrame()->ExecuteScript(blink::WebScriptSource("void 0"));
|
render_frame->GetWebFrame()->ExecuteScript(blink::WebScriptSource("void 0"));
|
||||||
}
|
}
|
||||||
|
|
||||||
class ChromePdfInternalPluginDelegate final
|
|
||||||
: public pdf::PdfInternalPluginDelegate {
|
|
||||||
public:
|
|
||||||
ChromePdfInternalPluginDelegate() = default;
|
|
||||||
ChromePdfInternalPluginDelegate(const ChromePdfInternalPluginDelegate&) =
|
|
||||||
delete;
|
|
||||||
ChromePdfInternalPluginDelegate& operator=(
|
|
||||||
const ChromePdfInternalPluginDelegate&) = delete;
|
|
||||||
~ChromePdfInternalPluginDelegate() override = default;
|
|
||||||
|
|
||||||
// `pdf::PdfInternalPluginDelegate`:
|
|
||||||
bool IsAllowedOrigin(const url::Origin& origin) const override {
|
|
||||||
return origin.scheme() == extensions::kExtensionScheme &&
|
|
||||||
origin.host() == extension_misc::kPdfExtensionId;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
bool RendererClientBase::OverrideCreatePlugin(
|
bool RendererClientBase::OverrideCreatePlugin(
|
||||||
content::RenderFrame* render_frame,
|
content::RenderFrame* render_frame,
|
||||||
const blink::WebPluginParams& params,
|
const blink::WebPluginParams& params,
|
||||||
blink::WebPlugin** plugin) {
|
blink::WebPlugin** plugin) {
|
||||||
#if BUILDFLAG(ENABLE_PDF_VIEWER)
|
#if BUILDFLAG(ENABLE_PDF_VIEWER)
|
||||||
if (params.mime_type.Utf8() == kPdfPluginMimeType) {
|
if (params.mime_type.Utf8() == pdf::kInternalPluginMimeType) {
|
||||||
*plugin = pdf::CreateInternalPlugin(
|
*plugin = pdf::CreateInternalPlugin(
|
||||||
std::move(params), render_frame,
|
std::move(params), render_frame,
|
||||||
std::make_unique<ChromePdfInternalPluginDelegate>());
|
std::make_unique<ChromePdfInternalPluginDelegate>());
|
||||||
|
@ -342,7 +345,6 @@ bool RendererClientBase::OverrideCreatePlugin(
|
||||||
#endif // BUILDFLAG(ENABLE_PDF_VIEWER)
|
#endif // BUILDFLAG(ENABLE_PDF_VIEWER)
|
||||||
|
|
||||||
if (params.mime_type.Utf8() == content::kBrowserPluginMimeType ||
|
if (params.mime_type.Utf8() == content::kBrowserPluginMimeType ||
|
||||||
params.mime_type.Utf8() == kPdfPluginMimeType ||
|
|
||||||
render_frame->GetBlinkPreferences().enable_plugins)
|
render_frame->GetBlinkPreferences().enable_plugins)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -371,7 +373,7 @@ bool RendererClientBase::IsPluginHandledExternally(
|
||||||
#if BUILDFLAG(ENABLE_PDF_VIEWER)
|
#if BUILDFLAG(ENABLE_PDF_VIEWER)
|
||||||
DCHECK(plugin_element.HasHTMLTagName("object") ||
|
DCHECK(plugin_element.HasHTMLTagName("object") ||
|
||||||
plugin_element.HasHTMLTagName("embed"));
|
plugin_element.HasHTMLTagName("embed"));
|
||||||
if (mime_type == "application/x-google-chrome-pdf") {
|
if (mime_type == pdf::kInternalPluginMimeType) {
|
||||||
if (IsPdfInternalPluginAllowedOrigin(
|
if (IsPdfInternalPluginAllowedOrigin(
|
||||||
render_frame->GetWebFrame()->GetSecurityOrigin())) {
|
render_frame->GetWebFrame()->GetSecurityOrigin())) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -379,11 +381,10 @@ bool RendererClientBase::IsPluginHandledExternally(
|
||||||
|
|
||||||
content::WebPluginInfo info;
|
content::WebPluginInfo info;
|
||||||
info.type = content::WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS;
|
info.type = content::WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS;
|
||||||
const char16_t kPDFExtensionPluginName[] = u"Chromium PDF Viewer";
|
info.name = base::ASCIIToUTF16(kPDFInternalPluginName);
|
||||||
info.name = kPDFExtensionPluginName;
|
info.path = base::FilePath(kPdfPluginPath);
|
||||||
info.path = base::FilePath::FromUTF8Unsafe("internal-pdf-viewer");
|
|
||||||
info.background_color = content::WebPluginInfo::kDefaultBackgroundColor;
|
info.background_color = content::WebPluginInfo::kDefaultBackgroundColor;
|
||||||
info.mime_types.emplace_back("application/x-google-chrome-pdf", "pdf",
|
info.mime_types.emplace_back(pdf::kInternalPluginMimeType, "pdf",
|
||||||
"Portable Document Format");
|
"Portable Document Format");
|
||||||
return extensions::MimeHandlerViewContainerManager::Get(
|
return extensions::MimeHandlerViewContainerManager::Get(
|
||||||
content::RenderFrame::FromWebFrame(
|
content::RenderFrame::FromWebFrame(
|
||||||
|
@ -396,12 +397,10 @@ bool RendererClientBase::IsPluginHandledExternally(
|
||||||
// electron_content_client.cc / ComputeBuiltInPlugins.
|
// electron_content_client.cc / ComputeBuiltInPlugins.
|
||||||
content::WebPluginInfo info;
|
content::WebPluginInfo info;
|
||||||
info.type = content::WebPluginInfo::PLUGIN_TYPE_BROWSER_PLUGIN;
|
info.type = content::WebPluginInfo::PLUGIN_TYPE_BROWSER_PLUGIN;
|
||||||
const char16_t kPDFExtensionPluginName[] = u"Chromium PDF Viewer";
|
info.name = base::ASCIIToUTF16(kPDFExtensionPluginName);
|
||||||
info.name = kPDFExtensionPluginName;
|
|
||||||
info.path = base::FilePath::FromUTF8Unsafe(extension_misc::kPdfExtensionId);
|
info.path = base::FilePath::FromUTF8Unsafe(extension_misc::kPdfExtensionId);
|
||||||
info.background_color = content::WebPluginInfo::kDefaultBackgroundColor;
|
info.background_color = content::WebPluginInfo::kDefaultBackgroundColor;
|
||||||
info.mime_types.emplace_back("application/pdf", "pdf",
|
info.mime_types.emplace_back(kPDFMimeType, "pdf", "Portable Document Format");
|
||||||
"Portable Document Format");
|
|
||||||
return extensions::MimeHandlerViewContainerManager::Get(
|
return extensions::MimeHandlerViewContainerManager::Get(
|
||||||
content::RenderFrame::FromWebFrame(
|
content::RenderFrame::FromWebFrame(
|
||||||
plugin_element.GetDocument().GetFrame()),
|
plugin_element.GetDocument().GetFrame()),
|
||||||
|
@ -415,6 +414,7 @@ bool RendererClientBase::IsPluginHandledExternally(
|
||||||
v8::Local<v8::Object> RendererClientBase::GetScriptableObject(
|
v8::Local<v8::Object> RendererClientBase::GetScriptableObject(
|
||||||
const blink::WebElement& plugin_element,
|
const blink::WebElement& plugin_element,
|
||||||
v8::Isolate* isolate) {
|
v8::Isolate* isolate) {
|
||||||
|
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
||||||
// If there is a MimeHandlerView that can provide the scriptable object then
|
// If there is a MimeHandlerView that can provide the scriptable object then
|
||||||
// MaybeCreateMimeHandlerView must have been called before and a container
|
// MaybeCreateMimeHandlerView must have been called before and a container
|
||||||
// manager should exist.
|
// manager should exist.
|
||||||
|
@ -424,6 +424,7 @@ v8::Local<v8::Object> RendererClientBase::GetScriptableObject(
|
||||||
false /* create_if_does_not_exist */);
|
false /* create_if_does_not_exist */);
|
||||||
if (container_manager)
|
if (container_manager)
|
||||||
return container_manager->GetScriptableObject(plugin_element, isolate);
|
return container_manager->GetScriptableObject(plugin_element, isolate);
|
||||||
|
#endif
|
||||||
return v8::Local<v8::Object>();
|
return v8::Local<v8::Object>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue