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

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

Issue 7719014: PrintPreview: Printing preview of a PDF on Mac with Skia only previews the last page of the PDF (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: '' Created 9 years, 3 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
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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 page_size, content_area, frame->getPrintPageShrink(page_number)); 190 page_size, content_area, frame->getPrintPageShrink(page_number));
191 DCHECK(device); 191 DCHECK(device);
192 // The printPage method may take a reference to the canvas we pass down, so it 192 // The printPage method may take a reference to the canvas we pass down, so it
193 // can't be a stack object. 193 // can't be a stack object.
194 SkRefPtr<skia::VectorCanvas> canvas = new skia::VectorCanvas(device); 194 SkRefPtr<skia::VectorCanvas> canvas = new skia::VectorCanvas(device);
195 canvas->unref(); // SkRefPtr and new both took a reference. 195 canvas->unref(); // SkRefPtr and new both took a reference.
196 if (is_preview) { 196 if (is_preview) {
197 printing::MetafileSkiaWrapper::SetMetafileOnCanvas(canvas.get(), metafile); 197 printing::MetafileSkiaWrapper::SetMetafileOnCanvas(canvas.get(), metafile);
198 printing::MetafileSkiaWrapper::SetDraftMode(canvas.get(), 198 printing::MetafileSkiaWrapper::SetDraftMode(canvas.get(),
199 is_print_ready_metafile_sent_); 199 is_print_ready_metafile_sent_);
200 printing::MetafileSkiaWrapper::SetIsPreviewMetafile(canvas.get(),
201 is_preview);
200 } 202 }
201 203
202 float webkit_scale_factor = frame->printPage(page_number, canvas.get()); 204 float webkit_scale_factor = frame->printPage(page_number, canvas.get());
203 205
204 if (params.display_header_footer) { 206 if (params.display_header_footer) {
205 // |page_number| is 0-based, so 1 is added. 207 // |page_number| is 0-based, so 1 is added.
206 PrintHeaderAndFooter(canvas.get(), page_number + 1, 208 PrintHeaderAndFooter(canvas.get(), page_number + 1,
207 print_preview_context_.total_page_count(), 209 print_preview_context_.total_page_count(),
208 webkit_scale_factor, page_layout_in_points, 210 webkit_scale_factor, page_layout_in_points,
209 *header_footer_info_); 211 *header_footer_info_);
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 shared_buf.Unmap(); 302 shared_buf.Unmap();
301 return false; 303 return false;
302 } 304 }
303 shared_buf.GiveToProcess(base::GetCurrentProcessHandle(), shared_mem_handle); 305 shared_buf.GiveToProcess(base::GetCurrentProcessHandle(), shared_mem_handle);
304 shared_buf.Unmap(); 306 shared_buf.Unmap();
305 307
306 Send(new PrintHostMsg_DuplicateSection(routing_id(), *shared_mem_handle, 308 Send(new PrintHostMsg_DuplicateSection(routing_id(), *shared_mem_handle,
307 shared_mem_handle)); 309 shared_mem_handle));
308 return true; 310 return true;
309 } 311 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698