fix: build when pdf component is disabled (#33513)

This commit is contained in:
Robo 2022-03-31 03:55:38 +09:00 committed by GitHub
parent b711860d21
commit afe0116d59
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 58 additions and 60 deletions

View file

@ -35,7 +35,8 @@
#endif // defined(WIDEVINE_CDM_AVAILABLE)
#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 "shell/common/electron_constants.h"
#endif // BUILDFLAG(ENABLE_PDF_VIEWER)
@ -111,11 +112,11 @@ void ComputeBuiltInPlugins(std::vector<content::PepperPluginInfo>* plugins) {
content::PepperPluginInfo pdf_info;
pdf_info.is_internal = true;
pdf_info.is_out_of_process = true;
pdf_info.name = "Chromium PDF Viewer";
pdf_info.name = kPDFInternalPluginName;
pdf_info.description = "Portable Document Format";
// This isn't a real file path; it's just used as a unique identifier.
pdf_info.path = base::FilePath(kPdfPluginPath);
content::WebPluginMimeType pdf_mime_type(kPdfPluginMimeType, "pdf",
content::WebPluginMimeType pdf_mime_type(pdf::kInternalPluginMimeType, "pdf",
"Portable Document Format");
pdf_info.mime_types.push_back(pdf_mime_type);
plugins->push_back(pdf_info);
@ -126,12 +127,11 @@ void ComputeBuiltInPlugins(std::vector<content::PepperPluginInfo>* plugins) {
// here.
content::WebPluginInfo info;
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.
info.path = base::FilePath::FromUTF8Unsafe(extension_misc::kPdfExtensionId);
info.background_color = content::WebPluginInfo::kDefaultBackgroundColor;
info.mime_types.emplace_back("application/pdf", "pdf",
"Portable Document Format");
info.mime_types.emplace_back(kPDFMimeType, "pdf", "Portable Document Format");
content::PluginService::GetInstance()->RefreshPlugins();
content::PluginService::GetInstance()->RegisterInternalPlugin(info, true);
#endif // BUILDFLAG(ENABLE_PDF_VIEWER)