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

Unified Diff: chrome/renderer/print_web_view_helper.cc

Issue 7065011: Change printing of PDFs for preview on Windows to not rasterize. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 9 years, 7 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
« no previous file with comments | « chrome/renderer/print_web_view_helper.h ('k') | chrome/renderer/print_web_view_helper_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 cc3da5190a98f2c1488ebdd1dcbcb25624765244..fc34f7859e9563042c053c293afc0d7cc6986114 100644
--- a/chrome/renderer/print_web_view_helper.cc
+++ b/chrome/renderer/print_web_view_helper.cc
@@ -75,8 +75,11 @@ PrepareFrameAndViewForPrint::PrepareFrameAndViewForPrint(
WebFrame* frame,
WebNode* node,
WebView* web_view)
- : frame_(frame), web_view_(web_view), expected_pages_count_(0),
- use_browser_overlays_(true) {
+ : frame_(frame),
+ web_view_(web_view),
+ expected_pages_count_(0),
+ use_browser_overlays_(true),
+ finished_(false) {
int dpi = GetDPI(&print_params);
print_canvas_size_.set_width(
ConvertUnit(print_params.printable_size.width(), dpi,
@@ -110,12 +113,18 @@ PrepareFrameAndViewForPrint::PrepareFrameAndViewForPrint(
}
PrepareFrameAndViewForPrint::~PrepareFrameAndViewForPrint() {
- frame_->printEnd();
- web_view_->resize(prev_view_size_);
- if (WebFrame* web_frame = web_view_->mainFrame())
- web_frame->setScrollOffset(prev_scroll_offset_);
+ FinishPrinting();
}
+void PrepareFrameAndViewForPrint::FinishPrinting() {
+ if (!finished_) {
+ finished_ = true;
+ frame_->printEnd();
+ web_view_->resize(prev_view_size_);
+ if (WebFrame* web_frame = web_view_->mainFrame())
+ web_frame->setScrollOffset(prev_scroll_offset_);
+ }
+}
PrintWebViewHelper::PrintWebViewHelper(RenderView* render_view)
: RenderViewObserver(render_view),
« no previous file with comments | « chrome/renderer/print_web_view_helper.h ('k') | chrome/renderer/print_web_view_helper_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698