Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: fix building with enable_plugins = false (#35259)
- Loading branch information
Showing
3 changed files
with
229 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
119 changes: 119 additions & 0 deletions
119
patches/chromium/fix_mac_build_with_enable_plugins_false.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Lei Zhang <thestig@chromium.org> | ||
Date: Thu, 23 Jun 2022 17:54:12 +0000 | ||
Subject: Fix Mac build with enable_plugins=false. | ||
|
||
Remove spurious includes of plugin headers, and add appropriate #ifs. | ||
|
||
Bug: 1027360 | ||
Change-Id: I445252f5de14dff8e89ab371429a24ad3e57ca97 | ||
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3719213 | ||
Reviewed-by: Robert Sesek <rsesek@chromium.org> | ||
Reviewed-by: Thomas Lukaszewicz <tluk@chromium.org> | ||
Commit-Queue: Lei Zhang <thestig@chromium.org> | ||
Cr-Commit-Position: refs/heads/main@{#1017248} | ||
|
||
diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm | ||
index bc4673a6b121f256823a86d90684ae93d90ec0a5..c0451595f4c8e24ede35dacceb2192ebafba61f8 100644 | ||
--- a/chrome/browser/app_controller_mac.mm | ||
+++ b/chrome/browser/app_controller_mac.mm | ||
@@ -106,7 +106,6 @@ | ||
#include "components/sessions/core/tab_restore_service.h" | ||
#include "components/sessions/core/tab_restore_service_observer.h" | ||
#include "content/public/browser/download_manager.h" | ||
-#include "content/public/browser/plugin_service.h" | ||
#include "extensions/browser/extension_registry.h" | ||
#include "extensions/browser/extension_system.h" | ||
#include "net/base/filename_util.h" | ||
diff --git a/content/browser/sandbox_mac_unittest.mm b/content/browser/sandbox_mac_unittest.mm | ||
index 6bb0bce891d470aea7c5e83be734e2d581a55f4e..7d09c42806834c147ad481a5873e920b85b1c5b9 100644 | ||
--- a/content/browser/sandbox_mac_unittest.mm | ||
+++ b/content/browser/sandbox_mac_unittest.mm | ||
@@ -30,6 +30,7 @@ | ||
#include "content/browser/sandbox_parameters_mac.h" | ||
#include "content/common/mac/font_loader.h" | ||
#include "crypto/openssl_util.h" | ||
+#include "ppapi/buildflags/buildflags.h" | ||
#include "sandbox/mac/seatbelt.h" | ||
#include "sandbox/mac/seatbelt_exec.h" | ||
#include "sandbox/policy/mac/sandbox_mac.h" | ||
@@ -93,7 +94,9 @@ void ExecuteInAllSandboxTypes(const std::string& multiprocess_main, | ||
sandbox::mojom::Sandbox::kCdm, | ||
sandbox::mojom::Sandbox::kGpu, | ||
sandbox::mojom::Sandbox::kNaClLoader, | ||
+#if BUILDFLAG(ENABLE_PLUGINS) | ||
sandbox::mojom::Sandbox::kPpapi, | ||
+#endif | ||
sandbox::mojom::Sandbox::kPrintBackend, | ||
sandbox::mojom::Sandbox::kPrintCompositor, | ||
sandbox::mojom::Sandbox::kRenderer, | ||
diff --git a/content/browser/sandbox_parameters_mac.mm b/content/browser/sandbox_parameters_mac.mm | ||
index 5cbb9e323da29ed4153ca1d028154bdd566f6554..c604abe1d6369076e41e97be1d7900058cc71bb9 100644 | ||
--- a/content/browser/sandbox_parameters_mac.mm | ||
+++ b/content/browser/sandbox_parameters_mac.mm | ||
@@ -20,7 +20,6 @@ | ||
#include "base/strings/sys_string_conversions.h" | ||
#include "base/system/sys_info.h" | ||
#include "content/public/browser/content_browser_client.h" | ||
-#include "content/public/browser/plugin_service.h" | ||
#include "content/public/common/content_client.h" | ||
#include "content/public/common/content_features.h" | ||
#include "content/public/common/content_switches.h" | ||
@@ -34,6 +33,7 @@ | ||
#include "third_party/abseil-cpp/absl/types/optional.h" | ||
|
||
#if BUILDFLAG(ENABLE_PLUGINS) | ||
+#include "content/public/browser/plugin_service.h" | ||
#include "content/public/common/pepper_plugin_info.h" | ||
#endif | ||
|
||
@@ -229,11 +229,11 @@ void SetupSandboxParameters(sandbox::mojom::Sandbox sandbox_type, | ||
case sandbox::mojom::Sandbox::kNetwork: | ||
SetupNetworkSandboxParameters(client); | ||
break; | ||
- case sandbox::mojom::Sandbox::kPpapi: | ||
#if BUILDFLAG(ENABLE_PLUGINS) | ||
+ case sandbox::mojom::Sandbox::kPpapi: | ||
SetupPPAPISandboxParameters(client); | ||
-#endif | ||
break; | ||
+#endif | ||
case sandbox::mojom::Sandbox::kNoSandbox: | ||
CHECK(false) << "Unhandled parameters for sandbox_type " | ||
<< static_cast<int>(sandbox_type); | ||
diff --git a/sandbox/policy/mac/sandbox_mac.mm b/sandbox/policy/mac/sandbox_mac.mm | ||
index 35d1091e0c555d00ac1fc5ac878fa2a6e09e718b..2a1a5aaf18d43a68b13783d55279e481bd91c2e5 100644 | ||
--- a/sandbox/policy/mac/sandbox_mac.mm | ||
+++ b/sandbox/policy/mac/sandbox_mac.mm | ||
@@ -12,6 +12,7 @@ | ||
#include "base/files/scoped_file.h" | ||
#include "base/logging.h" | ||
#include "base/posix/eintr_wrapper.h" | ||
+#include "ppapi/buildflags/buildflags.h" | ||
#include "printing/buildflags/buildflags.h" | ||
#include "sandbox/policy/mac/audio.sb.h" | ||
#include "sandbox/policy/mac/cdm.sb.h" | ||
@@ -70,9 +71,11 @@ | ||
case sandbox::mojom::Sandbox::kNetwork: | ||
profile += kSeatbeltPolicyString_network; | ||
break; | ||
+#if BUILDFLAG(ENABLE_PLUGINS) | ||
case sandbox::mojom::Sandbox::kPpapi: | ||
profile += kSeatbeltPolicyString_ppapi; | ||
break; | ||
+#endif | ||
#if BUILDFLAG(ENABLE_PRINTING) | ||
case sandbox::mojom::Sandbox::kPrintBackend: | ||
profile += kSeatbeltPolicyString_print_backend; | ||
diff --git a/ui/views_content_client/views_content_client_main_parts_mac.mm b/ui/views_content_client/views_content_client_main_parts_mac.mm | ||
index bc299671710a4517af3df61b3cc4d7b055aedc0e..6e16b917e3cf0de2919a0b501614ef91285b6d67 100644 | ||
--- a/ui/views_content_client/views_content_client_main_parts_mac.mm | ||
+++ b/ui/views_content_client/views_content_client_main_parts_mac.mm | ||
@@ -12,7 +12,6 @@ | ||
#include "base/mac/scoped_nsobject.h" | ||
#include "base/path_service.h" | ||
#include "content/public/browser/context_factory.h" | ||
-#include "content/public/browser/plugin_service.h" | ||
#include "content/public/common/content_paths.h" | ||
#include "content/public/common/result_codes.h" | ||
#include "content/shell/browser/shell_application_mac.h" |
108 changes: 108 additions & 0 deletions
108
patches/chromium/fix_windows_build_with_enable_plugins_false.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Lei Zhang <thestig@chromium.org> | ||
Date: Thu, 23 Jun 2022 18:52:27 +0000 | ||
Subject: Fix Windows build with enable_plugins=false. | ||
|
||
Add some #if checks to Windows-only code so plugins enums are only | ||
referenced when plugins are enabled. Also only build | ||
plugin_list_unittest.cc when plugins are enabled. | ||
|
||
Bug: 1027360 | ||
Change-Id: I0d265ae711e5e3401076dc89d1d49329f423ca64 | ||
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3719402 | ||
Reviewed-by: Alex Gough <ajgo@chromium.org> | ||
Commit-Queue: Lei Zhang <thestig@chromium.org> | ||
Cr-Commit-Position: refs/heads/main@{#1017281} | ||
|
||
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc | ||
index dd93c3e2f18f1bf14047dcf1b8dad699170aed29..e7ae31da3b4e7406000481da9a34e960c086b399 100644 | ||
--- a/chrome/browser/chrome_content_browser_client.cc | ||
+++ b/chrome/browser/chrome_content_browser_client.cc | ||
@@ -4022,7 +4022,9 @@ std::wstring ChromeContentBrowserClient::GetAppContainerSidForSandboxType( | ||
return std::wstring(); | ||
case sandbox::mojom::Sandbox::kGpu: | ||
return std::wstring(); | ||
+#if BUILDFLAG(ENABLE_PLUGINS) | ||
case sandbox::mojom::Sandbox::kPpapi: | ||
+#endif | ||
case sandbox::mojom::Sandbox::kNoSandbox: | ||
case sandbox::mojom::Sandbox::kNoSandboxAndElevatedPrivileges: | ||
case sandbox::mojom::Sandbox::kXrCompositing: | ||
@@ -4107,7 +4109,9 @@ bool ChromeContentBrowserClient::PreSpawnChild( | ||
break; | ||
case sandbox::mojom::Sandbox::kUtility: | ||
case sandbox::mojom::Sandbox::kGpu: | ||
+#if BUILDFLAG(ENABLE_PLUGINS) | ||
case sandbox::mojom::Sandbox::kPpapi: | ||
+#endif | ||
case sandbox::mojom::Sandbox::kNoSandbox: | ||
case sandbox::mojom::Sandbox::kNoSandboxAndElevatedPrivileges: | ||
case sandbox::mojom::Sandbox::kXrCompositing: | ||
diff --git a/chrome/child/pdf_child_init.cc b/chrome/child/pdf_child_init.cc | ||
index e53cfc60b41fe0d4eeb0362e9923f1e39e61a64d..8e0d72623bbb0c92c8fd8b97ab833c947806667b 100644 | ||
--- a/chrome/child/pdf_child_init.cc | ||
+++ b/chrome/child/pdf_child_init.cc | ||
@@ -14,6 +14,7 @@ | ||
#include "base/win/windows_version.h" | ||
#include "content/public/child/child_thread.h" | ||
#include "content/public/common/content_switches.h" | ||
+#include "ppapi/buildflags/buildflags.h" | ||
#include "sandbox/policy/mojom/sandbox.mojom.h" | ||
#include "sandbox/policy/sandbox_type.h" | ||
#include "sandbox/policy/switches.h" | ||
@@ -57,7 +58,9 @@ void MaybePatchGdiGetFontData() { | ||
auto service_sandbox_type = | ||
sandbox::policy::SandboxTypeFromCommandLine(command_line); | ||
bool need_gdi = | ||
+#if BUILDFLAG(ENABLE_PLUGINS) | ||
service_sandbox_type == sandbox::mojom::Sandbox::kPpapi || | ||
+#endif | ||
service_sandbox_type == sandbox::mojom::Sandbox::kPrintCompositor || | ||
service_sandbox_type == sandbox::mojom::Sandbox::kPdfConversion || | ||
(service_sandbox_type == sandbox::mojom::Sandbox::kRenderer && | ||
diff --git a/content/test/BUILD.gn b/content/test/BUILD.gn | ||
index 61fbc9e7304f6d3c8dd5264299e6013a4d4aca83..8401807084dd31d0459cee4ab0e670de8e92dbb1 100644 | ||
--- a/content/test/BUILD.gn | ||
+++ b/content/test/BUILD.gn | ||
@@ -2263,7 +2263,6 @@ test("content_unittests") { | ||
"../browser/payments/payment_manager_unittest.cc", | ||
"../browser/permissions/permission_controller_impl_unittest.cc", | ||
"../browser/picture_in_picture/picture_in_picture_service_impl_unittest.cc", | ||
- "../browser/plugin_list_unittest.cc", | ||
"../browser/prerender/prerender_host_registry_unittest.cc", | ||
"../browser/prerender/prerender_host_unittest.cc", | ||
"../browser/presentation/presentation_service_impl_unittest.cc", | ||
@@ -2976,8 +2975,8 @@ test("content_unittests") { | ||
deps += [ "//ui/events:test_support" ] | ||
} | ||
|
||
- if (!is_win && !is_mac) { | ||
- sources -= [ "../browser/plugin_list_unittest.cc" ] | ||
+ if (enable_plugins && (is_win || is_mac)) { | ||
+ sources += [ "../browser/plugin_list_unittest.cc" ] | ||
} | ||
|
||
if (use_ozone) { | ||
diff --git a/sandbox/policy/win/sandbox_win.cc b/sandbox/policy/win/sandbox_win.cc | ||
index b1ec529d260a9da35e4a4715c09fb8732eb98fe5..f7b0de8ca8cab01d1a68800dadb9e1f10b88fa1c 100644 | ||
--- a/sandbox/policy/win/sandbox_win.cc | ||
+++ b/sandbox/policy/win/sandbox_win.cc | ||
@@ -40,6 +40,7 @@ | ||
#include "base/win/sid.h" | ||
#include "base/win/win_util.h" | ||
#include "base/win/windows_version.h" | ||
+#include "ppapi/buildflags/buildflags.h" | ||
#include "printing/buildflags/buildflags.h" | ||
#include "sandbox/features.h" | ||
#include "sandbox/policy/features.h" | ||
@@ -1245,8 +1246,10 @@ std::string SandboxWin::GetSandboxTypeInEnglish(Sandbox sandbox_type) { | ||
return "Utility"; | ||
case Sandbox::kGpu: | ||
return "GPU"; | ||
+#if BUILDFLAG(ENABLE_PLUGINS) | ||
case Sandbox::kPpapi: | ||
return "PPAPI"; | ||
+#endif | ||
case Sandbox::kNetwork: | ||
return "Network"; | ||
case Sandbox::kCdm: |