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

Unified Diff: chrome/renderer/print_web_view_helper.cc

Issue 11818062: Adds option to enable CSS backgrounds for printing. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 11 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: chrome/renderer/print_web_view_helper.cc
diff --git a/chrome/renderer/print_web_view_helper.cc b/chrome/renderer/print_web_view_helper.cc
index 250ed0fe08332ccc047bedc25deecb241afcb0c4..b799a4c5f4e164971b3b559880989a6d6edcc551 100644
--- a/chrome/renderer/print_web_view_helper.cc
+++ b/chrome/renderer/print_web_view_helper.cc
@@ -109,7 +109,9 @@ bool PrintMsg_Print_Params_IsEqual(
oldParams.params.title == newParams.params.title &&
oldParams.params.url == newParams.params.url &&
std::equal(oldParams.pages.begin(), oldParams.pages.end(),
- newParams.pages.begin());
+ newParams.pages.begin()) &&
+ oldParams.params.should_print_backgrounds ==
+ newParams.params.should_print_backgrounds;
}
PrintMsg_Print_Params GetCssPrintParams(
@@ -1290,6 +1292,14 @@ bool PrintWebViewHelper::UpdatePrintSettings(
PrintMsg_PrintPages_Params settings;
Send(new PrintHostMsg_UpdatePrintSettings(routing_id(),
cookie, *job_settings, &settings));
+
+ // Apply whether to print CSS backgrounds.
+ bool shouldPrintBackgrounds = false;
+ job_settings->GetBoolean(printing::kSettingShouldPrintBackgrounds,
+ &shouldPrintBackgrounds);
+ frame->view()->settings()->setShouldPrintBackgrounds(shouldPrintBackgrounds);
Lei Zhang 2013/01/10 23:30:11 This probably should go into PrintWebViewHelper::P
Toscano 2013/01/11 00:19:23 Hey Lei, I actually moved this to inside of the Pr
+ settings.params.should_print_backgrounds = shouldPrintBackgrounds;
+
print_pages_params_.reset(new PrintMsg_PrintPages_Params(settings));
if (!PrintMsg_Print_Params_IsValid(settings.params)) {
@@ -1349,6 +1359,7 @@ bool PrintWebViewHelper::UpdatePrintSettings(
print_pages_params_.reset(new PrintMsg_PrintPages_Params(settings));
Send(new PrintHostMsg_DidGetDocumentCookie(routing_id(),
settings.params.document_cookie));
+
return true;
}

Powered by Google App Engine
This is Rietveld 408576698