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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
141 bool success = metafile->StartPage(page_size, content_area, scale_factor); | 141 bool success = metafile->StartPage(page_size, content_area, scale_factor); |
142 DCHECK(success); | 142 DCHECK(success); |
143 // printPage can create autoreleased references to |context|. PDF contexts | 143 // printPage can create autoreleased references to |context|. PDF contexts |
144 // don't write all their data until they are destroyed, so we need to make | 144 // don't write all their data until they are destroyed, so we need to make |
145 // certain that there are no lingering references. | 145 // certain that there are no lingering references. |
146 base::mac::ScopedNSAutoreleasePool pool; | 146 base::mac::ScopedNSAutoreleasePool pool; |
147 CGContextRef cgContext = metafile->context(); | 147 CGContextRef cgContext = metafile->context(); |
148 CGContextRef canvasPtr = cgContext; | 148 CGContextRef canvasPtr = cgContext; |
149 #endif | 149 #endif |
150 frame->printPage(page_number, canvasPtr); | 150 frame->printPage(page_number, canvasPtr); |
151 #if defined(USE_SKIA) | |
152 PrintMsg_Print_Params printParams = print_preview_context_.print_params(); | |
vandebo (ex-Chrome)
2011/08/12 22:18:20
const ref variable, otherwise you're making a copy
Aayush Kumar
2011/08/13 04:04:53
Done.
| |
153 if (printParams.display_header_footer) { | |
154 PageSizeMargins page_layout_in_points; | |
155 GetPageSizeAndMarginsInPoints(frame, page_number, printParams, | |
156 &page_layout_in_points); | |
157 // |page_number| is 0-based, so 1 is added. | |
158 PrintHeaderAndFooter(device, canvas.get(), page_number + 1, | |
159 print_preview_context_.total_page_count(), | |
160 scale_factor, page_layout_in_points, | |
161 *header_footer_info_); | |
162 } | |
163 #endif // USE_SKIA | |
151 } | 164 } |
152 | 165 |
153 // Done printing. Close the device context to retrieve the compiled metafile. | 166 // Done printing. Close the device context to retrieve the compiled metafile. |
154 metafile->FinishPage(); | 167 metafile->FinishPage(); |
155 } | 168 } |
OLD | NEW |