From f409eb0d7ad32e97ae9f8d44e4402bce0da6b4e7 Mon Sep 17 00:00:00 2001 From: "trop[bot]" <37223003+trop[bot]@users.noreply.github.com> Date: Thu, 7 Aug 2025 17:01:43 -0400 Subject: [PATCH] fix: compilation error when disabling extensions and pdf_viewer (#47994) Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Jinli Wu --- shell/browser/plugins/plugin_utils.cc | 3 +-- shell/browser/printing/printing_utils.cc | 4 +++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/shell/browser/plugins/plugin_utils.cc b/shell/browser/plugins/plugin_utils.cc index 9c220eb888b2..b3f36a8b3d4a 100644 --- a/shell/browser/plugins/plugin_utils.cc +++ b/shell/browser/plugins/plugin_utils.cc @@ -33,6 +33,7 @@ std::string PluginUtils::GetExtensionIdForMimeType( base::flat_map PluginUtils::GetMimeTypeToExtensionIdMap( content::BrowserContext* browser_context) { + base::flat_map mime_type_to_extension_id_map; #if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS) const auto& allowed_extension_ids = MimeTypesHandler::GetMIMETypeAllowlist(); if (allowed_extension_ids.empty()) @@ -41,8 +42,6 @@ PluginUtils::GetMimeTypeToExtensionIdMap( const extensions::ExtensionSet& enabled_extensions = extensions::ExtensionRegistry::Get(browser_context)->enabled_extensions(); - base::flat_map mime_type_to_extension_id_map; - // Go through the white-listed extensions and try to use them to intercept // the URL request. for (const std::string& id : allowed_extension_ids) { diff --git a/shell/browser/printing/printing_utils.cc b/shell/browser/printing/printing_utils.cc index 852a0c6dba68..f8e4583630ba 100644 --- a/shell/browser/printing/printing_utils.cc +++ b/shell/browser/printing/printing_utils.cc @@ -81,6 +81,7 @@ bool IsDeviceNameValid(const std::u16string& device_name) { namespace { +#if BUILDFLAG(ENABLE_PDF_VIEWER) // Duplicated from chrome/browser/printing/print_view_manager_common.cc content::RenderFrameHost* GetFullPagePlugin(content::WebContents* contents) { content::RenderFrameHost* full_page_plugin = nullptr; @@ -99,6 +100,7 @@ content::RenderFrameHost* GetFullPagePlugin(content::WebContents* contents) { #endif // BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS) return full_page_plugin; } +#endif // BUILDFLAG(ENABLE_PDF_VIEWER) } // namespace @@ -119,7 +121,7 @@ content::RenderFrameHost* GetRenderFrameHostToUse( if (pdf_rfh) { return pdf_rfh; } -#endif // BUILDFLAG(ENABLE_PDF) +#endif // BUILDFLAG(ENABLE_PDF_VIEWER) auto* focused_frame = contents->GetFocusedFrame(); return (focused_frame && focused_frame->HasSelection()) ? focused_frame