[go: nahoru, domu]

Use process behavior field in PrintingContext

In order to support a policy override for controlling out-of-process
printing, the low-level //printing layer cannot rely solely upon the
printing feature flags.  Since policy preferences reside at a higher
level than //printing, this state information needs to be provided
to PrintingContext.

All logic under //printing which uses ShouldPrintJobOop() needs to be
changed.  In some cases it is insufficient to just rely upon the
existing signal for whether system calls should be skipped, so a more
detailed signal is needed.

Replace the PrintingContext "skip system calls" mechanism with an enum
to identify the process behavior desired.  This can provide the details
for whether OOP printing is involved in addition to whether system
calls should be skipped for the PrintingContext instance being created.

This API change ripples through the rest of the printing stack.  This
prepares the upper levels of the printing stack to be ready to override
the behavior if OOP printing policy is specified.

Printing support in Pepper is unused, so this code no longer even needs
to check the feature flags.  This code is just changed to use a
placeholder value of OOP disabled.

Bug: 1497035
Low-Coverage-Reason: HARD_TO_TEST, https://crbug.com/1256506, https://crbug.com/1451540
Change-Id: I8724631551aeeeb954560f3c28f5ffb1f5c0b1f7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4987444
Reviewed-by: Derek Schuff <dschuff@chromium.org>
Commit-Queue: Alan Screen <awscreen@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1220535}
diff --git a/printing/printing_context_mac.h b/printing/printing_context_mac.h
index c9a13ae..0b21e70 100644
--- a/printing/printing_context_mac.h
+++ b/printing/printing_context_mac.h
@@ -21,7 +21,7 @@
 
 class COMPONENT_EXPORT(PRINTING) PrintingContextMac : public PrintingContext {
  public:
-  explicit PrintingContextMac(Delegate* delegate);
+  PrintingContextMac(Delegate* delegate, ProcessBehavior process_behavior);
   PrintingContextMac(const PrintingContextMac&) = delete;
   PrintingContextMac& operator=(const PrintingContextMac&) = delete;
   ~PrintingContextMac() override;