549 lines
22 KiB
Diff
549 lines
22 KiB
Diff
diff --git chrome/browser/ui/BUILD.gn chrome/browser/ui/BUILD.gn
|
|
index 30a33ab1cb73..1cbb401d639e 100644
|
|
--- chrome/browser/ui/BUILD.gn
|
|
+++ chrome/browser/ui/BUILD.gn
|
|
@@ -888,6 +888,7 @@ split_static_library("ui") {
|
|
"//base:i18n",
|
|
"//base/allocator:buildflags",
|
|
"//cc/paint",
|
|
+ "//cef/libcef/features",
|
|
"//chrome:extra_resources",
|
|
"//chrome:resources",
|
|
"//chrome:strings",
|
|
diff --git chrome/browser/ui/cocoa/applescript/tab_applescript.mm chrome/browser/ui/cocoa/applescript/tab_applescript.mm
|
|
index f0a489a0c3af..1bd1259e47e3 100644
|
|
--- chrome/browser/ui/cocoa/applescript/tab_applescript.mm
|
|
+++ chrome/browser/ui/cocoa/applescript/tab_applescript.mm
|
|
@@ -9,7 +9,7 @@
|
|
#include "base/logging.h"
|
|
#import "base/mac/scoped_nsobject.h"
|
|
#include "base/strings/sys_string_conversions.h"
|
|
-#include "chrome/browser/printing/print_view_manager.h"
|
|
+#include "cef/libcef/features/features.h"
|
|
#include "chrome/browser/profiles/profile.h"
|
|
#include "chrome/browser/sessions/session_tab_helper.h"
|
|
#include "chrome/browser/ui/cocoa/applescript/apple_event_util.h"
|
|
@@ -27,6 +27,10 @@
|
|
#include "content/public/browser/web_contents_delegate.h"
|
|
#include "url/gurl.h"
|
|
|
|
+#if !BUILDFLAG(ENABLE_CEF)
|
|
+#include "chrome/browser/printing/print_view_manager.h"
|
|
+#endif
|
|
+
|
|
using content::NavigationController;
|
|
using content::NavigationEntry;
|
|
using content::OpenURLParams;
|
|
@@ -233,11 +237,15 @@ void ResumeAppleEventAndSendReply(NSAppleEventManagerSuspensionID suspension_id,
|
|
|
|
- (void)handlesPrintScriptCommand:(NSScriptCommand*)command {
|
|
AppleScript::LogAppleScriptUMA(AppleScript::AppleScriptCommand::TAB_PRINT);
|
|
+#if !BUILDFLAG(ENABLE_CEF)
|
|
bool initiated = printing::PrintViewManager::FromWebContents(webContents_)
|
|
->PrintNow(webContents_->GetMainFrame());
|
|
if (!initiated) {
|
|
AppleScript::SetError(AppleScript::errInitiatePrinting);
|
|
}
|
|
+#else
|
|
+ NOTIMPLEMENTED();
|
|
+#endif
|
|
}
|
|
|
|
- (void)handlesSaveScriptCommand:(NSScriptCommand*)command {
|
|
diff --git chrome/browser/ui/webui/settings/printing_handler.cc chrome/browser/ui/webui/settings/printing_handler.cc
|
|
index 8647b2daf9ea..b070ab3e4b86 100644
|
|
--- chrome/browser/ui/webui/settings/printing_handler.cc
|
|
+++ chrome/browser/ui/webui/settings/printing_handler.cc
|
|
@@ -6,9 +6,13 @@
|
|
|
|
#include "base/bind.h"
|
|
#include "base/bind_helpers.h"
|
|
-#include "chrome/browser/printing/printer_manager_dialog.h"
|
|
+#include "cef/libcef/features/features.h"
|
|
#include "content/public/browser/web_ui.h"
|
|
|
|
+#if !BUILDFLAG(ENABLE_CEF)
|
|
+#include "chrome/browser/printing/printer_manager_dialog.h"
|
|
+#endif
|
|
+
|
|
namespace settings {
|
|
|
|
PrintingHandler::PrintingHandler() {}
|
|
@@ -27,7 +31,11 @@ void PrintingHandler::OnJavascriptAllowed() {}
|
|
void PrintingHandler::OnJavascriptDisallowed() {}
|
|
|
|
void PrintingHandler::HandleOpenSystemPrintDialog(const base::ListValue* args) {
|
|
+#if !BUILDFLAG(ENABLE_CEF)
|
|
printing::PrinterManagerDialog::ShowPrinterManagerDialog();
|
|
+#else
|
|
+ NOTIMPLEMENTED();
|
|
+#endif
|
|
}
|
|
|
|
} // namespace settings
|
|
diff --git chrome/common/chrome_utility_printing_messages.h chrome/common/chrome_utility_printing_messages.h
|
|
index f903429e25e4..cde2124fb18e 100644
|
|
--- chrome/common/chrome_utility_printing_messages.h
|
|
+++ chrome/common/chrome_utility_printing_messages.h
|
|
@@ -16,7 +16,7 @@
|
|
|
|
#define IPC_MESSAGE_START ChromeUtilityPrintingMsgStart
|
|
|
|
-#if defined(OS_WIN) && BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
|
+#if defined(OS_WIN)
|
|
// Preview and Cloud Print messages.
|
|
IPC_STRUCT_TRAITS_BEGIN(printing::PrinterCapsAndDefaults)
|
|
IPC_STRUCT_TRAITS_MEMBER(printer_capabilities)
|
|
@@ -94,6 +94,6 @@ IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_GetPrinterCapsAndDefaults_Failed,
|
|
IPC_MESSAGE_CONTROL1(
|
|
ChromeUtilityHostMsg_GetPrinterSemanticCapsAndDefaults_Failed,
|
|
std::string /* printer name */)
|
|
-#endif // defined(OS_WIN) && BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
|
+#endif // defined(OS_WIN)
|
|
|
|
#endif // CHROME_COMMON_CHROME_UTILITY_PRINTING_MESSAGES_H_
|
|
diff --git chrome/utility/printing_handler.h chrome/utility/printing_handler.h
|
|
index 006966fd1c58..db9cd49af2a4 100644
|
|
--- chrome/utility/printing_handler.h
|
|
+++ chrome/utility/printing_handler.h
|
|
@@ -11,7 +11,7 @@
|
|
#include "build/build_config.h"
|
|
#include "printing/buildflags/buildflags.h"
|
|
|
|
-#if !defined(OS_WIN) || !BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
|
+#if !defined(OS_WIN)
|
|
#error "Windows printing and print preview must be enabled"
|
|
#endif
|
|
|
|
diff --git components/printing/common/print_messages.cc components/printing/common/print_messages.cc
|
|
index c2eee7803d32..8b4ecb1db44f 100644
|
|
--- components/printing/common/print_messages.cc
|
|
+++ components/printing/common/print_messages.cc
|
|
@@ -140,7 +140,6 @@ PrintMsg_PrintFrame_Params::PrintMsg_PrintFrame_Params() {}
|
|
|
|
PrintMsg_PrintFrame_Params::~PrintMsg_PrintFrame_Params() {}
|
|
|
|
-#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
|
PrintHostMsg_RequestPrintPreview_Params::
|
|
PrintHostMsg_RequestPrintPreview_Params()
|
|
: is_modifiable(false),
|
|
@@ -170,4 +169,3 @@ PrintHostMsg_SetOptionsFromDocument_Params::
|
|
PrintHostMsg_SetOptionsFromDocument_Params::
|
|
~PrintHostMsg_SetOptionsFromDocument_Params() {
|
|
}
|
|
-#endif // BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
|
diff --git components/printing/common/print_messages.h components/printing/common/print_messages.h
|
|
index d85d26c7e79c..ecced6678eb5 100644
|
|
--- components/printing/common/print_messages.h
|
|
+++ components/printing/common/print_messages.h
|
|
@@ -86,7 +86,6 @@ struct PrintMsg_PrintFrame_Params {
|
|
int document_cookie;
|
|
};
|
|
|
|
-#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
|
struct PrintHostMsg_RequestPrintPreview_Params {
|
|
PrintHostMsg_RequestPrintPreview_Params();
|
|
~PrintHostMsg_RequestPrintPreview_Params();
|
|
@@ -113,7 +112,6 @@ struct PrintHostMsg_SetOptionsFromDocument_Params {
|
|
printing::DuplexMode duplex;
|
|
printing::PageRanges page_ranges;
|
|
};
|
|
-#endif // BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
|
|
|
#endif // INTERNAL_COMPONENTS_PRINTING_COMMON_PRINT_MESSAGES_H_
|
|
|
|
@@ -212,7 +210,6 @@ IPC_STRUCT_TRAITS_BEGIN(printing::PageRange)
|
|
IPC_STRUCT_TRAITS_MEMBER(to)
|
|
IPC_STRUCT_TRAITS_END()
|
|
|
|
-#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
|
IPC_STRUCT_TRAITS_BEGIN(PrintHostMsg_RequestPrintPreview_Params)
|
|
IPC_STRUCT_TRAITS_MEMBER(is_modifiable)
|
|
IPC_STRUCT_TRAITS_MEMBER(webnode_only)
|
|
@@ -238,7 +235,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 // BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
|
|
|
IPC_STRUCT_TRAITS_BEGIN(printing::PageSizeMargins)
|
|
IPC_STRUCT_TRAITS_MEMBER(content_width)
|
|
@@ -283,7 +279,6 @@ IPC_STRUCT_BEGIN(PrintHostMsg_DidPrintContent_Params)
|
|
IPC_STRUCT_MEMBER(printing::ContentToProxyIdMap, subframe_content_info)
|
|
IPC_STRUCT_END()
|
|
|
|
-#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
|
// Parameters to describe a rendered document.
|
|
IPC_STRUCT_BEGIN(PrintHostMsg_DidPreviewDocument_Params)
|
|
// Document's content including metafile data and subframe info.
|
|
@@ -319,7 +314,6 @@ IPC_STRUCT_BEGIN(PrintHostMsg_DidGetPreviewPageCount_Params)
|
|
// Scaling % to fit to page
|
|
IPC_STRUCT_MEMBER(int, fit_to_page_scaling)
|
|
IPC_STRUCT_END()
|
|
-#endif // BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
|
|
|
// Parameters to describe a rendered page.
|
|
IPC_STRUCT_BEGIN(PrintHostMsg_DidPrintDocument_Params)
|
|
@@ -355,20 +349,18 @@ IPC_STRUCT_END()
|
|
|
|
// Messages sent from the browser to the renderer.
|
|
|
|
-#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
|
// Tells the RenderFrame to initiate print preview for the entire document.
|
|
IPC_MESSAGE_ROUTED1(PrintMsg_InitiatePrintPreview, bool /* has_selection */)
|
|
-#endif
|
|
|
|
// Tells the RenderFrame to initiate printing or print preview for a particular
|
|
// node, depending on which mode the RenderFrame is in.
|
|
IPC_MESSAGE_ROUTED0(PrintMsg_PrintNodeUnderContextMenu)
|
|
|
|
-#if BUILDFLAG(ENABLE_PRINTING)
|
|
// Tells the RenderFrame to switch the CSS to print media type, renders every
|
|
// requested pages and switch back the CSS to display media type.
|
|
IPC_MESSAGE_ROUTED0(PrintMsg_PrintPages)
|
|
|
|
+#if BUILDFLAG(ENABLE_PRINTING)
|
|
// Like PrintMsg_PrintPages, but using the print preview document's frame/node.
|
|
IPC_MESSAGE_ROUTED0(PrintMsg_PrintForSystemDialog)
|
|
#endif
|
|
@@ -383,13 +375,13 @@ IPC_MESSAGE_ROUTED1(PrintMsg_PrintingDone,
|
|
// Tells the RenderFrame whether printing is enabled or not.
|
|
IPC_MESSAGE_ROUTED1(PrintMsg_SetPrintingEnabled, bool /* enabled */)
|
|
|
|
-#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
|
// Tells the RenderFrame 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 */)
|
|
|
|
+#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
|
// Tells the RenderFrame that print preview dialog was closed.
|
|
IPC_MESSAGE_ROUTED0(PrintMsg_ClosePrintPreviewDialog)
|
|
#endif
|
|
@@ -455,7 +447,6 @@ IPC_MESSAGE_CONTROL3(PrintHostMsg_TempFileForPrintingWritten,
|
|
int /* page count */)
|
|
#endif // defined(OS_ANDROID)
|
|
|
|
-#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
|
// Asks the browser to do print preview.
|
|
IPC_MESSAGE_ROUTED1(PrintHostMsg_RequestPrintPreview,
|
|
PrintHostMsg_RequestPrintPreview_Params /* params */)
|
|
@@ -492,7 +483,6 @@ IPC_SYNC_MESSAGE_ROUTED1_1(PrintHostMsg_CheckForCancel,
|
|
IPC_MESSAGE_ROUTED2(PrintHostMsg_MetafileReadyForPrinting,
|
|
PrintHostMsg_DidPreviewDocument_Params /* params */,
|
|
PrintHostMsg_PreviewIds /* ids */)
|
|
-#endif // BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
|
|
|
// This is sent when there are invalid printer settings.
|
|
IPC_MESSAGE_ROUTED0(PrintHostMsg_ShowInvalidPrinterSettingsError)
|
|
@@ -501,7 +491,6 @@ IPC_MESSAGE_ROUTED0(PrintHostMsg_ShowInvalidPrinterSettingsError)
|
|
IPC_MESSAGE_ROUTED1(PrintHostMsg_PrintingFailed,
|
|
int /* document cookie */)
|
|
|
|
-#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
|
// Tell the browser print preview failed.
|
|
IPC_MESSAGE_ROUTED2(PrintHostMsg_PrintPreviewFailed,
|
|
int /* document cookie */,
|
|
@@ -532,6 +521,5 @@ IPC_MESSAGE_ROUTED1(PrintHostMsg_ShowScriptedPrintPreview,
|
|
IPC_MESSAGE_ROUTED2(PrintHostMsg_SetOptionsFromDocument,
|
|
PrintHostMsg_SetOptionsFromDocument_Params /* params */,
|
|
PrintHostMsg_PreviewIds /* ids */)
|
|
-#endif // BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
|
|
|
#endif // COMPONENTS_PRINTING_COMMON_PRINT_MESSAGES_H_
|
|
diff --git components/printing/renderer/print_render_frame_helper.cc components/printing/renderer/print_render_frame_helper.cc
|
|
index d1f6630b05c6..66a9e8a04627 100644
|
|
--- components/printing/renderer/print_render_frame_helper.cc
|
|
+++ components/printing/renderer/print_render_frame_helper.cc
|
|
@@ -340,7 +340,6 @@ bool PrintingNodeOrPdfFrame(const blink::WebLocalFrame* frame,
|
|
return plugin && plugin->SupportsPaginatedPrint();
|
|
}
|
|
|
|
-#if BUILDFLAG(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;
|
|
@@ -362,7 +361,6 @@ bool PrintingFrameHasPageSizeStyle(blink::WebLocalFrame* frame,
|
|
}
|
|
return frame_has_custom_page_size_style;
|
|
}
|
|
-#endif // BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
|
|
|
#if BUILDFLAG(ENABLE_PRINTING)
|
|
// Disable scaling when either:
|
|
@@ -417,7 +415,6 @@ MarginType GetMarginsForPdf(blink::WebLocalFrame* frame,
|
|
: PRINTABLE_AREA_MARGINS;
|
|
}
|
|
|
|
-#if BUILDFLAG(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)) {
|
|
@@ -459,7 +456,6 @@ blink::WebPrintScalingOption GetPrintScalingOption(
|
|
}
|
|
return blink::kWebPrintScalingOptionFitToPrintableArea;
|
|
}
|
|
-#endif // BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
|
|
|
// Helper function to scale and round an integer value with a double valued
|
|
// scaling.
|
|
@@ -970,6 +966,7 @@ PrintRenderFrameHelper::PrintRenderFrameHelper(
|
|
notify_browser_of_print_failure_(true),
|
|
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),
|
|
@@ -1031,10 +1028,8 @@ void PrintRenderFrameHelper::ScriptedPrint(bool user_initiated) {
|
|
return;
|
|
|
|
if (g_is_preview_enabled) {
|
|
-#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
|
print_preview_context_.InitWithFrame(web_frame);
|
|
RequestPrintPreview(PRINT_PREVIEW_SCRIPTED);
|
|
-#endif
|
|
} else {
|
|
auto weak_this = weak_ptr_factory_.GetWeakPtr();
|
|
web_frame->DispatchBeforePrintEvent();
|
|
@@ -1062,10 +1057,10 @@ bool PrintRenderFrameHelper::OnMessageReceived(const IPC::Message& message) {
|
|
IPC_BEGIN_MESSAGE_MAP(PrintRenderFrameHelper, message)
|
|
IPC_MESSAGE_HANDLER(PrintMsg_PrintPages, OnPrintPages)
|
|
IPC_MESSAGE_HANDLER(PrintMsg_PrintForSystemDialog, OnPrintForSystemDialog)
|
|
-#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
|
IPC_MESSAGE_HANDLER(PrintMsg_InitiatePrintPreview, OnInitiatePrintPreview)
|
|
IPC_MESSAGE_HANDLER(PrintMsg_PrintPreview, OnPrintPreview)
|
|
IPC_MESSAGE_HANDLER(PrintMsg_PrintingDone, OnPrintingDone)
|
|
+#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
|
IPC_MESSAGE_HANDLER(PrintMsg_ClosePrintPreviewDialog,
|
|
OnClosePrintPreviewDialog)
|
|
#endif // BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
|
@@ -1147,7 +1142,6 @@ void PrintRenderFrameHelper::UpdateFrameMarginsCssInfo(
|
|
ignore_css_margins_ = (margins_type != DEFAULT_MARGINS);
|
|
}
|
|
|
|
-#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
|
void PrintRenderFrameHelper::OnPrintPreview(
|
|
const base::DictionaryValue& settings) {
|
|
if (ipc_nesting_level_ > 1)
|
|
@@ -1396,7 +1390,6 @@ bool PrintRenderFrameHelper::FinalizePrintReadyDocument() {
|
|
ids));
|
|
return true;
|
|
}
|
|
-#endif // BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
|
|
|
void PrintRenderFrameHelper::OnPrintingDone(bool success) {
|
|
if (ipc_nesting_level_ > 1)
|
|
@@ -1411,7 +1404,6 @@ void PrintRenderFrameHelper::OnSetPrintingEnabled(bool enabled) {
|
|
is_printing_enabled_ = enabled;
|
|
}
|
|
|
|
-#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
|
void PrintRenderFrameHelper::OnInitiatePrintPreview(bool has_selection) {
|
|
if (ipc_nesting_level_ > 1)
|
|
return;
|
|
@@ -1422,7 +1414,9 @@ void PrintRenderFrameHelper::OnInitiatePrintPreview(bool has_selection) {
|
|
// 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);
|
|
@@ -1431,6 +1425,7 @@ void PrintRenderFrameHelper::OnInitiatePrintPreview(bool has_selection) {
|
|
: PRINT_PREVIEW_USER_INITIATED_ENTIRE_FRAME);
|
|
}
|
|
|
|
+#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
|
void PrintRenderFrameHelper::OnClosePrintPreviewDialog() {
|
|
print_preview_context_.source_frame()->DispatchAfterPrintEvent();
|
|
}
|
|
@@ -1518,11 +1513,9 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) {
|
|
|
|
print_node_in_progress_ = true;
|
|
|
|
- if (g_is_preview_enabled) {
|
|
-#if BUILDFLAG(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 {
|
|
// Make a copy of the node, in case RenderView::OnContextMenuClosed() resets
|
|
// its |context_menu_node_|.
|
|
@@ -1598,13 +1591,11 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame,
|
|
void PrintRenderFrameHelper::DidFinishPrinting(PrintingResult result) {
|
|
int cookie =
|
|
print_pages_params_ ? print_pages_params_->params.document_cookie : 0;
|
|
-#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
|
PrintHostMsg_PreviewIds ids;
|
|
if (print_pages_params_) {
|
|
ids.ui_id = print_pages_params_->params.preview_ui_id;
|
|
ids.request_id = print_pages_params_->params.preview_request_id;
|
|
}
|
|
-#endif // BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
|
switch (result) {
|
|
case OK:
|
|
break;
|
|
@@ -1619,7 +1610,6 @@ void PrintRenderFrameHelper::DidFinishPrinting(PrintingResult result) {
|
|
}
|
|
break;
|
|
|
|
-#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
|
case FAIL_PREVIEW:
|
|
if (!is_print_ready_metafile_sent_) {
|
|
if (notify_browser_of_print_failure_) {
|
|
@@ -1637,7 +1627,6 @@ void PrintRenderFrameHelper::DidFinishPrinting(PrintingResult result) {
|
|
cookie, ids));
|
|
print_preview_context_.Failed(false);
|
|
break;
|
|
-#endif // BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
|
}
|
|
prep_frame_view_.reset();
|
|
print_pages_params_.reset();
|
|
@@ -1809,7 +1798,6 @@ bool PrintRenderFrameHelper::CalculateNumberOfPages(blink::WebLocalFrame* frame,
|
|
return true;
|
|
}
|
|
|
|
-#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
|
bool PrintRenderFrameHelper::SetOptionsFromPdfDocument(
|
|
PrintHostMsg_SetOptionsFromDocument_Params* options) {
|
|
blink::WebLocalFrame* source_frame = print_preview_context_.source_frame();
|
|
@@ -1903,7 +1891,6 @@ bool PrintRenderFrameHelper::UpdatePrintSettings(
|
|
print_preview_context_.set_error(PREVIEW_ERROR_INVALID_PRINTER_SETTINGS);
|
|
return false;
|
|
}
|
|
-#endif // BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
|
|
|
void PrintRenderFrameHelper::GetPrintSettingsFromUser(
|
|
blink::WebLocalFrame* frame,
|
|
@@ -2060,7 +2047,6 @@ bool PrintRenderFrameHelper::CopyMetafileDataToReadOnlySharedMem(
|
|
return true;
|
|
}
|
|
|
|
-#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
|
void PrintRenderFrameHelper::ShowScriptedPrintPreview() {
|
|
if (is_scripted_preview_delayed_) {
|
|
is_scripted_preview_delayed_ = false;
|
|
@@ -2186,7 +2172,6 @@ bool PrintRenderFrameHelper::PreviewPageRendered(
|
|
Send(new PrintHostMsg_DidPreviewPage(routing_id(), preview_page_params, ids));
|
|
return true;
|
|
}
|
|
-#endif // BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
|
|
|
PrintRenderFrameHelper::PrintPreviewContext::PrintPreviewContext()
|
|
: total_page_count_(0),
|
|
diff --git components/printing/renderer/print_render_frame_helper.h components/printing/renderer/print_render_frame_helper.h
|
|
index 46da03048dfb..c6b185b951fc 100644
|
|
--- components/printing/renderer/print_render_frame_helper.h
|
|
+++ components/printing/renderer/print_render_frame_helper.h
|
|
@@ -149,10 +149,8 @@ class PrintRenderFrameHelper
|
|
OK,
|
|
FAIL_PRINT_INIT,
|
|
FAIL_PRINT,
|
|
-#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
|
FAIL_PREVIEW,
|
|
INVALID_SETTINGS,
|
|
-#endif
|
|
};
|
|
|
|
// These values are persisted to logs. Entries should not be renumbered and
|
|
@@ -188,9 +186,9 @@ class PrintRenderFrameHelper
|
|
// Message handlers ---------------------------------------------------------
|
|
void OnPrintPages();
|
|
void OnPrintForSystemDialog();
|
|
-#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
|
void OnInitiatePrintPreview(bool has_selection);
|
|
void OnPrintPreview(const base::DictionaryValue& settings);
|
|
+#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
|
void OnClosePrintPreviewDialog();
|
|
#endif // BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
|
void OnPrintFrameContent(const PrintMsg_PrintFrame_Params& params);
|
|
@@ -206,7 +204,6 @@ class PrintRenderFrameHelper
|
|
// Update |ignore_css_margins_| based on settings.
|
|
void UpdateFrameMarginsCssInfo(const base::DictionaryValue& settings);
|
|
|
|
-#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
|
// Prepare frame for creating preview document.
|
|
void PrepareFrameForPreviewDocument();
|
|
|
|
@@ -223,7 +220,6 @@ class PrintRenderFrameHelper
|
|
|
|
// Finalize the print ready preview document.
|
|
bool FinalizePrintReadyDocument();
|
|
-#endif // BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
|
|
|
// Enable/Disable printing.
|
|
void OnSetPrintingEnabled(bool enabled);
|
|
@@ -251,7 +247,6 @@ class PrintRenderFrameHelper
|
|
const blink::WebNode& node,
|
|
int* number_of_pages);
|
|
|
|
-#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
|
// Set options for print preset from source PDF document.
|
|
bool SetOptionsFromPdfDocument(
|
|
PrintHostMsg_SetOptionsFromDocument_Params* options);
|
|
@@ -262,7 +257,6 @@ class PrintRenderFrameHelper
|
|
bool UpdatePrintSettings(blink::WebLocalFrame* frame,
|
|
const blink::WebNode& node,
|
|
const base::DictionaryValue& passed_job_settings);
|
|
-#endif // BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
|
|
|
// Get final print settings from the user.
|
|
// WARNING: |this| may be gone after this method returns.
|
|
@@ -347,7 +341,6 @@ class PrintRenderFrameHelper
|
|
bool IsScriptInitiatedPrintAllowed(blink::WebLocalFrame* frame,
|
|
bool user_initiated);
|
|
|
|
-#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
|
// Shows scripted print preview when options from plugin are available.
|
|
void ShowScriptedPrintPreview();
|
|
|
|
@@ -366,7 +359,6 @@ class PrintRenderFrameHelper
|
|
// Returns true if print preview should continue, false on failure.
|
|
bool PreviewPageRendered(int page_number,
|
|
std::unique_ptr<PdfMetafileSkia> metafile);
|
|
-#endif // BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
|
|
|
void SetPrintPagesParams(const PrintMsg_PrintPages_Params& settings);
|
|
|
|
@@ -520,6 +512,7 @@ class PrintRenderFrameHelper
|
|
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 components/printing_component_strings.grdp components/printing_component_strings.grdp
|
|
index f157cbaec42e..5e3c3caa2aa2 100644
|
|
--- components/printing_component_strings.grdp
|
|
+++ components/printing_component_strings.grdp
|
|
@@ -1,10 +1,8 @@
|
|
<?xml version="1.0" encoding="utf-8"?>
|
|
<grit-part>
|
|
- <if expr="enable_print_preview">
|
|
<if expr="is_win">
|
|
<message name="IDS_PRINT_PREVIEW_FRIENDLY_WIN_NETWORK_PRINTER_NAME" desc="Friendly name for a printer with a given name on a given server. This uses the same format as the Windows print dialog.">
|
|
<ph name="PRINTER_NAME">$1<ex>HP LaserJet</ex></ph> on <ph name="SERVER_NAME">$2<ex>printserver</ex></ph>
|
|
</message>
|
|
</if>
|
|
- </if>
|
|
</grit-part>
|
|
diff --git components/pwg_encoder/BUILD.gn components/pwg_encoder/BUILD.gn
|
|
index 96ae254116a9..3697d6034300 100644
|
|
--- components/pwg_encoder/BUILD.gn
|
|
+++ components/pwg_encoder/BUILD.gn
|
|
@@ -4,8 +4,6 @@
|
|
|
|
import("//printing/buildflags/buildflags.gni")
|
|
|
|
-assert(enable_print_preview)
|
|
-
|
|
static_library("pwg_encoder") {
|
|
sources = [
|
|
"bitmap_image.cc",
|