Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(386)

Unified Diff: components/printing/browser/print_manager_utils.cc

Issue 2920013002: Use pdf compositor service for printing when OOPIF is enabled
Patch Set: rebase Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..9ebaab1cbf6ed9656677133f875f288e6521d018 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 = false;
+
+void SetOopifEnabled() {
+ g_oopif_enabled = true;
+}
+
+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();
+ }
+}
+
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
« no previous file with comments | « components/printing/browser/print_manager_utils.h ('k') | headless/lib/browser/headless_web_contents_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698