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

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: changed header_footer_info to scoped_ptr and some style changes. 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 4bae6dcff01fe2a5119c0d55d5538f119702cfd2..88a76c8fce1cf0b2fd41360f68a1a56999bf1763 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;
}
+#if defined(USE_SKIA)
+namespace skia {
+class VectorCanvas;
+}
+#endif
// 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,18 @@ 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.
+#if defined(USE_SKIA)
+void PrintHeaderAndFooter(SkDevice* device,
kmadhusu 2011/07/26 20:27:50 As per style guide, completely global functions sh
Aayush Kumar 2011/07/28 17:28:41 Done.
+ 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);
+#endif // USE_SKIA
+
// 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.
@@ -196,6 +213,7 @@ class PrintWebViewHelper : public RenderViewObserver,
void PrintPageInternal(const PrintMsg_PrintPage_Params& params,
const gfx::Size& canvas_size,
WebKit::WebFrame* frame,
+ bool is_preview,
printing::Metafile* metafile);
#else
void PrintPageInternal(const PrintMsg_PrintPage_Params& params,
@@ -214,7 +232,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, bool is_preview,
+ printing::Metafile* metafile);
#elif defined(OS_POSIX)
bool RenderPages(const PrintMsg_PrintPages_Params& params,
WebKit::WebFrame* frame, WebKit::WebNode* node,
@@ -280,6 +299,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.
+ scoped_ptr<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