build: fix building with enable_basic_printing false (#34711)

* build: fix building with enable_basic_printing false

* temp flags for ci builds

* fix other systems

* disable cups

* disable print preview

* revert changes

* merge with printing.patch
This commit is contained in:
Micha Hanselmann 2022-06-28 16:34:00 +02:00 коммит произвёл GitHub
Родитель f1087cc830
Коммит 704b2199b3
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 83 добавлений и 1 удалений

Просмотреть файл

@ -10,6 +10,29 @@ majority of changes originally come from these PRs:
This patch also fixes callback for manual user cancellation and success.
diff --git a/BUILD.gn b/BUILD.gn
index c46cbf1bec22c36b97fde5601ca9b2966ee80933..edf371d10bcac60db878c56c55e7244afa9106a9 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -960,7 +960,6 @@ if (is_win) {
"//media:media_unittests",
"//media/midi:midi_unittests",
"//net:net_unittests",
- "//printing:printing_unittests",
"//sql:sql_unittests",
"//third_party/breakpad:symupload($host_toolchain)",
"//ui/base:ui_base_unittests",
@@ -969,6 +968,10 @@ if (is_win) {
"//ui/views:views_unittests",
"//url:url_unittests",
]
+
+ if (enable_basic_printing) {
+ deps += [ "//printing:printing_unittests" ]
+ }
}
}
diff --git a/chrome/browser/printing/print_job.cc b/chrome/browser/printing/print_job.cc
index 331a084371402b5a2440b5d60feac8f0189e84b9..6755d1f497cef4deea6b83df1d8720dcf54817e9 100644
--- a/chrome/browser/printing/print_job.cc
@ -720,6 +743,42 @@ index f118cae62de1cebb78c8193365bafcaba3b863a8..6c8bb35f6ea00b8366134a3f00d1a43f
#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
// Set options for print preset from source PDF document.
diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn
index 6fe723b5b4b645cb3d007787db2217bcaec7c257..e89d8b20aa27ac940e78d374ded9bca25940d3db 100644
--- a/content/browser/BUILD.gn
+++ b/content/browser/BUILD.gn
@@ -2733,8 +2733,9 @@ source_set("browser") {
"//ppapi/shared_impl",
]
- assert(enable_basic_printing)
- deps += [ "//printing" ]
+ if (enable_basic_printing) {
+ deps += [ "//printing" ]
+ }
if (is_chromeos_ash) {
sources += [
diff --git a/content/browser/utility_sandbox_delegate_win.cc b/content/browser/utility_sandbox_delegate_win.cc
index 75f0fade966646dc7e738c87a3300be1603ec7b7..27f71aef278781c214dc430af7cd16f32483e559 100644
--- a/content/browser/utility_sandbox_delegate_win.cc
+++ b/content/browser/utility_sandbox_delegate_win.cc
@@ -95,6 +95,7 @@ bool NetworkPreSpawnTarget(sandbox::TargetPolicy* policy) {
return true;
}
+#if BUILDFLAG(ENABLE_PRINTING)
// Sets the sandbox policy for the print backend service process.
bool PrintBackendPreSpawnTarget(sandbox::TargetPolicy* policy) {
// Print Backend policy lockdown level must be at least USER_LIMITED and
@@ -105,6 +106,7 @@ bool PrintBackendPreSpawnTarget(sandbox::TargetPolicy* policy) {
policy->SetDelayedIntegrityLevel(sandbox::INTEGRITY_LEVEL_LOW);
return true;
}
+#endif
} // namespace
bool UtilitySandboxedProcessLauncherDelegate::GetAppContainerId(
diff --git a/printing/printing_context.cc b/printing/printing_context.cc
index 93db1a80a360702a36f2d3113c9a83105bf7fffe..c3e012ec8d9a1c19434240d27553e486c0729d43 100644
--- a/printing/printing_context.cc
@ -756,3 +815,26 @@ index 58fcf619add5093bd99fd9c561e8686b060a01c6..76db2a2438cef84fcb6dfd4a67d2e171
// Determine if system calls should be skipped by this instance.
bool skip_system_calls() const {
#if BUILDFLAG(ENABLE_OOP_PRINTING)
diff --git a/sandbox/policy/mac/sandbox_mac.mm b/sandbox/policy/mac/sandbox_mac.mm
index 35d1091e0c555d00ac1fc5ac878fa2a6e09e718b..07411f07e69a645ba388348f01237f7d38755818 100644
--- a/sandbox/policy/mac/sandbox_mac.mm
+++ b/sandbox/policy/mac/sandbox_mac.mm
@@ -21,7 +21,6 @@
#include "sandbox/policy/mac/nacl_loader.sb.h"
#include "sandbox/policy/mac/network.sb.h"
#include "sandbox/policy/mac/ppapi.sb.h"
-#include "sandbox/policy/mac/print_backend.sb.h"
#include "sandbox/policy/mac/print_compositor.sb.h"
#include "sandbox/policy/mac/renderer.sb.h"
#include "sandbox/policy/mac/screen_ai.sb.h"
@@ -29,6 +28,10 @@
#include "sandbox/policy/mac/utility.sb.h"
#include "sandbox/policy/mojom/sandbox.mojom.h"
+#if BUILDFLAG(ENABLE_PRINTING)
+#include "sandbox/policy/mac/print_backend.sb.h"
+#endif
+
namespace sandbox {
namespace policy {

Просмотреть файл

@ -25,7 +25,6 @@
#include "base/threading/thread_task_runner_handle.h"
#include "base/values.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/printing/print_view_manager_base.h"
#include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h"
#include "chrome/browser/ui/views/eye_dropper/eye_dropper.h"
#include "chrome/common/pref_names.h"
@ -166,6 +165,7 @@
#endif
#if BUILDFLAG(ENABLE_PRINTING)
#include "chrome/browser/printing/print_view_manager_base.h"
#include "components/printing/browser/print_manager_utils.h"
#include "components/printing/browser/print_to_pdf/pdf_print_utils.h"
#include "printing/backend/print_backend.h" // nogncheck