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

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

Issue 10168013: [Print Preview] Modified PrepareFrameAndViewPrint class to call the new printBegin function to supp… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename WebPrintScalingOptions to WebPrintScalingOption Created 8 years, 8 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/file_descriptor_posix.h" 7 #include "base/file_descriptor_posix.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 } 54 }
55 return PreviewPageRendered(page_number, draft_metafile.get()); 55 return PreviewPageRendered(page_number, draft_metafile.get());
56 } 56 }
57 57
58 bool PrintWebViewHelper::PrintPages(WebFrame* frame, const WebNode& node) { 58 bool PrintWebViewHelper::PrintPages(WebFrame* frame, const WebNode& node) {
59 printing::NativeMetafile metafile; 59 printing::NativeMetafile metafile;
60 if (!metafile.Init()) 60 if (!metafile.Init())
61 return false; 61 return false;
62 62
63 const PrintMsg_PrintPages_Params& params = *print_pages_params_; 63 const PrintMsg_PrintPages_Params& params = *print_pages_params_;
64 PrepareFrameAndViewForPrint prep_frame_view(params.params, frame, node); 64 PrepareFrameAndViewForPrint prep_frame_view(params.params, frame, node,
65 print_scaling_option_);
65 int page_count = 0; 66 int page_count = 0;
66 if (!RenderPages(params, frame, node, &page_count, &prep_frame_view, 67 if (!RenderPages(params, frame, node, &page_count, &prep_frame_view,
67 &metafile)) { 68 &metafile)) {
68 return false; 69 return false;
69 } 70 }
70 71
71 // Get the size of the resulting metafile. 72 // Get the size of the resulting metafile.
72 uint32 buf_size = metafile.GetDataSize(); 73 uint32 buf_size = metafile.GetDataSize();
73 DCHECK_GT(buf_size, 0u); 74 DCHECK_GT(buf_size, 0u);
74 75
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 PrintHeaderAndFooter(canvas.get(), params.page_number + 1, 209 PrintHeaderAndFooter(canvas.get(), params.page_number + 1,
209 print_preview_context_.total_page_count(), 210 print_preview_context_.total_page_count(),
210 scale_factor, page_layout_in_points, 211 scale_factor, page_layout_in_points,
211 *header_footer_info_); 212 *header_footer_info_);
212 } 213 }
213 214
214 // Done printing. Close the device context to retrieve the compiled metafile. 215 // Done printing. Close the device context to retrieve the compiled metafile.
215 if (!metafile->FinishPage()) 216 if (!metafile->FinishPage())
216 NOTREACHED() << "metafile failed"; 217 NOTREACHED() << "metafile failed";
217 } 218 }
OLDNEW
« chrome/renderer/print_web_view_helper.cc ('K') | « chrome/renderer/print_web_view_helper.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698