OLD | NEW |
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/printing/print_web_view_helper.h" | 5 #include "chrome/renderer/printing/print_web_view_helper.h" |
6 | 6 |
7 #import <AppKit/AppKit.h> | 7 #import <AppKit/AppKit.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/mac/scoped_nsautorelease_pool.h" | 10 #include "base/mac/scoped_nsautorelease_pool.h" |
11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
12 #include "chrome/common/print_messages.h" | 12 #include "chrome/common/print_messages.h" |
13 #include "printing/metafile_skia_wrapper.h" | 13 #include "printing/metafile_skia_wrapper.h" |
14 #include "printing/page_size_margins.h" | 14 #include "printing/page_size_margins.h" |
15 #include "skia/ext/platform_device.h" | 15 #include "skia/ext/platform_device.h" |
16 #include "skia/ext/vector_canvas.h" | 16 #include "skia/ext/vector_canvas.h" |
17 #include "third_party/WebKit/public/platform/WebCanvas.h" | 17 #include "third_party/WebKit/public/platform/WebCanvas.h" |
18 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 18 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
19 | 19 |
20 namespace printing { | 20 namespace printing { |
21 | 21 |
22 using blink::WebFrame; | 22 using blink::WebFrame; |
23 | 23 |
24 void PrintWebViewHelper::PrintPageInternal( | 24 void PrintWebViewHelper::PrintPageInternal( |
25 const PrintMsg_PrintPage_Params& params, | 25 const PrintMsg_PrintPage_Params& params, |
26 const gfx::Size& canvas_size, | |
27 WebFrame* frame) { | 26 WebFrame* frame) { |
28 PdfMetafileSkia metafile; | 27 PdfMetafileSkia metafile; |
29 if (!metafile.Init()) | 28 if (!metafile.Init()) |
30 return; | 29 return; |
31 | 30 |
32 int page_number = params.page_number; | 31 int page_number = params.page_number; |
33 gfx::Size page_size_in_dpi; | 32 gfx::Size page_size_in_dpi; |
34 gfx::Rect content_area_in_dpi; | 33 gfx::Rect content_area_in_dpi; |
35 RenderPage(print_pages_params_->params, page_number, frame, false, &metafile, | 34 RenderPage(print_pages_params_->params, page_number, frame, false, &metafile, |
36 &page_size_in_dpi, &content_area_in_dpi); | 35 &page_size_in_dpi, &content_area_in_dpi); |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 } | 141 } |
143 RenderPageContent(frame, page_number, canvas_area, content_area, | 142 RenderPageContent(frame, page_number, canvas_area, content_area, |
144 scale_factor, canvas_ptr); | 143 scale_factor, canvas_ptr); |
145 } | 144 } |
146 | 145 |
147 // Done printing. Close the device context to retrieve the compiled metafile. | 146 // Done printing. Close the device context to retrieve the compiled metafile. |
148 metafile->FinishPage(); | 147 metafile->FinishPage(); |
149 } | 148 } |
150 | 149 |
151 } // namespace printing | 150 } // namespace printing |
OLD | NEW |