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

Unified Diff: chrome/renderer/print_web_view_helper.h

Issue 8585017: PrintPreview: Honor the print media page size and margin values. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed review comments Created 9 years 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 24de40ef2530380b8025b96decc83c102e603bad..601d6536dbc197f40921cb176f7d33e8ffe71b2d 100644
--- a/chrome/renderer/print_web_view_helper.h
+++ b/chrome/renderer/print_web_view_helper.h
@@ -117,6 +117,12 @@ class PrintWebViewHelper
// Print the document with the print preview frame/node.
void OnPrintForSystemDialog();
+ // Update |ignore_frame_margins_css_| based on settings.
+ void UpdateFrameMarginsCssInfo(const base::DictionaryValue& settings);
+
+ // Returns true if the current destination printer is PRINT_TO_PDF.
+ bool IsPrintToPdfRequested(const base::DictionaryValue& settings);
+
// Initiate print preview.
void OnInitiatePrintPreview();
@@ -216,14 +222,15 @@ class PrintWebViewHelper
// |metafile| or a new one. In either case, the caller owns both |metafile|
// and the result.
printing::Metafile* RenderPage(const PrintMsg_Print_Params& params,
- float* scale_factor, int page_number,
+ double* scale_factor, int page_number,
bool is_preview, WebKit::WebFrame* frame,
printing::Metafile* metafile);
#elif defined(OS_MACOSX)
void RenderPage(const gfx::Size& page_size, const gfx::Rect& content_area,
- const float& scale_factor, int page_number,
+ const double& scale_factor, int page_number,
WebKit::WebFrame* frame, bool is_preview,
- printing::Metafile* metafile);
+ printing::Metafile* metafile,
+ printing::PageSizeMargins page_layout_in_points);
#elif defined(OS_POSIX)
bool RenderPages(const PrintMsg_PrintPages_Params& params,
WebKit::WebFrame* frame, const WebKit::WebNode& node,
@@ -242,13 +249,18 @@ class PrintWebViewHelper
WebKit::WebFrame* frame,
int page_index,
const PrintMsg_Print_Params& default_params,
+ bool ignore_frame_margins_css,
+ bool fit_to_page,
+ double* scale_factor,
printing::PageSizeMargins* page_layout_in_points);
static void UpdatePrintableSizeInPrintParameters(
vandebo (ex-Chrome) 2011/12/04 22:20:34 The name of this function now needs to be changed.
kmadhusu 2011/12/05 09:06:54 Done.
WebKit::WebFrame* frame,
const WebKit::WebNode& node,
PrepareFrameAndViewForPrint* prepare,
- PrintMsg_Print_Params* params);
+ const PrintMsg_Print_Params& params,
+ bool ignore_frame_margins_css,
+ bool fit_to_page);
// Given the |device| and |canvas| to draw on, prints the appropriate headers
// and footers using strings from |header_footer_info| on to the canvas.
@@ -299,6 +311,11 @@ class PrintWebViewHelper
scoped_ptr<PrintMsg_PrintPages_Params> print_pages_params_;
bool is_preview_enabled_;
bool is_print_ready_metafile_sent_;
+ bool ignore_frame_margins_css_;
vandebo (ex-Chrome) 2011/12/04 22:20:34 nit: ignore_frame_css_margins_ or just ignore_css_
kmadhusu 2011/12/05 09:06:54 Done. (ignore_frame_margins_css_ => ignore_css_mar
+
+ // True if we need to auto fit to page else false.
+ // NOTE: When we print to pdf, we don't fit to page.
+ bool fit_to_page_;
// Used for scripted initiated printing blocking.
base::Time last_cancelled_script_print_;
@@ -343,7 +360,9 @@ class PrintWebViewHelper
// Create the print preview document. |pages| is empty to print all pages.
bool CreatePreviewDocument(PrintMsg_Print_Params* params,
- const std::vector<int>& pages);
+ const std::vector<int>& pages,
+ bool ignore_frame_margins_css,
+ bool fit_to_page);
// Called after a page gets rendered. |page_time| is how long the
// rendering took.

Powered by Google App Engine
This is Rietveld 408576698