From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Andy Locascio <andy@slack-corp.com>
Date: Thu, 2 Apr 2020 15:05:00 -0700
Subject: fix: account for print preview disabled when printing to pdf

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2068936

Avoid an optimization introduced in the above CL. In my limited
understanding, it seems like we slightly misuse the print preview API
and this is fallout from using it in a way the code doesn't expect.

diff --git a/components/printing/renderer/print_render_frame_helper.cc b/components/printing/renderer/print_render_frame_helper.cc
index 8350af471355b9c620d0c337545ce614974b5a6b..8456ec0c453345e5cab96728e501d341053d8cf2 100644
--- a/components/printing/renderer/print_render_frame_helper.cc
+++ b/components/printing/renderer/print_render_frame_helper.cc
@@ -1461,6 +1461,7 @@ PrintRenderFrameHelper::CreatePreviewDocument() {
   const std::vector<int>& pages = print_pages_params_->pages;
 
   bool require_document_metafile =
+      !g_is_preview_enabled ||
       print_renderer_ ||
       print_params.printed_doc_type != SkiaDocumentType::MSKP;
   if (!print_preview_context_.CreatePreviewDocument(
