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

Side by Side Diff: chrome/renderer/print_web_view_helper_win.cc

Issue 8059034: Reland 103021: Printing preview of a PDF on Mac with Skia only previews the last page of the PDF (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/renderer/print_web_view_helper_mac.mm ('k') | printing/metafile_skia_wrapper.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/renderer/print_web_view_helper.h" 5 #include "chrome/renderer/print_web_view_helper.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/process_util.h" 10 #include "base/process_util.h"
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 static_cast<int>(page_layout_in_points.content_width), 186 static_cast<int>(page_layout_in_points.content_width),
187 static_cast<int>(page_layout_in_points.content_height)); 187 static_cast<int>(page_layout_in_points.content_height));
188 SkDevice* device = metafile->StartPageForVectorCanvas( 188 SkDevice* device = metafile->StartPageForVectorCanvas(
189 page_size, content_area, frame->getPrintPageShrink(page_number)); 189 page_size, content_area, frame->getPrintPageShrink(page_number));
190 DCHECK(device); 190 DCHECK(device);
191 // The printPage method may take a reference to the canvas we pass down, so it 191 // The printPage method may take a reference to the canvas we pass down, so it
192 // can't be a stack object. 192 // can't be a stack object.
193 SkRefPtr<skia::VectorCanvas> canvas = new skia::VectorCanvas(device); 193 SkRefPtr<skia::VectorCanvas> canvas = new skia::VectorCanvas(device);
194 canvas->unref(); // SkRefPtr and new both took a reference. 194 canvas->unref(); // SkRefPtr and new both took a reference.
195 if (is_preview) { 195 if (is_preview) {
196 printing::MetafileSkiaWrapper::SetMetafileOnCanvas(canvas.get(), metafile); 196 printing::MetafileSkiaWrapper::SetMetafileOnCanvas(*canvas, metafile);
197 printing::MetafileSkiaWrapper::SetDraftMode(canvas.get(), 197 skia::SetIsDraftMode(*canvas, is_print_ready_metafile_sent_);
198 is_print_ready_metafile_sent_); 198 skia::SetIsPreviewMetafile(*canvas, is_preview);
199 } 199 }
200 200
201 float webkit_scale_factor = frame->printPage(page_number, canvas.get()); 201 float webkit_scale_factor = frame->printPage(page_number, canvas.get());
202 202
203 if (params.display_header_footer) { 203 if (params.display_header_footer) {
204 // |page_number| is 0-based, so 1 is added. 204 // |page_number| is 0-based, so 1 is added.
205 PrintHeaderAndFooter(canvas.get(), page_number + 1, 205 PrintHeaderAndFooter(canvas.get(), page_number + 1,
206 print_preview_context_.total_page_count(), 206 print_preview_context_.total_page_count(),
207 webkit_scale_factor, page_layout_in_points, 207 webkit_scale_factor, page_layout_in_points,
208 *header_footer_info_); 208 *header_footer_info_);
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 shared_buf.Unmap(); 299 shared_buf.Unmap();
300 return false; 300 return false;
301 } 301 }
302 shared_buf.GiveToProcess(base::GetCurrentProcessHandle(), shared_mem_handle); 302 shared_buf.GiveToProcess(base::GetCurrentProcessHandle(), shared_mem_handle);
303 shared_buf.Unmap(); 303 shared_buf.Unmap();
304 304
305 Send(new PrintHostMsg_DuplicateSection(routing_id(), *shared_mem_handle, 305 Send(new PrintHostMsg_DuplicateSection(routing_id(), *shared_mem_handle,
306 shared_mem_handle)); 306 shared_mem_handle));
307 return true; 307 return true;
308 } 308 }
OLDNEW
« no previous file with comments | « chrome/renderer/print_web_view_helper_mac.mm ('k') | printing/metafile_skia_wrapper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698