Chromium Code Reviews| 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..d24e3519e804ab1199bcb5d0aef4f40285145ece 100644 |
| --- a/chrome/renderer/print_web_view_helper.h |
| +++ b/chrome/renderer/print_web_view_helper.h |
| @@ -117,6 +117,19 @@ class PrintWebViewHelper |
| // Print the document with the print preview frame/node. |
| void OnPrintForSystemDialog(); |
| + // Update |page_size| and |content_area| information from |
| + // |page_layout_in_points|. |
| + void UpdatePageSizeAndContentAreaFromPageLayout( |
|
vandebo (ex-Chrome)
2011/12/14 19:05:38
Should this be GetPageSize... instead of UpdatePag
kmadhusu
2011/12/19 09:52:19
Done.
|
| + const printing::PageSizeMargins& page_layout_in_points, |
| + gfx::Size* page_size, |
| + gfx::Rect* content_area); |
| + |
| + // Update |ignore_css_margins_| 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 +229,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, |
| @@ -238,17 +252,23 @@ class PrintWebViewHelper |
| bool CopyMetafileDataToSharedMem(printing::Metafile* metafile, |
| base::SharedMemoryHandle* shared_mem_handle); |
| + // Helper method to get page layout in points and fit to page if needed. |
| static void GetPageSizeAndMarginsInPoints( |
|
vandebo (ex-Chrome)
2011/12/14 19:05:38
Should this name change? ComputePageLayout?
kmadhusu
2011/12/19 09:52:19
Done.
|
| WebKit::WebFrame* frame, |
| int page_index, |
| const PrintMsg_Print_Params& default_params, |
| + bool ignore_css_margins, |
| + bool fit_to_page, |
| + double* scale_factor, |
| printing::PageSizeMargins* page_layout_in_points); |
|
vandebo (ex-Chrome)
2011/12/14 19:05:38
Add a comment here saying that the page must be pr
kmadhusu
2011/12/19 09:52:19
Done.
|
| - static void UpdatePrintableSizeInPrintParameters( |
| + static void UpdatePageSizeAndMarginsInFrameAndView( |
|
vandebo (ex-Chrome)
2011/12/14 19:05:38
I think a still better name would be "UpdateFrameA
kmadhusu
2011/12/19 09:52:19
UpdatePageSizeAndMarginsInFrameAndView =>
UpdateF
|
| WebKit::WebFrame* frame, |
| const WebKit::WebNode& node, |
| PrepareFrameAndViewForPrint* prepare, |
| - PrintMsg_Print_Params* params); |
| + const PrintMsg_Print_Params& params, |
| + bool ignore_css_margins, |
| + 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 +319,11 @@ class PrintWebViewHelper |
| scoped_ptr<PrintMsg_PrintPages_Params> print_pages_params_; |
| bool is_preview_enabled_; |
| bool is_print_ready_metafile_sent_; |
| + bool ignore_css_margins_; |
|
vandebo (ex-Chrome)
2011/12/14 19:05:38
Should these two be in print_preview_context_ ? T
kmadhusu
2011/12/19 09:52:19
I prefer to declare these variables here. During t
|
| + |
| + // 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 +368,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_css_margins, |
| + bool fit_to_page); |
| // Called after a page gets rendered. |page_time| is how long the |
| // rendering took. |