OLD | NEW |
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 #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" |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 bool success = metafile->StartPage(page_size, content_area, scale_factor); | 130 bool success = metafile->StartPage(page_size, content_area, scale_factor); |
131 DCHECK(success); | 131 DCHECK(success); |
132 // printPage can create autoreleased references to |context|. PDF contexts | 132 // printPage can create autoreleased references to |context|. PDF contexts |
133 // don't write all their data until they are destroyed, so we need to make | 133 // don't write all their data until they are destroyed, so we need to make |
134 // certain that there are no lingering references. | 134 // certain that there are no lingering references. |
135 base::mac::ScopedNSAutoreleasePool pool; | 135 base::mac::ScopedNSAutoreleasePool pool; |
136 CGContextRef cgContext = metafile->context(); | 136 CGContextRef cgContext = metafile->context(); |
137 CGContextRef canvasPtr = cgContext; | 137 CGContextRef canvasPtr = cgContext; |
138 #endif | 138 #endif |
139 frame->printPage(page_number, canvasPtr); | 139 frame->printPage(page_number, canvasPtr); |
| 140 #if defined(USE_SKIA) |
| 141 PrintMsg_Print_Params printParams = print_preview_context_.print_params(); |
| 142 if (printParams.display_header_footer) { |
| 143 PageSizeMargins page_layout_in_points; |
| 144 GetPageSizeAndMarginsInPoints(frame, page_number, printParams, |
| 145 &page_layout_in_points); |
| 146 // |page_number| is 0-based, so 1 is added. |
| 147 PrintHeaderAndFooter(device, canvas.get(), page_number + 1, |
| 148 print_preview_context_.total_page_count(), |
| 149 scale_factor, page_layout_in_points, |
| 150 *header_footer_info_); |
| 151 } |
| 152 #endif // USE_SKIA |
140 } | 153 } |
141 | 154 |
142 // Done printing. Close the device context to retrieve the compiled metafile. | 155 // Done printing. Close the device context to retrieve the compiled metafile. |
143 metafile->FinishPage(); | 156 metafile->FinishPage(); |
144 } | 157 } |
OLD | NEW |