Commit 28aeff36 authored by Alan Screen's avatar Alan Screen Committed by Commit Bot

Add XPS feature helper functions

There are various places in the printing code that need to check if
printing needs to use the GDI or XPS API.  Some printing code is solely
concerned if XPS printing is even a possibility (in particular for
process setup).  Add helper functions to simplify such use cases.

Bug: 1008222
Change-Id: If001018b7bd9615124db21493322fdecbe626573
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2032718
Commit-Queue: Alan Screen <awscreen@chromium.org>
Reviewed-by: default avatarLei Zhang <thestig@chromium.org>
Reviewed-by: default avatarDaniel Hosseinian <dhoss@chromium.org>
Cr-Commit-Position: refs/heads/master@{#745774}
parent d6932323
......@@ -23,6 +23,17 @@ const base::Feature kUseXpsForPrinting{"UseXpsForPrinting",
// GDI for modifiable content.
const base::Feature kUseXpsForPrintingFromPdf{
"UseXpsForPrintingFromPdf", base::FEATURE_DISABLED_BY_DEFAULT};
bool IsXpsPrintCapabilityRequired() {
return base::FeatureList::IsEnabled(features::kUseXpsForPrinting) ||
base::FeatureList::IsEnabled(features::kUseXpsForPrintingFromPdf);
}
bool ShouldPrintUsingXps(bool source_is_pdf) {
return base::FeatureList::IsEnabled(source_is_pdf
? features::kUseXpsForPrintingFromPdf
: features::kUseXpsForPrinting);
}
#endif // defined(OS_WIN)
} // namespace features
......
......@@ -21,6 +21,14 @@ PRINTING_EXPORT extern const base::Feature kAdvancedPpdAttributes;
#if defined(OS_WIN)
PRINTING_EXPORT extern const base::Feature kUseXpsForPrinting;
PRINTING_EXPORT extern const base::Feature kUseXpsForPrintingFromPdf;
// Helper function to determine if there is any print path which could require
// the use of XPS print capabilities.
PRINTING_EXPORT bool IsXpsPrintCapabilityRequired();
// Helper function to determine if printing of a document from a particular
// source should be done using XPS printing API instead of with GDI.
PRINTING_EXPORT bool ShouldPrintUsingXps(bool source_is_pdf);
#endif
} // namespace features
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment