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

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: Updated as per Chris' comments. 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..6074b59d09b900990e6c80873bfe6d1e737662e8 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;
vandebo (ex-Chrome) 2011/07/26 06:11:37 I don't think this line is needed.
Aayush Kumar 2011/07/26 07:37:33 Done.
// 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,16 @@ 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,
+ skia::VectorCanvas& canvas,
+ int page_number,
+ int total_pages,
+ float webkit_scale_factor,
+ const 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.
@@ -206,7 +221,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);
vandebo (ex-Chrome) 2011/07/26 06:11:37 metafile is an output param, so is_preview has to
Aayush Kumar 2011/07/26 07:37:33 Done.
#else
void PrintPageInternal(const PrintMsg_PrintPage_Params& params,
const gfx::Size& canvas_size,
@@ -224,7 +240,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 +307,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