cef/patch/patches/print_header_footer_1478_1565.patch
2016-02-02 22:16:48 -05:00

555 lines
22 KiB
Diff

diff --git printing/common/print_messages.cc printing/common/print_messages.cc
index c3469fc..9fc71ac 100644
--- printing/common/print_messages.cc
+++ printing/common/print_messages.cc
@@ -95,7 +95,6 @@ void PrintMsg_PrintPages_Params::Reset() {
pages = std::vector<int>();
}
-#if defined(ENABLE_PRINT_PREVIEW)
PrintHostMsg_RequestPrintPreview_Params::
PrintHostMsg_RequestPrintPreview_Params()
: is_modifiable(false),
@@ -117,4 +116,3 @@ PrintHostMsg_SetOptionsFromDocument_Params::
PrintHostMsg_SetOptionsFromDocument_Params::
~PrintHostMsg_SetOptionsFromDocument_Params() {
}
-#endif // defined(ENABLE_PRINT_PREVIEW)
diff --git printing/common/print_messages.h printing/common/print_messages.h
index 372097f..ae8a227 100644
--- printing/common/print_messages.h
+++ printing/common/print_messages.h
@@ -70,7 +70,6 @@ struct PrintMsg_PrintPages_Params {
std::vector<int> pages;
};
-#if defined(ENABLE_PRINT_PREVIEW)
struct PrintHostMsg_RequestPrintPreview_Params {
PrintHostMsg_RequestPrintPreview_Params();
~PrintHostMsg_RequestPrintPreview_Params();
@@ -89,7 +88,6 @@ struct PrintHostMsg_SetOptionsFromDocument_Params {
printing::DuplexMode duplex;
printing::PageRanges page_ranges;
};
-#endif // defined(ENABLE_PRINT_PREVIEW)
#endif // COMPONENTS_PRINTING_COMMON_PRINT_MESSAGES_H_
@@ -182,7 +180,6 @@ IPC_STRUCT_TRAITS_BEGIN(printing::PageRange)
IPC_STRUCT_TRAITS_MEMBER(to)
IPC_STRUCT_TRAITS_END()
-#if defined(ENABLE_PRINT_PREVIEW)
IPC_STRUCT_TRAITS_BEGIN(PrintHostMsg_RequestPrintPreview_Params)
IPC_STRUCT_TRAITS_MEMBER(is_modifiable)
IPC_STRUCT_TRAITS_MEMBER(webnode_only)
@@ -203,7 +200,6 @@ IPC_STRUCT_TRAITS_BEGIN(PrintHostMsg_SetOptionsFromDocument_Params)
// Specifies page range to be printed.
IPC_STRUCT_TRAITS_MEMBER(page_ranges)
IPC_STRUCT_TRAITS_END()
-#endif // defined(ENABLE_PRINT_PREVIEW)
IPC_STRUCT_TRAITS_BEGIN(printing::PageSizeMargins)
IPC_STRUCT_TRAITS_MEMBER(content_width)
@@ -223,7 +219,6 @@ IPC_STRUCT_TRAITS_BEGIN(PrintMsg_PrintPages_Params)
IPC_STRUCT_TRAITS_MEMBER(pages)
IPC_STRUCT_TRAITS_END()
-#if defined(ENABLE_PRINT_PREVIEW)
// Parameters to describe a rendered document.
IPC_STRUCT_BEGIN(PrintHostMsg_DidPreviewDocument_Params)
// A shared memory handle to metafile data.
@@ -277,7 +272,6 @@ IPC_STRUCT_BEGIN(PrintHostMsg_DidGetPreviewPageCount_Params)
// Indicates whether the existing preview data needs to be cleared or not.
IPC_STRUCT_MEMBER(bool, clear_preview_data)
IPC_STRUCT_END()
-#endif // defined(ENABLE_PRINT_PREVIEW)
// Parameters to describe a rendered page.
IPC_STRUCT_BEGIN(PrintHostMsg_DidPrintPage_Params)
@@ -315,22 +309,20 @@ IPC_STRUCT_END()
// Messages sent from the browser to the renderer.
-#if defined(ENABLE_PRINT_PREVIEW)
// Tells the render view to initiate print preview for the entire document.
IPC_MESSAGE_ROUTED1(PrintMsg_InitiatePrintPreview, bool /* selection_only */)
-#endif // defined(ENABLE_PRINT_PREVIEW)
// Tells the render frame to initiate printing or print preview for a particular
// node, depending on which mode the render frame is in.
IPC_MESSAGE_ROUTED0(PrintMsg_PrintNodeUnderContextMenu)
-#if defined(ENABLE_BASIC_PRINTING) && defined(ENABLE_PRINT_PREVIEW)
+#if defined(ENABLE_BASIC_PRINTING)
// Tells the renderer to print the print preview tab's PDF plugin without
// showing the print dialog. (This is the final step in the print preview
// workflow.)
IPC_MESSAGE_ROUTED1(PrintMsg_PrintForPrintPreview,
base::DictionaryValue /* settings */)
-#endif // defined(ENABLE_BASIC_PRINTING) && defined(ENABLE_PRINT_PREVIEW)
+#endif // defined(ENABLE_BASIC_PRINTING)
#if defined(ENABLE_BASIC_PRINTING)
// Tells the render view to switch the CSS to print media type, renders every
@@ -349,13 +341,11 @@ IPC_MESSAGE_ROUTED1(PrintMsg_PrintingDone,
IPC_MESSAGE_ROUTED1(PrintMsg_SetScriptedPrintingBlocked,
bool /* blocked */)
-#if defined(ENABLE_PRINT_PREVIEW)
// Tells the render view to switch the CSS to print media type, renders every
// requested pages for print preview using the given |settings|. This gets
// called multiple times as the user updates settings.
IPC_MESSAGE_ROUTED1(PrintMsg_PrintPreview,
base::DictionaryValue /* settings */)
-#endif // defined(ENABLE_PRINT_PREVIEW)
// Messages sent from the renderer to the browser.
@@ -423,7 +413,6 @@ IPC_MESSAGE_CONTROL2(PrintHostMsg_TempFileForPrintingWritten,
int /* fd in browser */) // Used only by Chrome OS.
#endif // defined(OS_ANDROID)
-#if defined(ENABLE_PRINT_PREVIEW)
// Asks the browser to do print preview.
IPC_MESSAGE_ROUTED1(PrintHostMsg_RequestPrintPreview,
PrintHostMsg_RequestPrintPreview_Params /* params */)
@@ -457,7 +446,6 @@ IPC_SYNC_MESSAGE_ROUTED2_1(PrintHostMsg_CheckForCancel,
// The memory handle in this message is already valid in the browser process.
IPC_MESSAGE_ROUTED1(PrintHostMsg_MetafileReadyForPrinting,
PrintHostMsg_DidPreviewDocument_Params /* params */)
-#endif // defined(ENABLE_PRINT_PREVIEW)
// This is sent when there are invalid printer settings.
IPC_MESSAGE_ROUTED0(PrintHostMsg_ShowInvalidPrinterSettingsError)
@@ -466,7 +454,6 @@ IPC_MESSAGE_ROUTED0(PrintHostMsg_ShowInvalidPrinterSettingsError)
IPC_MESSAGE_ROUTED1(PrintHostMsg_PrintingFailed,
int /* document cookie */)
-#if defined(ENABLE_PRINT_PREVIEW)
// Tell the browser print preview failed.
IPC_MESSAGE_ROUTED1(PrintHostMsg_PrintPreviewFailed,
int /* document cookie */)
@@ -493,4 +480,3 @@ IPC_MESSAGE_ROUTED1(PrintHostMsg_ShowScriptedPrintPreview,
// Notify the browser to set print presets based on source PDF document.
IPC_MESSAGE_ROUTED1(PrintHostMsg_SetOptionsFromDocument,
PrintHostMsg_SetOptionsFromDocument_Params /* params */)
-#endif // defined(ENABLE_PRINT_PREVIEW)
diff --git printing/renderer/print_web_view_helper.cc printing/renderer/print_web_view_helper.cc
index ff97954..c93dabf 100644
--- printing/renderer/print_web_view_helper.cc
+++ printing/renderer/print_web_view_helper.cc
@@ -80,6 +80,9 @@ const double kMinDpi = 1.0;
#if defined(ENABLE_PRINT_PREVIEW)
bool g_is_preview_enabled = true;
+#else
+bool g_is_preview_enabled = false;
+#endif // defined(ENABLE_PRINT_PREVIEW)
const char kPageLoadScriptFormat[] =
"document.open(); document.write(%s); document.close();";
@@ -94,9 +97,6 @@ void ExecuteScript(blink::WebFrame* frame,
std::string script = base::StringPrintf(script_format, json.c_str());
frame->executeScript(blink::WebString(base::UTF8ToUTF16(script)));
}
-#else
-bool g_is_preview_enabled = false;
-#endif // defined(ENABLE_PRINT_PREVIEW)
int GetDPI(const PrintMsg_Print_Params* print_params) {
#if defined(OS_MACOSX)
@@ -306,7 +306,6 @@ bool PrintingNodeOrPdfFrame(const blink::WebLocalFrame* frame,
return plugin && plugin->supportsPaginatedPrint();
}
-#if defined(ENABLE_PRINT_PREVIEW)
// Returns true if the current destination printer is PRINT_TO_PDF.
bool IsPrintToPdfRequested(const base::DictionaryValue& job_settings) {
bool print_to_pdf = false;
@@ -328,7 +327,6 @@ bool PrintingFrameHasPageSizeStyle(blink::WebFrame* frame,
}
return frame_has_custom_page_size_style;
}
-#endif // defined(ENABLE_PRINT_PREVIEW)
// Disable scaling when either:
// - The PDF specifies disabling scaling.
@@ -375,7 +373,6 @@ MarginType GetMarginsForPdf(blink::WebLocalFrame* frame,
}
#endif
-#if defined(ENABLE_PRINT_PREVIEW)
bool FitToPageEnabled(const base::DictionaryValue& job_settings) {
bool fit_to_paper_size = false;
if (!job_settings.GetBoolean(kSettingFitToPageEnabled, &fit_to_paper_size)) {
@@ -417,7 +414,6 @@ blink::WebPrintScalingOption GetPrintScalingOption(
}
return blink::WebPrintScalingOptionFitToPrintableArea;
}
-#endif // defined(ENABLE_PRINT_PREVIEW)
PrintMsg_Print_Params CalculatePrintParamsForCss(
blink::WebFrame* frame,
@@ -501,7 +497,6 @@ blink::WebView* FrameReference::view() {
return view_;
}
-#if defined(ENABLE_PRINT_PREVIEW)
// static - Not anonymous so that platform implementations can use it.
void PrintWebViewHelper::PrintHeaderAndFooter(
blink::WebCanvas* canvas,
@@ -557,7 +552,6 @@ void PrintWebViewHelper::PrintHeaderAndFooter(
web_view->close();
frame->close();
}
-#endif // defined(ENABLE_PRINT_PREVIEW)
// static - Not anonymous so that platform implementations can use it.
float PrintWebViewHelper::RenderPageContent(blink::WebFrame* frame,
@@ -830,6 +824,7 @@ PrintWebViewHelper::PrintWebViewHelper(content::RenderView* render_view,
print_for_preview_(false),
delegate_(std::move(delegate)),
print_node_in_progress_(false),
+ force_print_preview_(false),
is_loading_(false),
is_scripted_preview_delayed_(false),
ipc_nesting_level_(0),
@@ -888,10 +883,8 @@ void PrintWebViewHelper::PrintPage(blink::WebLocalFrame* frame,
return;
if (g_is_preview_enabled) {
-#if defined(ENABLE_PRINT_PREVIEW)
print_preview_context_.InitWithFrame(frame);
RequestPrintPreview(PRINT_PREVIEW_SCRIPTED);
-#endif
} else {
#if defined(ENABLE_BASIC_PRINTING)
Print(frame, blink::WebNode(), true);
@@ -915,14 +908,10 @@ bool PrintWebViewHelper::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(PrintMsg_PrintPages, OnPrintPages)
IPC_MESSAGE_HANDLER(PrintMsg_PrintForSystemDialog, OnPrintForSystemDialog)
#endif // defined(ENABLE_BASIC_PRINTING)
-#if defined(ENABLE_BASIC_PRINTING) && defined(ENABLE_PRINT_PREVIEW)
IPC_MESSAGE_HANDLER(PrintMsg_PrintForPrintPreview, OnPrintForPrintPreview)
-#endif
-#if defined(ENABLE_PRINT_PREVIEW)
IPC_MESSAGE_HANDLER(PrintMsg_InitiatePrintPreview, OnInitiatePrintPreview)
IPC_MESSAGE_HANDLER(PrintMsg_PrintPreview, OnPrintPreview)
IPC_MESSAGE_HANDLER(PrintMsg_PrintingDone, OnPrintingDone)
-#endif // defined(ENABLE_PRINT_PREVIEW)
IPC_MESSAGE_HANDLER(PrintMsg_SetScriptedPrintingBlocked,
SetScriptedPrintBlocked)
IPC_MESSAGE_UNHANDLED(handled = false)
@@ -974,7 +963,6 @@ void PrintWebViewHelper::OnPrintForSystemDialog() {
}
#endif // defined(ENABLE_BASIC_PRINTING)
-#if defined(ENABLE_BASIC_PRINTING) && defined(ENABLE_PRINT_PREVIEW)
void PrintWebViewHelper::OnPrintForPrintPreview(
const base::DictionaryValue& job_settings) {
CHECK_LE(ipc_nesting_level_, 1);
@@ -1039,7 +1027,6 @@ void PrintWebViewHelper::OnPrintForPrintPreview(
DidFinishPrinting(FAIL_PRINT);
}
}
-#endif // defined(ENABLE_BASIC_PRINTING) && defined(ENABLE_PRINT_PREVIEW)
void PrintWebViewHelper::GetPageSizeAndContentAreaFromPageLayout(
const PageSizeMargins& page_layout_in_points,
@@ -1064,7 +1051,6 @@ void PrintWebViewHelper::UpdateFrameMarginsCssInfo(
ignore_css_margins_ = (margins_type != DEFAULT_MARGINS);
}
-#if defined(ENABLE_PRINT_PREVIEW)
void PrintWebViewHelper::OnPrintPreview(const base::DictionaryValue& settings) {
if (ipc_nesting_level_ > 1)
return;
@@ -1225,7 +1211,7 @@ bool PrintWebViewHelper::CreatePreviewDocument() {
return true;
}
-#if !defined(OS_MACOSX) && defined(ENABLE_PRINT_PREVIEW)
+#if !defined(OS_MACOSX)
bool PrintWebViewHelper::RenderPreviewPage(
int page_number,
const PrintMsg_Print_Params& print_params) {
@@ -1254,7 +1240,7 @@ bool PrintWebViewHelper::RenderPreviewPage(
}
return PreviewPageRendered(page_number, draft_metafile.get());
}
-#endif // !defined(OS_MACOSX) && defined(ENABLE_PRINT_PREVIEW)
+#endif // !defined(OS_MACOSX)
bool PrintWebViewHelper::FinalizePrintReadyDocument() {
DCHECK(!is_print_ready_metafile_sent_);
@@ -1284,7 +1270,6 @@ bool PrintWebViewHelper::FinalizePrintReadyDocument() {
Send(new PrintHostMsg_MetafileReadyForPrinting(routing_id(), preview_params));
return true;
}
-#endif // defined(ENABLE_PRINT_PREVIEW)
void PrintWebViewHelper::OnPrintingDone(bool success) {
if (ipc_nesting_level_ > 1)
@@ -1299,7 +1284,6 @@ void PrintWebViewHelper::SetScriptedPrintBlocked(bool blocked) {
is_scripted_printing_blocked_ = blocked;
}
-#if defined(ENABLE_PRINT_PREVIEW)
void PrintWebViewHelper::OnInitiatePrintPreview(bool selection_only) {
if (ipc_nesting_level_ > 1)
return;
@@ -1310,7 +1294,9 @@ void PrintWebViewHelper::OnInitiatePrintPreview(bool selection_only) {
// that instead.
auto plugin = delegate_->GetPdfElement(frame);
if (!plugin.isNull()) {
+ force_print_preview_ = true;
PrintNode(plugin);
+ force_print_preview_ = false;
return;
}
print_preview_context_.InitWithFrame(frame);
@@ -1318,7 +1304,6 @@ void PrintWebViewHelper::OnInitiatePrintPreview(bool selection_only) {
? PRINT_PREVIEW_USER_INITIATED_SELECTION
: PRINT_PREVIEW_USER_INITIATED_ENTIRE_FRAME);
}
-#endif
bool PrintWebViewHelper::IsPrintingEnabled() {
bool result = false;
@@ -1344,11 +1329,9 @@ void PrintWebViewHelper::PrintNode(const blink::WebNode& node) {
// Make a copy of the node, in case RenderView::OnContextMenuClosed resets
// its |context_menu_node_|.
- if (g_is_preview_enabled) {
-#if defined(ENABLE_PRINT_PREVIEW)
+ if (g_is_preview_enabled || force_print_preview_) {
print_preview_context_.InitWithNode(node);
RequestPrintPreview(PRINT_PREVIEW_USER_INITIATED_CONTEXT_NODE);
-#endif
} else {
#if defined(ENABLE_BASIC_PRINTING)
blink::WebNode duplicate_node(node);
@@ -1414,7 +1397,6 @@ void PrintWebViewHelper::DidFinishPrinting(PrintingResult result) {
}
break;
-#if defined(ENABLE_PRINT_PREVIEW)
case FAIL_PREVIEW:
int cookie =
print_pages_params_ ? print_pages_params_->params.document_cookie : 0;
@@ -1426,7 +1408,6 @@ void PrintWebViewHelper::DidFinishPrinting(PrintingResult result) {
}
print_preview_context_.Failed(notify_browser_of_print_failure_);
break;
-#endif // defined(ENABLE_PRINT_PREVIEW)
}
prep_frame_view_.reset();
print_pages_params_.reset();
@@ -1558,7 +1539,6 @@ bool PrintWebViewHelper::CalculateNumberOfPages(blink::WebLocalFrame* frame,
return true;
}
-#if defined(ENABLE_PRINT_PREVIEW)
bool PrintWebViewHelper::SetOptionsFromPdfDocument(
PrintHostMsg_SetOptionsFromDocument_Params* options) {
blink::WebLocalFrame* source_frame = print_preview_context_.source_frame();
@@ -1667,7 +1647,6 @@ bool PrintWebViewHelper::UpdatePrintSettings(
return true;
}
-#endif // defined(ENABLE_PRINT_PREVIEW)
#if defined(ENABLE_BASIC_PRINTING)
bool PrintWebViewHelper::GetPrintSettingsFromUser(blink::WebLocalFrame* frame,
@@ -1759,11 +1738,14 @@ void PrintWebViewHelper::PrintPageInternal(
gfx::Rect canvas_area =
params.params.display_header_footer ? gfx::Rect(page_size) : content_area;
-#if defined(OS_WIN) || defined(ENABLE_PRINT_PREVIEW)
+#if defined(OS_WIN)
float webkit_page_shrink_factor =
frame->getPrintPageShrink(params.page_number);
float scale_factor = css_scale_factor * webkit_page_shrink_factor;
+#else
+ float scale_factor = css_scale_factor / 1.25f;
#endif
+
// TODO(thestig) GetVectorCanvasForNewPage() and RenderPageContent() take a
// different scale factor vs Windows. Figure out why and combine the two.
#if defined(OS_WIN)
@@ -1779,14 +1761,12 @@ void PrintWebViewHelper::PrintPageInternal(
MetafileSkiaWrapper::SetMetafileOnCanvas(*canvas, metafile);
-#if defined(ENABLE_PRINT_PREVIEW)
if (params.params.display_header_footer) {
// |page_number| is 0-based, so 1 is added.
PrintHeaderAndFooter(canvas, params.page_number + 1,
print_preview_context_.total_page_count(), *frame,
scale_factor, page_layout_in_points, params.params);
}
-#endif // defined(ENABLE_PRINT_PREVIEW)
float webkit_scale_factor =
RenderPageContent(frame, params.page_number, canvas_area, content_area,
@@ -1841,7 +1821,6 @@ bool PrintWebViewHelper::CopyMetafileDataToSharedMem(
#endif // defined(OS_WIN)
}
-#if defined(ENABLE_PRINT_PREVIEW)
void PrintWebViewHelper::ShowScriptedPrintPreview() {
if (is_scripted_preview_delayed_) {
is_scripted_preview_delayed_ = false;
@@ -1969,7 +1948,6 @@ bool PrintWebViewHelper::PreviewPageRendered(int page_number,
Send(new PrintHostMsg_DidPreviewPage(routing_id(), preview_page_params));
return true;
}
-#endif // defined(ENABLE_PRINT_PREVIEW)
PrintWebViewHelper::PrintPreviewContext::PrintPreviewContext()
: total_page_count_(0),
diff --git printing/renderer/print_web_view_helper.h printing/renderer/print_web_view_helper.h
index ca10384..7aacfbc 100644
--- printing/renderer/print_web_view_helper.h
+++ printing/renderer/print_web_view_helper.h
@@ -137,9 +137,7 @@ class PrintWebViewHelper
OK,
FAIL_PRINT_INIT,
FAIL_PRINT,
-#if defined(ENABLE_PRINT_PREVIEW)
FAIL_PREVIEW,
-#endif
};
enum PrintPreviewErrorBuckets {
@@ -173,10 +171,8 @@ class PrintWebViewHelper
void OnPrintForSystemDialog();
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);
-#endif // defined(ENABLE_PRINT_PREVIEW)
void OnPrintingDone(bool success);
// Get |page_size| and |content_area| information from
@@ -189,7 +185,6 @@ class PrintWebViewHelper
// Update |ignore_css_margins_| based on settings.
void UpdateFrameMarginsCssInfo(const base::DictionaryValue& settings);
-#if defined(ENABLE_PRINT_PREVIEW)
// Prepare frame for creating preview document.
void PrepareFrameForPreviewDocument();
@@ -206,7 +201,6 @@ 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.
@@ -235,7 +229,6 @@ 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);
@@ -246,7 +239,6 @@ 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.
@@ -321,7 +313,6 @@ class PrintWebViewHelper
const PrintMsg_PrintPages_Params& params,
int page_count);
-#if defined(ENABLE_PRINT_PREVIEW)
// 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(blink::WebCanvas* canvas,
@@ -331,7 +322,6 @@ class PrintWebViewHelper
float webkit_scale_factor,
const PageSizeMargins& page_layout_in_points,
const PrintMsg_Print_Params& params);
-#endif // defined(ENABLE_PRINT_PREVIEW)
bool GetPrintFrame(blink::WebLocalFrame** frame);
@@ -343,7 +333,6 @@ 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();
@@ -359,7 +348,6 @@ 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);
@@ -512,6 +500,7 @@ class PrintWebViewHelper
ScriptingThrottler scripting_throttler_;
bool print_node_in_progress_;
+ bool force_print_preview_;
PrintPreviewContext print_preview_context_;
bool is_loading_;
bool is_scripted_preview_delayed_;
diff --git printing/renderer/print_web_view_helper_mac.mm printing/renderer/print_web_view_helper_mac.mm
index e94f21e..e148860 100644
--- printing/renderer/print_web_view_helper_mac.mm
+++ printing/renderer/print_web_view_helper_mac.mm
@@ -69,7 +69,6 @@ void PrintWebViewHelper::PrintPageInternal(
Send(new PrintHostMsg_DidPrintPage(routing_id(), page_params));
}
-#if defined(ENABLE_PRINT_PREVIEW)
bool PrintWebViewHelper::RenderPreviewPage(
int page_number,
const PrintMsg_Print_Params& print_params) {
@@ -110,7 +109,6 @@ bool PrintWebViewHelper::RenderPreviewPage(
}
return PreviewPageRendered(page_number, draft_metafile.get());
}
-#endif // defined(ENABLE_PRINT_PREVIEW)
void PrintWebViewHelper::RenderPage(const PrintMsg_Print_Params& params,
int page_number,
@@ -145,14 +143,12 @@ void PrintWebViewHelper::RenderPage(const PrintMsg_Print_Params& params,
MetafileSkiaWrapper::SetMetafileOnCanvas(*canvas, metafile);
skia::SetIsPreviewMetafile(*canvas, is_preview);
-#if defined(ENABLE_PRINT_PREVIEW)
if (params.display_header_footer) {
PrintHeaderAndFooter(static_cast<blink::WebCanvas*>(canvas),
page_number + 1,
print_preview_context_.total_page_count(), *frame,
scale_factor, page_layout_in_points, params);
}
-#endif // defined(ENABLE_PRINT_PREVIEW)
RenderPageContent(frame, page_number, canvas_area, content_area,
scale_factor, static_cast<blink::WebCanvas*>(canvas));
}
diff --git resources/printing_resources.grdp resources/printing_resources.grdp
index 7213746..32b8b1e 100644
--- resources/printing_resources.grdp
+++ resources/printing_resources.grdp
@@ -1,6 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<grit-part>
- <if expr="enable_print_preview">
<include name="IDR_PRINT_PREVIEW_PAGE" file="../printing/resources/print_preview_page.html" flattenhtml="true" allowexternalscript="false" type="BINDATA" />
- </if>
</grit-part>