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..e7861f4aba6c749591ae908f4066c6f4384a0f66 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( |
@@ -494,6 +496,8 @@ PrepareFrameAndViewForPrint::PrepareFrameAndViewForPrint( |
prev_scroll_offset_ = web_frame->scrollOffset(); |
prev_view_size_ = web_view_->size(); |
+ should_print_backgrounds_ = print_params.should_print_backgrounds; |
Lei Zhang
2013/01/11 00:30:04
You can just put this in the initializer list.
Toscano
2013/01/11 01:41:05
Done.
|
+ |
StartPrinting(webkit_print_params); |
} |
@@ -507,6 +511,8 @@ void PrepareFrameAndViewForPrint::UpdatePrintParams( |
WebKit::WebPrintParams webkit_print_params; |
ComputeWebKitPrintParamsInDesiredDpi(print_params, &webkit_print_params); |
+ should_print_backgrounds_ = print_params.should_print_backgrounds; |
+ |
if (webkit_print_params.printContentArea == |
web_print_params_.printContentArea && |
webkit_print_params.printableArea == web_print_params_.printableArea && |
@@ -544,6 +550,8 @@ void PrepareFrameAndViewForPrint::StartPrinting( |
expected_pages_count_ = frame_->printBegin(web_print_params_, |
node_to_print_, |
&use_browser_overlays_); |
+ |
+ web_view_->settings()->setShouldPrintBackgrounds(should_print_backgrounds_); |
} |
void PrepareFrameAndViewForPrint::FinishPrinting() { |
@@ -553,6 +561,7 @@ void PrepareFrameAndViewForPrint::FinishPrinting() { |
web_view_->resize(prev_view_size_); |
if (WebKit::WebFrame* web_frame = web_view_->mainFrame()) |
web_frame->setScrollOffset(prev_scroll_offset_); |
+ web_view_->settings()->setShouldPrintBackgrounds(false); |
} |
} |
@@ -1349,6 +1358,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; |
} |