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

Side by Side Diff: chrome/renderer/print_web_view_helper_mac.mm

Issue 7348010: Added Header and Footer support using Skia (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Added SK_API to vector platform device skia Created 9 years, 4 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) 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
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 const PrintMsg_Print_Params& printParams =
153 print_preview_context_.print_params();
154 if (printParams.display_header_footer) {
155 PageSizeMargins page_layout_in_points;
156 GetPageSizeAndMarginsInPoints(frame, page_number, printParams,
157 &page_layout_in_points);
158 // |page_number| is 0-based, so 1 is added.
159 PrintHeaderAndFooter(device, canvas.get(), page_number + 1,
160 print_preview_context_.total_page_count(),
161 scale_factor, page_layout_in_points,
162 *header_footer_info_);
163 }
164 #endif // defined(USE_SKIA)
151 } 165 }
152 166
153 // Done printing. Close the device context to retrieve the compiled metafile. 167 // Done printing. Close the device context to retrieve the compiled metafile.
154 metafile->FinishPage(); 168 metafile->FinishPage();
155 } 169 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698