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 #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 "chrome/common/print_messages.h" | 9 #include "chrome/common/print_messages.h" |
10 #include "content/public/renderer/render_thread.h" | 10 #include "content/public/renderer/render_thread.h" |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 // The printPage method take a reference to the canvas we pass down, so it | 174 // The printPage method take a reference to the canvas we pass down, so it |
175 // can't be a stack object. | 175 // can't be a stack object. |
176 skia::RefPtr<skia::VectorCanvas> canvas = | 176 skia::RefPtr<skia::VectorCanvas> canvas = |
177 skia::AdoptRef(new skia::VectorCanvas(device)); | 177 skia::AdoptRef(new skia::VectorCanvas(device)); |
178 MetafileSkiaWrapper::SetMetafileOnCanvas(*canvas, metafile); | 178 MetafileSkiaWrapper::SetMetafileOnCanvas(*canvas, metafile); |
179 skia::SetIsDraftMode(*canvas, is_print_ready_metafile_sent_); | 179 skia::SetIsDraftMode(*canvas, is_print_ready_metafile_sent_); |
180 | 180 |
181 if (params.params.display_header_footer) { | 181 if (params.params.display_header_footer) { |
182 // |page_number| is 0-based, so 1 is added. | 182 // |page_number| is 0-based, so 1 is added. |
183 // TODO(vitalybuka) : why does it work only with 1.25? | 183 // TODO(vitalybuka) : why does it work only with 1.25? |
184 PrintHeaderAndFooter(canvas.get(), params.page_number + 1, | 184 PrintHeaderAndFooter(canvas.get(), |
| 185 params.page_number + 1, |
185 print_preview_context_.total_page_count(), | 186 print_preview_context_.total_page_count(), |
| 187 *frame, |
186 scale_factor / 1.25, | 188 scale_factor / 1.25, |
187 page_layout_in_points, *header_footer_info_, | 189 page_layout_in_points, |
188 params.params); | 190 params.params); |
189 } | 191 } |
190 RenderPageContent(frame, params.page_number, canvas_area, content_area, | 192 RenderPageContent(frame, params.page_number, canvas_area, content_area, |
191 scale_factor, canvas.get()); | 193 scale_factor, canvas.get()); |
192 | 194 |
193 // Done printing. Close the device context to retrieve the compiled metafile. | 195 // Done printing. Close the device context to retrieve the compiled metafile. |
194 if (!metafile->FinishPage()) | 196 if (!metafile->FinishPage()) |
195 NOTREACHED() << "metafile failed"; | 197 NOTREACHED() << "metafile failed"; |
196 } | 198 } |
197 | 199 |
198 } // namespace printing | 200 } // namespace printing |
OLD | NEW |