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..0ab1c82bf8a2162bcba5dd7360853c1129ceb6da 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, |
+ const SkRefPtr<skia::VectorCanvas>& canvas, |
+ int page_number, int total_pages, |
+ float webkit_scale_factor, |
+ PageSizeMargins& page_layout_in_points, |
+ 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. |
@@ -123,7 +137,11 @@ class PrintWebViewHelper : public RenderViewObserver, |
void OnInitiatePrintPreview(); |
// Start the process of generating a print preview using |settings|. |
- void OnPrintPreview(const base::DictionaryValue& settings); |
+ // |header_footer_info| contains the necessary strings generated by the |
+ // browser process to be printed as headers and footers if requested by the |
+ // user. |
+ void OnPrintPreview(const base::DictionaryValue& settings, |
+ const base::DictionaryValue& header_footer_info); |
// Initialize the print preview document. |
bool CreatePreviewDocument(); |
@@ -206,7 +224,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 +243,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 +310,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. |
+ const base::DictionaryValue* header_footer_info_; |
+ |
// Keeps track of the state of print preview between messages. |
class PrintPreviewContext { |
public: |