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

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: Initialized vars 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 4606c3716217f3d8db447e0272f6be95999e3217..38c675bf581063f1ff3f75509e7315554b33111f 100644
--- a/chrome/renderer/print_web_view_helper.h
+++ b/chrome/renderer/print_web_view_helper.h
@@ -27,6 +27,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..
@@ -192,7 +197,7 @@ class PrintWebViewHelper : public RenderViewObserver,
// Update the current print settings with new |job_settings|. |job_settings|
// dictionary contains print job details such as printer name, number of
// copies, page range, etc.
- bool UpdatePrintSettings(const base::DictionaryValue& job_settings);
+ bool UpdatePrintSettings(base::DictionaryValue* job_settings);
// Get final print settings from the user.
// Return false if the user cancels or on error.
@@ -260,6 +265,19 @@ class PrintWebViewHelper : public RenderViewObserver,
PrepareFrameAndViewForPrint* prepare,
PrintMsg_Print_Params* params);
+#if defined(USE_SKIA)
+ // Given the |device| and |canvas| to draw on, prints the appropriate headers
+ // and footers using strings from |header_footer_info| on to the canvas.
+ static void PrintHeaderAndFooter(
+ SkDevice* 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);
+#endif // USE_SKIA
+
bool GetPrintFrame(WebKit::WebFrame** frame);
// This reports the current time - |start_time| as the time to render a page.
@@ -303,6 +321,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