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

Unified Diff: chrome/renderer/print_web_view_helper.h

Issue 7348010: Added Header and Footer support using Skia (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Removed header_footer_info param from IPC call. Created 9 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/renderer/print_web_view_helper.h
diff --git a/chrome/renderer/print_web_view_helper.h b/chrome/renderer/print_web_view_helper.h
index c59029c4a87fed9b8509c3744dc6d585a3a1cf76..b3b8af66e13ce0c547c7760751e195fd947141d8 100644
--- a/chrome/renderer/print_web_view_helper.h
+++ b/chrome/renderer/print_web_view_helper.h
@@ -25,6 +25,11 @@ struct PrintMsg_PrintPages_Params;
namespace base {
class DictionaryValue;
}
+namespace skia {
+class VectorCanvas;
+class VectorPlatformDeviceSkia;
+}
+template <typename t> class SkRefPtr;
// Class that calls the Begin and End print functions on the frame and changes
// the size of the view temporarily to support full page printing..
@@ -76,6 +81,15 @@ typedef struct PageSizeMargins {
double margin_left;
} PageSizeMargins;
+// Given the |device| and |canvas| to draw on, prints the appropriate headers
+// and footers using strings from |header_footer_info| on to the canvas.
+void PrintHeaderAndFooter(skia::VectorPlatformDeviceSkia* device,
Chris Guillory 2011/07/26 00:10:45 Optional: PrintHeaderAndFooterForPage?
Aayush Kumar 2011/07/26 01:55:41 I feel that the function name becomes really long,
+ const SkRefPtr<skia::VectorCanvas>& canvas,
Chris Guillory 2011/07/26 00:10:45 Can we remove the SkRefPtr usage here.
Aayush Kumar 2011/07/26 01:55:41 Done.
+ int page_number, int total_pages,
Chris Guillory 2011/07/26 00:10:45 Can you place these arguments on separate lines.
Aayush Kumar 2011/07/26 01:55:41 Done.
+ float webkit_scale_factor,
+ PageSizeMargins& page_layout_in_points,
Chris Guillory 2011/07/26 00:10:45 Can this be const.
Aayush Kumar 2011/07/26 01:55:41 Done.
+ const base::DictionaryValue* header_footer_info);
+
// PrintWebViewHelper handles most of the printing grunt work for RenderView.
// We plan on making print asynchronous and that will require copying the DOM
// of the document and creating a new WebView with the contents.
@@ -206,7 +220,8 @@ class PrintWebViewHelper : public RenderViewObserver,
void PrintPageInternal(const PrintMsg_PrintPage_Params& params,
const gfx::Size& canvas_size,
WebKit::WebFrame* frame,
- printing::Metafile* metafile);
+ printing::Metafile* metafile,
+ bool is_preview);
#else
void PrintPageInternal(const PrintMsg_PrintPage_Params& params,
const gfx::Size& canvas_size,
@@ -224,7 +239,8 @@ class PrintWebViewHelper : public RenderViewObserver,
#elif defined(OS_MACOSX)
void RenderPage(const gfx::Size& page_size, const gfx::Rect& content_area,
const float& scale_factor, int page_number,
- WebKit::WebFrame* frame, printing::Metafile* metafile);
+ WebKit::WebFrame* frame, printing::Metafile* metafile,
+ bool is_preview);
#elif defined(OS_POSIX)
bool RenderPages(const PrintMsg_PrintPages_Params& params,
WebKit::WebFrame* frame, WebKit::WebNode* node,
@@ -290,6 +306,10 @@ class PrintWebViewHelper : public RenderViewObserver,
scoped_ptr<PrintMsg_PrintPages_Params> old_print_pages_params_;
+ // Contains strings generated by the browser process to be printed as headers
+ // and footers if requested by the user.
+ base::DictionaryValue* header_footer_info_;
+
// Keeps track of the state of print preview between messages.
class PrintPreviewContext {
public:

Powered by Google App Engine
This is Rietveld 408576698