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 81d40e3cd716dba45740ed2e1fe8e0e7274b2c63..b77e2bcdcf083b4338e2fbd970ad41e82dbad472 100644 |
--- a/chrome/renderer/print_web_view_helper.h |
+++ b/chrome/renderer/print_web_view_helper.h |
@@ -11,9 +11,15 @@ |
#include "base/memory/scoped_ptr.h" |
#include "base/shared_memory.h" |
#include "base/time.h" |
+#include "base/utf_string_conversions.h" |
+#include "base/values.h" |
#include "content/renderer/render_view_observer.h" |
#include "content/renderer/render_view_observer_tracker.h" |
#include "printing/metafile.h" |
+#include "skia/ext/vector_canvas.h" |
+#include "third_party/skia/include/core/SkPaint.h" |
+#include "third_party/skia/include/core/SkRefCnt.h" |
+#include "third_party/skia/include/core/SkScalar.h" |
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrameClient.h" |
#include "third_party/WebKit/Source/WebKit/chromium/public/WebViewClient.h" |
#include "ui/gfx/size.h" |
@@ -66,6 +72,22 @@ class PrepareFrameAndViewForPrint { |
DISALLOW_COPY_AND_ASSIGN(PrepareFrameAndViewForPrint); |
}; |
+typedef struct PageSizeMargins { |
+ double content_width; |
+ double content_height; |
+ double margin_top; |
+ double margin_right; |
+ double margin_bottom; |
+ double margin_left; |
+} PageSizeMargins; |
+ |
+void PrintHeaderAndFooter(SkDevice *device, |
dpapad
2011/07/19 20:34:01
Document function and parameters.
Aayush Kumar
2011/07/21 21:58:53
Done.
|
+ const SkRefPtr<skia::VectorCanvas>& canvas, |
+ int page_number, int total_pages, |
+ float webkit_scale_factor, |
+ PageSizeMargins& page_size_margins, |
+ const 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. |
@@ -110,7 +132,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 DictionaryValue& header_footer_info); |
// Initialize the print preview document. |
bool CreatePreviewDocument(); |
@@ -188,7 +214,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, |
@@ -220,16 +247,10 @@ class PrintWebViewHelper : public RenderViewObserver, |
bool CopyMetafileDataToSharedMem(printing::Metafile* metafile, |
base::SharedMemoryHandle* shared_mem_handle); |
- void GetPageSizeAndMarginsInPoints( |
+ PageSizeMargins GetPageSizeAndMarginsInPoints( |
vandebo (ex-Chrome)
2011/07/19 21:31:20
It looks like this change is orthogonal to your he
Aayush Kumar
2011/07/21 21:58:53
I am creating another CL for this, and will remove
vandebo (ex-Chrome)
2011/07/22 22:58:33
Can you do that rebase? It'll be easier to review
Aayush Kumar
2011/07/24 02:09:02
Done.
Aayush Kumar
2011/07/24 02:09:02
CL number: 7492031
On 2011/07/22 22:58:33, vandebo
|
WebKit::WebFrame* frame, |
int page_index, |
- const PrintMsg_Print_Params& default_params, |
- double* content_width_in_points, |
- double* content_height_in_points, |
- double* margin_top_in_points, |
- double* margin_right_in_points, |
- double* margin_bottom_in_points, |
- double* margin_left_in_points); |
+ const PrintMsg_Print_Params& default_params); |
void UpdatePrintableSizeInPrintParameters(WebKit::WebFrame* frame, |
WebKit::WebNode* node, |
@@ -277,6 +298,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 DictionaryValue* header_footer_info_; |
+ |
// Keeps track of the state of print preview between messages. |
class PrintPreviewContext { |
public: |