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

Side by Side Diff: chrome/renderer/print_web_view_helper_linux.cc

Issue 7348010: Added Header and Footer support using Skia (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Now we print either headers or footers (if we have space to print any). 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 #include "base/file_descriptor_posix.h" 7 #include "base/file_descriptor_posix.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 if (!device) 202 if (!device)
203 return; 203 return;
204 204
205 // The printPage method take a reference to the canvas we pass down, so it 205 // The printPage method take a reference to the canvas we pass down, so it
206 // can't be a stack object. 206 // can't be a stack object.
207 SkRefPtr<skia::VectorCanvas> canvas = new skia::VectorCanvas(device); 207 SkRefPtr<skia::VectorCanvas> canvas = new skia::VectorCanvas(device);
208 canvas->unref(); // SkRefPtr and new both took a reference. 208 canvas->unref(); // SkRefPtr and new both took a reference.
209 printing::MetafileSkiaWrapper::SetMetafileOnCanvas(canvas.get(), metafile); 209 printing::MetafileSkiaWrapper::SetMetafileOnCanvas(canvas.get(), metafile);
210 frame->printPage(params.page_number, canvas.get()); 210 frame->printPage(params.page_number, canvas.get());
211 211
212 // TODO(myhuang): We should render the header and the footer. 212 if (params.params.display_header_footer) {
213 // |page_number| is 0-based, so 1 is added.
214 // The scale factor on Linux is 1.
215 PrintHeaderAndFooter(device, canvas.get(), params.page_number + 1,
216 print_preview_context_.total_page_count(), 1,
217 page_layout_in_points, *header_footer_info_);
218 }
213 219
214 // Done printing. Close the device context to retrieve the compiled metafile. 220 // Done printing. Close the device context to retrieve the compiled metafile.
215 if (!metafile->FinishPage()) 221 if (!metafile->FinishPage())
216 NOTREACHED() << "metafile failed"; 222 NOTREACHED() << "metafile failed";
217 } 223 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698