Chromium Code Reviews| Index: components/printing/browser/print_manager_utils.cc |
| diff --git a/components/printing/browser/print_manager_utils.cc b/components/printing/browser/print_manager_utils.cc |
| index 3d71a985f6b852e3e650efd9de959ff2a7b7e9c5..ef14d00c22a08235f07bcf8146658cd7ad51ac16 100644 |
| --- a/components/printing/browser/print_manager_utils.cc |
| +++ b/components/printing/browser/print_manager_utils.cc |
| @@ -3,11 +3,38 @@ |
| // found in the LICENSE file. |
| #include "components/printing/browser/print_manager_utils.h" |
| + |
| +#include "base/command_line.h" |
| +#include "components/printing/browser/print_composite_client.h" |
| #include "components/printing/common/print_messages.h" |
| +#include "content/public/common/content_features.h" |
| +#include "content/public/common/content_switches.h" |
| #include "printing/print_settings.h" |
| namespace printing { |
| +// A temporary flag which makes supporting both paths for OOPIF and non-OOPIF |
| +// printing easier. |
| +static bool g_oopif_enabled; |
| + |
| +void SetOopifEnabled(bool enabled) { |
|
Lei Zhang
2017/08/28 22:46:39
Since this is setting a global variable, aren't th
Wei Li
2017/08/30 00:24:03
They belong to different embedders, so will not co
Lei Zhang
2017/08/30 02:00:35
Jianzhou, we are not trying to make headless mode
Wei Li
2017/08/31 21:00:25
I am pretty sure about this as headless chrome doe
jzfeng
2017/09/01 05:18:03
Yes, headless chrome is another embedder. It only
|
| + g_oopif_enabled = enabled; |
| +} |
| + |
| +bool IsOopifEnabled() { |
| + return g_oopif_enabled; |
| +} |
| + |
| +void CreateCompositeClientIfNeeded(content::WebContents* web_contents) { |
| + if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| + switches::kSitePerProcess) || |
| + base::FeatureList::IsEnabled(features::kTopDocumentIsolation)) { |
| + // For cases need to support OOPIFs. |
| + PrintCompositeClient::CreateForWebContents(web_contents); |
| + SetOopifEnabled(true); |
| + } |
| +} |
| + |
| void RenderParamsFromPrintSettings(const PrintSettings& settings, |
| PrintMsg_Print_Params* params) { |
| params->page_size = settings.page_setup_device_units().physical_size(); |
| @@ -32,7 +59,8 @@ void RenderParamsFromPrintSettings(const PrintSettings& settings, |
| params->display_header_footer = settings.display_header_footer(); |
| params->title = settings.title(); |
| params->url = settings.url(); |
| - params->printed_doc_type = SkiaDocumentType::PDF; |
| + params->printed_doc_type = |
| + IsOopifEnabled() ? SkiaDocumentType::MSKP : SkiaDocumentType::PDF; |
| } |
| } // namespace printing |