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

Unified Diff: components/printing/renderer/print_web_view_helper.h

Issue 1556463003: Mark printing code as basic printing and/or print preview code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 11 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
« no previous file with comments | « components/printing/common/print_messages.cc ('k') | components/printing/renderer/print_web_view_helper.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/printing/renderer/print_web_view_helper.h
diff --git a/components/printing/renderer/print_web_view_helper.h b/components/printing/renderer/print_web_view_helper.h
index 0de51e578c8ef0e65fe8e5b8c5a8d675d746e223..e3c4794dd5c84450908563fa200b08107e52e368 100644
--- a/components/printing/renderer/print_web_view_helper.h
+++ b/components/printing/renderer/print_web_view_helper.h
@@ -137,7 +137,9 @@ class PrintWebViewHelper
OK,
FAIL_PRINT_INIT,
FAIL_PRINT,
+#if defined(ENABLE_PRINT_PREVIEW)
FAIL_PREVIEW,
+#endif
};
enum PrintPreviewErrorBuckets {
@@ -169,10 +171,12 @@ class PrintWebViewHelper
#if defined(ENABLE_BASIC_PRINTING)
void OnPrintPages();
void OnPrintForSystemDialog();
-#endif // ENABLE_BASIC_PRINTING
+ void OnPrintForPrintPreview(const base::DictionaryValue& job_settings);
+#endif // defined(ENABLE_BASIC_PRINTING)
+#if defined(ENABLE_PRINT_PREVIEW)
void OnInitiatePrintPreview(bool selection_only);
void OnPrintPreview(const base::DictionaryValue& settings);
- void OnPrintForPrintPreview(const base::DictionaryValue& job_settings);
+#endif // defined(ENABLE_PRINT_PREVIEW)
void OnPrintingDone(bool success);
// Get |page_size| and |content_area| information from
@@ -185,9 +189,7 @@ class PrintWebViewHelper
// 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);
-
+#if defined(ENABLE_PRINT_PREVIEW)
// Prepare frame for creating preview document.
void PrepareFrameForPreviewDocument();
@@ -204,6 +206,7 @@ class PrintWebViewHelper
// Finalize the print ready preview document.
bool FinalizePrintReadyDocument();
+#endif // defined(ENABLE_PRINT_PREVIEW)
// Enable/Disable window.print calls. If |blocked| is true window.print
// calls will silently fail. Call with |blocked| set to false to reenable.
@@ -211,10 +214,12 @@ class PrintWebViewHelper
// Main printing code -------------------------------------------------------
+#if defined(ENABLE_BASIC_PRINTING)
// |is_scripted| should be true when the call is coming from window.print()
void Print(blink::WebLocalFrame* frame,
const blink::WebNode& node,
bool is_scripted);
+#endif // defined(ENABLE_BASIC_PRINTING)
// Notification when printing is done - signal tear-down/free resources.
void DidFinishPrinting(PrintingResult result);
@@ -230,6 +235,7 @@ class PrintWebViewHelper
const blink::WebNode& node,
int* number_of_pages);
+#if defined(ENABLE_PRINT_PREVIEW)
// Set options for print preset from source PDF document.
bool SetOptionsFromPdfDocument(
PrintHostMsg_SetOptionsFromDocument_Params* options);
@@ -240,6 +246,7 @@ class PrintWebViewHelper
bool UpdatePrintSettings(blink::WebLocalFrame* frame,
const blink::WebNode& node,
const base::DictionaryValue& passed_job_settings);
+#endif // defined(ENABLE_PRINT_PREVIEW)
// Get final print settings from the user.
// Return false if the user cancels or on error.
@@ -250,10 +257,15 @@ class PrintWebViewHelper
// Page Printing / Rendering ------------------------------------------------
+#if defined(ENABLE_BASIC_PRINTING)
void OnFramePreparedForPrintPages();
void PrintPages();
bool PrintPagesNative(blink::WebFrame* frame, int page_count);
void FinishFramePrinting();
+ // Render the frame for printing.
+ bool RenderPagesForPrint(blink::WebLocalFrame* frame,
+ const blink::WebNode& node);
+#endif // defined(ENABLE_BASIC_PRINTING)
// Prints the page listed in |params|.
#if defined(OS_LINUX) || defined(OS_ANDROID)
@@ -271,10 +283,6 @@ class PrintWebViewHelper
blink::WebFrame* frame);
#endif
- // Render the frame for printing.
- bool RenderPagesForPrint(blink::WebLocalFrame* frame,
- const blink::WebNode& node);
-
// Platform specific helper function for rendering page(s) to |metafile|.
#if defined(OS_MACOSX)
void RenderPage(const PrintMsg_Print_Params& params,
@@ -339,6 +347,7 @@ class PrintWebViewHelper
bool IsScriptInitiatedPrintAllowed(blink::WebFrame* frame,
bool user_initiated);
+#if defined(ENABLE_PRINT_PREVIEW)
// Shows scripted print preview when options from plugin are available.
void ShowScriptedPrintPreview();
@@ -354,6 +363,7 @@ class PrintWebViewHelper
// |metafile| is the rendered page. Otherwise |metafile| is NULL.
// Returns true if print preview should continue, false on failure.
bool PreviewPageRendered(int page_number, PdfMetafileSkia* metafile);
+#endif // defined(ENABLE_PRINT_PREVIEW)
void SetPrintPagesParams(const PrintMsg_PrintPages_Params& settings);
« no previous file with comments | « components/printing/common/print_messages.cc ('k') | components/printing/renderer/print_web_view_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698