summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/print_web_view_helper_linux.cc
diff options
context:
space:
mode:
authorkmadhusu@chromium.org <kmadhusu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-11 17:44:19 +0000
committerkmadhusu@chromium.org <kmadhusu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-11 17:44:19 +0000
commit81ac4a3fd428d19ec78072b8614a354cf0cc5c18 (patch)
tree8163015984f450fd5be6680f3805944d3534cc2f /chrome/renderer/print_web_view_helper_linux.cc
parent519140983be01363138a1766d05fd5ff34bad34c (diff)
downloadchromium_src-81ac4a3fd428d19ec78072b8614a354cf0cc5c18.zip
chromium_src-81ac4a3fd428d19ec78072b8614a354cf0cc5c18.tar.gz
chromium_src-81ac4a3fd428d19ec78072b8614a354cf0cc5c18.tar.bz2
Revert 96406 - Print preview page selection should not require a rerendering of draft pages.
On page selection, regenerate the complete document with the selection, but preserve the existing draft pages and simply display a subset of them. 1. Added a new param |clear all preview data| to |PrintHostMsg_DidGetPreviewPageCount|. 2. Removed |requested_preview_page_index| from |PrintMsg_ContinuePreview| BUG=84383 TEST=print preview works after code changes. Review URL: http://codereview.chromium.org/7544018 TBR=kmadhusu@chromium.org Review URL: http://codereview.chromium.org/7618014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@96414 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/print_web_view_helper_linux.cc')
-rw-r--r--chrome/renderer/print_web_view_helper_linux.cc24
1 files changed, 7 insertions, 17 deletions
diff --git a/chrome/renderer/print_web_view_helper_linux.cc b/chrome/renderer/print_web_view_helper_linux.cc
index 33e9321..0915681 100644
--- a/chrome/renderer/print_web_view_helper_linux.cc
+++ b/chrome/renderer/print_web_view_helper_linux.cc
@@ -29,29 +29,21 @@ void PrintWebViewHelper::RenderPreviewPage(int page_number) {
PrintMsg_PrintPage_Params page_params;
page_params.params = print_preview_context_.print_params();
page_params.page_number = page_number;
- scoped_ptr<printing::Metafile> draft_metafile;
- printing::Metafile* initial_render_metafile =
- print_preview_context_.metafile();
- if (print_preview_context_.IsModifiable() && is_print_ready_metafile_sent_) {
- draft_metafile.reset(new printing::PreviewMetafile);
- initial_render_metafile = draft_metafile.get();
- }
base::TimeTicks begin_time = base::TimeTicks::Now();
PrintPageInternal(page_params,
print_preview_context_.GetPrintCanvasSize(),
- print_preview_context_.frame(), initial_render_metafile);
+ print_preview_context_.frame(),
+ print_preview_context_.metafile());
+
print_preview_context_.RenderedPreviewPage(
base::TimeTicks::Now() - begin_time);
- if (draft_metafile.get()) {
- draft_metafile->FinishDocument();
- } else if (print_preview_context_.IsModifiable() &&
- print_preview_context_.generate_draft_pages()){
- DCHECK(!draft_metafile.get());
- draft_metafile.reset(
+ scoped_ptr<printing::Metafile> page_metafile;
+ if (print_preview_context_.IsModifiable()) {
+ page_metafile.reset(
print_preview_context_.metafile()->GetMetafileForCurrentPage());
}
- PreviewPageRendered(page_number, draft_metafile.get());
+ PreviewPageRendered(page_number, page_metafile.get());
}
bool PrintWebViewHelper::PrintPages(const PrintMsg_PrintPages_Params& params,
@@ -215,8 +207,6 @@ void PrintWebViewHelper::PrintPageInternal(
SkRefPtr<skia::VectorCanvas> canvas = new skia::VectorCanvas(device);
canvas->unref(); // SkRefPtr and new both took a reference.
printing::MetafileSkiaWrapper::SetMetafileOnCanvas(canvas.get(), metafile);
- printing::MetafileSkiaWrapper::SetDraftMode(canvas.get(),
- is_print_ready_metafile_sent_);
frame->printPage(params.page_number, canvas.get());
// TODO(myhuang): We should render the header and the footer.