fix: compilation error when disabling extensions and pdf_viewer (#47993)

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Jinli Wu <wujinli@bytedance.com>
This commit is contained in:
trop[bot] 2025-08-07 16:49:37 -04:00 committed by GitHub
commit d05f99ff4c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 3 deletions

View file

@ -33,6 +33,7 @@ std::string PluginUtils::GetExtensionIdForMimeType(
base::flat_map<std::string, std::string> base::flat_map<std::string, std::string>
PluginUtils::GetMimeTypeToExtensionIdMap( PluginUtils::GetMimeTypeToExtensionIdMap(
content::BrowserContext* browser_context) { content::BrowserContext* browser_context) {
base::flat_map<std::string, std::string> mime_type_to_extension_id_map;
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS) #if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
const auto& allowed_extension_ids = MimeTypesHandler::GetMIMETypeAllowlist(); const auto& allowed_extension_ids = MimeTypesHandler::GetMIMETypeAllowlist();
if (allowed_extension_ids.empty()) if (allowed_extension_ids.empty())
@ -41,8 +42,6 @@ PluginUtils::GetMimeTypeToExtensionIdMap(
const extensions::ExtensionSet& enabled_extensions = const extensions::ExtensionSet& enabled_extensions =
extensions::ExtensionRegistry::Get(browser_context)->enabled_extensions(); extensions::ExtensionRegistry::Get(browser_context)->enabled_extensions();
base::flat_map<std::string, std::string> mime_type_to_extension_id_map;
// Go through the white-listed extensions and try to use them to intercept // Go through the white-listed extensions and try to use them to intercept
// the URL request. // the URL request.
for (const std::string& id : allowed_extension_ids) { for (const std::string& id : allowed_extension_ids) {

View file

@ -81,6 +81,7 @@ bool IsDeviceNameValid(const std::u16string& device_name) {
namespace { namespace {
#if BUILDFLAG(ENABLE_PDF_VIEWER)
// Duplicated from chrome/browser/printing/print_view_manager_common.cc // Duplicated from chrome/browser/printing/print_view_manager_common.cc
content::RenderFrameHost* GetFullPagePlugin(content::WebContents* contents) { content::RenderFrameHost* GetFullPagePlugin(content::WebContents* contents) {
content::RenderFrameHost* full_page_plugin = nullptr; content::RenderFrameHost* full_page_plugin = nullptr;
@ -99,6 +100,7 @@ content::RenderFrameHost* GetFullPagePlugin(content::WebContents* contents) {
#endif // BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS) #endif // BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
return full_page_plugin; return full_page_plugin;
} }
#endif // BUILDFLAG(ENABLE_PDF_VIEWER)
} // namespace } // namespace
@ -119,7 +121,7 @@ content::RenderFrameHost* GetRenderFrameHostToUse(
if (pdf_rfh) { if (pdf_rfh) {
return pdf_rfh; return pdf_rfh;
} }
#endif // BUILDFLAG(ENABLE_PDF) #endif // BUILDFLAG(ENABLE_PDF_VIEWER)
auto* focused_frame = contents->GetFocusedFrame(); auto* focused_frame = contents->GetFocusedFrame();
return (focused_frame && focused_frame->HasSelection()) return (focused_frame && focused_frame->HasSelection())
? focused_frame ? focused_frame