|
@@ -1,7 +1,7 @@
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
From: Shelley Vohr <[email protected]>
|
|
|
Date: Fri, 7 Jun 2019 13:59:37 -0700
|
|
|
-Subject: fix: printing
|
|
|
+Subject: printing.patch
|
|
|
|
|
|
Add changeset that was previously applied to sources in chromium_src. The
|
|
|
majority of changes originally come from these PRs:
|
|
@@ -11,7 +11,7 @@ majority of changes originally come from these PRs:
|
|
|
This patch also fixes callback for manual user cancellation and success.
|
|
|
|
|
|
diff --git a/chrome/browser/printing/print_job_worker.cc b/chrome/browser/printing/print_job_worker.cc
|
|
|
-index 63f432b58371cfa0f8079fa78a51c8865a00c183..d20d803f55ca67fb6993facc69c3431767786053 100644
|
|
|
+index 13f9d7af3ae796ecec3a9189aa59f4b20171fd7a..9c35b294340cce070a9f428dac6aa587c93ccc6c 100644
|
|
|
--- a/chrome/browser/printing/print_job_worker.cc
|
|
|
+++ b/chrome/browser/printing/print_job_worker.cc
|
|
|
@@ -21,12 +21,12 @@
|
|
@@ -28,7 +28,7 @@ index 63f432b58371cfa0f8079fa78a51c8865a00c183..d20d803f55ca67fb6993facc69c34317
|
|
|
#include "printing/print_job_constants.h"
|
|
|
#include "printing/printed_document.h"
|
|
|
#include "printing/printing_utils.h"
|
|
|
-@@ -206,9 +206,14 @@ void PrintJobWorker::SetSettingsFromPOD(
|
|
|
+@@ -203,9 +203,14 @@ void PrintJobWorker::SetSettingsFromPOD(
|
|
|
void PrintJobWorker::UpdatePrintSettings(base::Value new_settings,
|
|
|
SettingsCallback callback) {
|
|
|
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
|
@@ -46,7 +46,7 @@ index 63f432b58371cfa0f8079fa78a51c8865a00c183..d20d803f55ca67fb6993facc69c34317
|
|
|
}
|
|
|
|
|
|
#if defined(OS_CHROMEOS)
|
|
|
-@@ -224,6 +229,13 @@ void PrintJobWorker::UpdatePrintSettingsFromPOD(
|
|
|
+@@ -221,6 +226,13 @@ void PrintJobWorker::UpdatePrintSettingsFromPOD(
|
|
|
|
|
|
void PrintJobWorker::GetSettingsDone(SettingsCallback callback,
|
|
|
PrintingContext::Result result) {
|
|
@@ -57,11 +57,11 @@ index 63f432b58371cfa0f8079fa78a51c8865a00c183..d20d803f55ca67fb6993facc69c34317
|
|
|
+ JobEventDetails::USER_INIT_CANCELED, 0,
|
|
|
+ base::RetainedRef(document_)));
|
|
|
+ }
|
|
|
- std::move(callback).Run(printing_context_->settings(), result);
|
|
|
+ std::move(callback).Run(printing_context_->TakeAndResetSettings(), result);
|
|
|
}
|
|
|
|
|
|
diff --git a/chrome/browser/printing/print_view_manager_base.cc b/chrome/browser/printing/print_view_manager_base.cc
|
|
|
-index c4e0992f6265b34659514ef5f15eb8d78645161c..1aca2f88da5d8e96a0f16a667a8a86a7873dfdf9 100644
|
|
|
+index da3383624ff83c20fd94578a80e94d00689bfefc..fcf7264c590f72b26cbcea328cc1f0e718a8c791 100644
|
|
|
--- a/chrome/browser/printing/print_view_manager_base.cc
|
|
|
+++ b/chrome/browser/printing/print_view_manager_base.cc
|
|
|
@@ -27,10 +27,7 @@
|
|
@@ -133,7 +133,7 @@ index c4e0992f6265b34659514ef5f15eb8d78645161c..1aca2f88da5d8e96a0f16a667a8a86a7
|
|
|
}
|
|
|
|
|
|
#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
|
|
-@@ -244,9 +249,9 @@ void PrintViewManagerBase::StartLocalPrintJob(
|
|
|
+@@ -242,9 +247,9 @@ void PrintViewManagerBase::StartLocalPrintJob(
|
|
|
void PrintViewManagerBase::UpdatePrintingEnabled() {
|
|
|
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
|
|
// The Unretained() is safe because ForEachFrame() is synchronous.
|
|
@@ -146,7 +146,7 @@ index c4e0992f6265b34659514ef5f15eb8d78645161c..1aca2f88da5d8e96a0f16a667a8a86a7
|
|
|
}
|
|
|
|
|
|
void PrintViewManagerBase::NavigationStopped() {
|
|
|
-@@ -338,7 +343,7 @@ void PrintViewManagerBase::OnPrintingFailed(int cookie) {
|
|
|
+@@ -347,7 +352,7 @@ void PrintViewManagerBase::OnPrintingFailed(int cookie) {
|
|
|
PrintManager::OnPrintingFailed(cookie);
|
|
|
|
|
|
#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
|
@@ -155,7 +155,7 @@ index c4e0992f6265b34659514ef5f15eb8d78645161c..1aca2f88da5d8e96a0f16a667a8a86a7
|
|
|
#endif
|
|
|
|
|
|
ReleasePrinterQuery();
|
|
|
-@@ -438,9 +443,13 @@ void PrintViewManagerBase::OnNotifyPrintJobEvent(
|
|
|
+@@ -445,9 +450,13 @@ void PrintViewManagerBase::OnNotifyPrintJobEvent(
|
|
|
content::NotificationService::NoDetails());
|
|
|
break;
|
|
|
}
|
|
@@ -171,7 +171,7 @@ index c4e0992f6265b34659514ef5f15eb8d78645161c..1aca2f88da5d8e96a0f16a667a8a86a7
|
|
|
NOTREACHED();
|
|
|
break;
|
|
|
}
|
|
|
-@@ -535,8 +544,6 @@ bool PrintViewManagerBase::CreateNewPrintJob(
|
|
|
+@@ -542,8 +551,6 @@ bool PrintViewManagerBase::CreateNewPrintJob(
|
|
|
DCHECK(!quit_inner_loop_);
|
|
|
DCHECK(query);
|
|
|
|
|
@@ -180,16 +180,17 @@ index c4e0992f6265b34659514ef5f15eb8d78645161c..1aca2f88da5d8e96a0f16a667a8a86a7
|
|
|
|
|
|
// We can't print if there is no renderer.
|
|
|
if (!web_contents()->GetRenderViewHost() ||
|
|
|
-@@ -547,8 +554,6 @@ bool PrintViewManagerBase::CreateNewPrintJob(
|
|
|
- DCHECK(!print_job_);
|
|
|
- print_job_ = base::MakeRefCounted<PrintJob>();
|
|
|
- print_job_->Initialize(std::move(query), RenderSourceName(), number_pages_);
|
|
|
+@@ -557,9 +564,6 @@ bool PrintViewManagerBase::CreateNewPrintJob(
|
|
|
+ #if defined(OS_CHROMEOS)
|
|
|
+ print_job_->SetSource(PrintJob::Source::PRINT_PREVIEW, /*source_id=*/"");
|
|
|
+ #endif // defined(OS_CHROMEOS)
|
|
|
+-
|
|
|
- registrar_.Add(this, chrome::NOTIFICATION_PRINT_JOB_EVENT,
|
|
|
- content::Source<PrintJob>(print_job_.get()));
|
|
|
printing_succeeded_ = false;
|
|
|
return true;
|
|
|
}
|
|
|
-@@ -597,6 +602,13 @@ void PrintViewManagerBase::ReleasePrintJob() {
|
|
|
+@@ -608,6 +612,13 @@ void PrintViewManagerBase::ReleasePrintJob() {
|
|
|
content::RenderFrameHost* rfh = printing_rfh_;
|
|
|
printing_rfh_ = nullptr;
|
|
|
|
|
@@ -203,7 +204,7 @@ index c4e0992f6265b34659514ef5f15eb8d78645161c..1aca2f88da5d8e96a0f16a667a8a86a7
|
|
|
if (!print_job_)
|
|
|
return;
|
|
|
|
|
|
-@@ -606,8 +618,9 @@ void PrintViewManagerBase::ReleasePrintJob() {
|
|
|
+@@ -617,8 +628,9 @@ void PrintViewManagerBase::ReleasePrintJob() {
|
|
|
rfh->Send(msg.release());
|
|
|
}
|
|
|
|
|
@@ -215,7 +216,7 @@ index c4e0992f6265b34659514ef5f15eb8d78645161c..1aca2f88da5d8e96a0f16a667a8a86a7
|
|
|
// Don't close the worker thread.
|
|
|
print_job_ = nullptr;
|
|
|
}
|
|
|
-@@ -677,6 +690,9 @@ bool PrintViewManagerBase::PrintNowInternal(
|
|
|
+@@ -688,6 +700,9 @@ bool PrintViewManagerBase::PrintNowInternal(
|
|
|
// Don't print / print preview interstitials or crashed tabs.
|
|
|
if (web_contents()->ShowingInterstitialPage() || web_contents()->IsCrashed())
|
|
|
return false;
|
|
@@ -226,10 +227,10 @@ index c4e0992f6265b34659514ef5f15eb8d78645161c..1aca2f88da5d8e96a0f16a667a8a86a7
|
|
|
}
|
|
|
|
|
|
diff --git a/chrome/browser/printing/print_view_manager_base.h b/chrome/browser/printing/print_view_manager_base.h
|
|
|
-index 925736d379c34ac7ddc07032305d24e1ae65e4b3..a8b2b31ec8bcb04d83df368b12d124dcdbb8b55d 100644
|
|
|
+index 9dc22fa933edc33017e4b1491f710c45c111ad19..3a4f7ee98c5a611a27ae1126d6b7d67f11b8530e 100644
|
|
|
--- a/chrome/browser/printing/print_view_manager_base.h
|
|
|
+++ b/chrome/browser/printing/print_view_manager_base.h
|
|
|
-@@ -39,6 +39,8 @@ class PrintJob;
|
|
|
+@@ -33,6 +33,8 @@ class PrintJob;
|
|
|
class PrintQueriesQueue;
|
|
|
class PrinterQuery;
|
|
|
|
|
@@ -238,7 +239,7 @@ index 925736d379c34ac7ddc07032305d24e1ae65e4b3..a8b2b31ec8bcb04d83df368b12d124dc
|
|
|
// Base class for managing the print commands for a WebContents.
|
|
|
class PrintViewManagerBase : public content::NotificationObserver,
|
|
|
public PrintManager {
|
|
|
-@@ -48,7 +50,9 @@ class PrintViewManagerBase : public content::NotificationObserver,
|
|
|
+@@ -42,7 +44,9 @@ class PrintViewManagerBase : public content::NotificationObserver,
|
|
|
// Prints the current document immediately. Since the rendering is
|
|
|
// asynchronous, the actual printing will not be completed on the return of
|
|
|
// this function. Returns false if printing is impossible at the moment.
|
|
@@ -249,7 +250,7 @@ index 925736d379c34ac7ddc07032305d24e1ae65e4b3..a8b2b31ec8bcb04d83df368b12d124dc
|
|
|
|
|
|
#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
|
|
// Prints the document in |print_data| with settings specified in
|
|
|
-@@ -195,9 +199,15 @@ class PrintViewManagerBase : public content::NotificationObserver,
|
|
|
+@@ -202,9 +206,15 @@ class PrintViewManagerBase : public content::NotificationObserver,
|
|
|
// The current RFH that is printing with a system printing dialog.
|
|
|
content::RenderFrameHost* printing_rfh_;
|
|
|
|
|
@@ -266,10 +267,10 @@ index 925736d379c34ac7ddc07032305d24e1ae65e4b3..a8b2b31ec8bcb04d83df368b12d124dc
|
|
|
// This means we are _blocking_ until all the necessary pages have been
|
|
|
// rendered or the print settings are being loaded.
|
|
|
diff --git a/chrome/browser/printing/printing_message_filter.cc b/chrome/browser/printing/printing_message_filter.cc
|
|
|
-index 706617b7924cfbf25e4f3a04a40d9ee977e6fd69..92b46562ef36bbfe874d39d706ab589d98f37cda 100644
|
|
|
+index 40762a36024bc48dfe5259520161dc203197bfd0..e38aa442df858ce362645230f7642b2eb48262ce 100644
|
|
|
--- a/chrome/browser/printing/printing_message_filter.cc
|
|
|
+++ b/chrome/browser/printing/printing_message_filter.cc
|
|
|
-@@ -21,6 +21,7 @@
|
|
|
+@@ -22,6 +22,7 @@
|
|
|
#include "components/keyed_service/content/browser_context_keyed_service_shutdown_notifier_factory.h"
|
|
|
#include "components/printing/browser/print_manager_utils.h"
|
|
|
#include "components/printing/common/print_messages.h"
|
|
@@ -277,7 +278,7 @@ index 706617b7924cfbf25e4f3a04a40d9ee977e6fd69..92b46562ef36bbfe874d39d706ab589d
|
|
|
#include "content/public/browser/browser_task_traits.h"
|
|
|
#include "content/public/browser/render_frame_host.h"
|
|
|
#include "content/public/browser/web_contents.h"
|
|
|
-@@ -89,20 +90,23 @@ void PrintingMessageFilter::SetDelegateForTesting(TestDelegate* delegate) {
|
|
|
+@@ -90,20 +91,23 @@ void PrintingMessageFilter::SetDelegateForTesting(TestDelegate* delegate) {
|
|
|
g_test_delegate = delegate;
|
|
|
}
|
|
|
|
|
@@ -299,12 +300,12 @@ index 706617b7924cfbf25e4f3a04a40d9ee977e6fd69..92b46562ef36bbfe874d39d706ab589d
|
|
|
+ #if 0
|
|
|
is_printing_enabled_.Init(prefs::kPrintingEnabled, profile->GetPrefs());
|
|
|
is_printing_enabled_.MoveToSequence(
|
|
|
- base::CreateSingleThreadTaskRunnerWithTraits({BrowserThread::IO}));
|
|
|
+ base::CreateSingleThreadTaskRunner({BrowserThread::IO}));
|
|
|
+ #endif
|
|
|
}
|
|
|
|
|
|
PrintingMessageFilter::~PrintingMessageFilter() {
|
|
|
-@@ -137,11 +141,13 @@ bool PrintingMessageFilter::OnMessageReceived(const IPC::Message& message) {
|
|
|
+@@ -138,11 +142,13 @@ bool PrintingMessageFilter::OnMessageReceived(const IPC::Message& message) {
|
|
|
|
|
|
void PrintingMessageFilter::OnGetDefaultPrintSettings(IPC::Message* reply_msg) {
|
|
|
DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
|
@@ -318,7 +319,7 @@ index 706617b7924cfbf25e4f3a04a40d9ee977e6fd69..92b46562ef36bbfe874d39d706ab589d
|
|
|
std::unique_ptr<PrinterQuery> printer_query = queue_->PopPrinterQuery(0);
|
|
|
if (!printer_query) {
|
|
|
printer_query =
|
|
|
-@@ -227,11 +233,13 @@ void PrintingMessageFilter::OnScriptedPrintReply(
|
|
|
+@@ -228,11 +234,13 @@ void PrintingMessageFilter::OnScriptedPrintReply(
|
|
|
void PrintingMessageFilter::OnUpdatePrintSettings(int document_cookie,
|
|
|
base::Value job_settings,
|
|
|
IPC::Message* reply_msg) {
|
|
@@ -332,7 +333,7 @@ index 706617b7924cfbf25e4f3a04a40d9ee977e6fd69..92b46562ef36bbfe874d39d706ab589d
|
|
|
std::unique_ptr<PrinterQuery> printer_query =
|
|
|
queue_->PopPrinterQuery(document_cookie);
|
|
|
if (!printer_query) {
|
|
|
-@@ -257,7 +265,9 @@ void PrintingMessageFilter::OnUpdatePrintSettingsReply(
|
|
|
+@@ -258,7 +266,9 @@ void PrintingMessageFilter::OnUpdatePrintSettingsReply(
|
|
|
std::unique_ptr<PrinterQuery> printer_query,
|
|
|
IPC::Message* reply_msg) {
|
|
|
PrintMsg_PrintPages_Params params;
|
|
@@ -343,7 +344,7 @@ index 706617b7924cfbf25e4f3a04a40d9ee977e6fd69..92b46562ef36bbfe874d39d706ab589d
|
|
|
params.Reset();
|
|
|
} else {
|
|
|
RenderParamsFromPrintSettings(printer_query->settings(), ¶ms.params);
|
|
|
-@@ -295,7 +305,7 @@ void PrintingMessageFilter::OnUpdatePrintSettingsReply(
|
|
|
+@@ -296,7 +306,7 @@ void PrintingMessageFilter::OnUpdatePrintSettingsReply(
|
|
|
#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
|
|
void PrintingMessageFilter::OnCheckForCancel(const PrintHostMsg_PreviewIds& ids,
|
|
|
bool* cancel) {
|
|
@@ -378,7 +379,7 @@ index 9fbea6d0a2dbe55b1d600fbc217dee5aa8ae8cd5..de9bd267e408c02fd4da7d903523c0e6
|
|
|
// content::BrowserMessageFilter:
|
|
|
bool OnMessageReceived(const IPC::Message& message) override;
|
|
|
diff --git a/components/printing/common/print_messages.h b/components/printing/common/print_messages.h
|
|
|
-index 1802034a6e15a6ad8b0d9591cfb79ba5873dc982..331ac71d925c056d3b7577123251514c35f30fde 100644
|
|
|
+index a134a000bd3ccb229a26b3e2cb3425f91a85618e..fd768d372ac15be9b0553fd7d98ce5e27ed19f5a 100644
|
|
|
--- a/components/printing/common/print_messages.h
|
|
|
+++ b/components/printing/common/print_messages.h
|
|
|
@@ -368,7 +368,9 @@ IPC_MESSAGE_ROUTED0(PrintMsg_PrintNodeUnderContextMenu)
|
|
@@ -393,7 +394,7 @@ index 1802034a6e15a6ad8b0d9591cfb79ba5873dc982..331ac71d925c056d3b7577123251514c
|
|
|
// Like PrintMsg_PrintPages, but using the print preview document's frame/node.
|
|
|
IPC_MESSAGE_ROUTED0(PrintMsg_PrintForSystemDialog)
|
|
|
diff --git a/components/printing/renderer/print_render_frame_helper.cc b/components/printing/renderer/print_render_frame_helper.cc
|
|
|
-index ef580254bd8feba84ac02924b77b9b4feaf14d96..3cdaf40b6e5aeee7193a49a31f824c914d07648e 100644
|
|
|
+index 4ab51f37a2f0739d355760b9cf6b3afeee6e2c8e..0f31d964e11e08dd7a1bf33302ed708eeea0a4aa 100644
|
|
|
--- a/components/printing/renderer/print_render_frame_helper.cc
|
|
|
+++ b/components/printing/renderer/print_render_frame_helper.cc
|
|
|
@@ -37,6 +37,7 @@
|
|
@@ -404,7 +405,7 @@ index ef580254bd8feba84ac02924b77b9b4feaf14d96..3cdaf40b6e5aeee7193a49a31f824c91
|
|
|
#include "printing/units.h"
|
|
|
#include "third_party/blink/public/common/frame/frame_owner_element_type.h"
|
|
|
#include "third_party/blink/public/common/frame/sandbox_flags.h"
|
|
|
-@@ -1116,7 +1117,8 @@ void PrintRenderFrameHelper::ScriptedPrint(bool user_initiated) {
|
|
|
+@@ -1122,7 +1123,8 @@ void PrintRenderFrameHelper::ScriptedPrint(bool user_initiated) {
|
|
|
web_frame->DispatchBeforePrintEvent();
|
|
|
if (!weak_this)
|
|
|
return;
|
|
@@ -414,7 +415,7 @@ index ef580254bd8feba84ac02924b77b9b4feaf14d96..3cdaf40b6e5aeee7193a49a31f824c91
|
|
|
if (weak_this)
|
|
|
web_frame->DispatchAfterPrintEvent();
|
|
|
}
|
|
|
-@@ -1164,7 +1166,9 @@ void PrintRenderFrameHelper::OnDestruct() {
|
|
|
+@@ -1170,7 +1172,9 @@ void PrintRenderFrameHelper::OnDestruct() {
|
|
|
delete this;
|
|
|
}
|
|
|
|
|
@@ -425,7 +426,7 @@ index ef580254bd8feba84ac02924b77b9b4feaf14d96..3cdaf40b6e5aeee7193a49a31f824c91
|
|
|
if (ipc_nesting_level_ > 1)
|
|
|
return;
|
|
|
|
|
|
-@@ -1177,7 +1181,8 @@ void PrintRenderFrameHelper::OnPrintPages() {
|
|
|
+@@ -1183,7 +1187,8 @@ void PrintRenderFrameHelper::OnPrintPages() {
|
|
|
// If we are printing a PDF extension frame, find the plugin node and print
|
|
|
// that instead.
|
|
|
auto plugin = delegate_->GetPdfElement(frame);
|
|
@@ -435,7 +436,7 @@ index ef580254bd8feba84ac02924b77b9b4feaf14d96..3cdaf40b6e5aeee7193a49a31f824c91
|
|
|
if (weak_this)
|
|
|
frame->DispatchAfterPrintEvent();
|
|
|
// WARNING: |this| may be gone at this point. Do not do any more work here and
|
|
|
-@@ -1194,7 +1199,7 @@ void PrintRenderFrameHelper::OnPrintForSystemDialog() {
|
|
|
+@@ -1200,7 +1205,7 @@ void PrintRenderFrameHelper::OnPrintForSystemDialog() {
|
|
|
}
|
|
|
auto weak_this = weak_ptr_factory_.GetWeakPtr();
|
|
|
Print(frame, print_preview_context_.source_node(),
|
|
@@ -444,7 +445,7 @@ index ef580254bd8feba84ac02924b77b9b4feaf14d96..3cdaf40b6e5aeee7193a49a31f824c91
|
|
|
if (weak_this)
|
|
|
frame->DispatchAfterPrintEvent();
|
|
|
// WARNING: |this| may be gone at this point. Do not do any more work here and
|
|
|
-@@ -1230,6 +1235,8 @@ void PrintRenderFrameHelper::OnPrintPreview(
|
|
|
+@@ -1236,6 +1241,8 @@ void PrintRenderFrameHelper::OnPrintPreview(
|
|
|
if (ipc_nesting_level_ > 1)
|
|
|
return;
|
|
|
|
|
@@ -453,7 +454,7 @@ index ef580254bd8feba84ac02924b77b9b4feaf14d96..3cdaf40b6e5aeee7193a49a31f824c91
|
|
|
print_preview_context_.OnPrintPreview();
|
|
|
|
|
|
UMA_HISTOGRAM_ENUMERATION("PrintPreview.PreviewEvent",
|
|
|
-@@ -1622,7 +1629,9 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) {
|
|
|
+@@ -1628,7 +1635,9 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) {
|
|
|
|
|
|
auto self = weak_ptr_factory_.GetWeakPtr();
|
|
|
Print(duplicate_node.GetDocument().GetFrame(), duplicate_node,
|
|
@@ -464,7 +465,7 @@ index ef580254bd8feba84ac02924b77b9b4feaf14d96..3cdaf40b6e5aeee7193a49a31f824c91
|
|
|
// Check if |this| is still valid.
|
|
|
if (!self)
|
|
|
return;
|
|
|
-@@ -1633,7 +1642,9 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) {
|
|
|
+@@ -1639,7 +1648,9 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) {
|
|
|
|
|
|
void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame,
|
|
|
const blink::WebNode& node,
|
|
@@ -475,7 +476,7 @@ index ef580254bd8feba84ac02924b77b9b4feaf14d96..3cdaf40b6e5aeee7193a49a31f824c91
|
|
|
// If still not finished with earlier print request simply ignore.
|
|
|
if (prep_frame_view_)
|
|
|
return;
|
|
|
-@@ -1641,7 +1652,7 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame,
|
|
|
+@@ -1647,7 +1658,7 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame,
|
|
|
FrameReference frame_ref(frame);
|
|
|
|
|
|
int expected_page_count = 0;
|
|
@@ -484,7 +485,7 @@ index ef580254bd8feba84ac02924b77b9b4feaf14d96..3cdaf40b6e5aeee7193a49a31f824c91
|
|
|
DidFinishPrinting(FAIL_PRINT_INIT);
|
|
|
return; // Failed to init print page settings.
|
|
|
}
|
|
|
-@@ -1661,8 +1672,11 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame,
|
|
|
+@@ -1667,8 +1678,11 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame,
|
|
|
|
|
|
PrintMsg_PrintPages_Params print_settings;
|
|
|
auto self = weak_ptr_factory_.GetWeakPtr();
|
|
@@ -498,7 +499,7 @@ index ef580254bd8feba84ac02924b77b9b4feaf14d96..3cdaf40b6e5aeee7193a49a31f824c91
|
|
|
// Check if |this| is still valid.
|
|
|
if (!self)
|
|
|
return;
|
|
|
-@@ -1867,10 +1881,23 @@ std::vector<int> PrintRenderFrameHelper::GetPrintedPages(
|
|
|
+@@ -1875,10 +1889,23 @@ std::vector<int> PrintRenderFrameHelper::GetPrintedPages(
|
|
|
return printed_pages;
|
|
|
}
|
|
|
|
|
@@ -525,7 +526,7 @@ index ef580254bd8feba84ac02924b77b9b4feaf14d96..3cdaf40b6e5aeee7193a49a31f824c91
|
|
|
// Check if the printer returned any settings, if the settings is empty, we
|
|
|
// can safely assume there are no printer drivers configured. So we safely
|
|
|
// terminate.
|
|
|
-@@ -1890,12 +1917,14 @@ bool PrintRenderFrameHelper::InitPrintSettings(bool fit_to_paper_size) {
|
|
|
+@@ -1898,12 +1925,14 @@ bool PrintRenderFrameHelper::InitPrintSettings(bool fit_to_paper_size) {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
@@ -587,10 +588,10 @@ index 71c0c15217b62cd7a6087c6d9ae50481f9041d5f..18d853d7f808aaf816de86e8c5b82317
|
|
|
#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
|
|
// Set options for print preset from source PDF document.
|
|
|
diff --git a/printing/print_settings_conversion.cc b/printing/print_settings_conversion.cc
|
|
|
-index 2563ae6a87b2354ff2f2b45c17f61d2f44910efa..a7c61e5286659c51579c6b50cf5cc52c10433062 100644
|
|
|
+index 17c363ff9aa2e2262cacd0c9baea3820334bf67b..5b02461c2e9afe254405ddacd904e4bdbddd0b8b 100644
|
|
|
--- a/printing/print_settings_conversion.cc
|
|
|
+++ b/printing/print_settings_conversion.cc
|
|
|
-@@ -190,11 +190,12 @@ bool PrintSettingsFromJobSettings(const base::Value& job_settings,
|
|
|
+@@ -184,11 +184,12 @@ bool PrintSettingsFromJobSettings(const base::Value& job_settings,
|
|
|
|
|
|
settings->set_dpi_xy(dpi_horizontal.value(), dpi_vertical.value());
|
|
|
#endif
|
|
@@ -605,23 +606,23 @@ index 2563ae6a87b2354ff2f2b45c17f61d2f44910efa..a7c61e5286659c51579c6b50cf5cc52c
|
|
|
settings->set_color(static_cast<ColorModel>(color.value()));
|
|
|
settings->set_scale_factor(static_cast<double>(scale_factor.value()) / 100.0);
|
|
|
diff --git a/printing/printing_context.cc b/printing/printing_context.cc
|
|
|
-index 78e3c3b2e1bea0f3626838eab14267847a556470..b1c16e6eb1d0d9c0a8b700d9faf408d602f962ea 100644
|
|
|
+index cd5c27c87df175676504a06b4e1904f6b836dc90..c4f6acf66bc69f1e7db633aa5b3b03a913ffb666 100644
|
|
|
--- a/printing/printing_context.cc
|
|
|
+++ b/printing/printing_context.cc
|
|
|
-@@ -77,8 +77,6 @@ PrintingContext::Result PrintingContext::UsePdfSettings() {
|
|
|
+@@ -93,8 +93,6 @@ PrintingContext::Result PrintingContext::UsePdfSettings() {
|
|
|
|
|
|
PrintingContext::Result PrintingContext::UpdatePrintSettings(
|
|
|
base::Value job_settings) {
|
|
|
- ResetSettings();
|
|
|
-
|
|
|
- if (!PrintSettingsFromJobSettings(job_settings, &settings_)) {
|
|
|
+ if (!PrintSettingsFromJobSettings(job_settings, settings_.get())) {
|
|
|
NOTREACHED();
|
|
|
return OnError();
|
|
|
diff --git a/printing/printing_context.h b/printing/printing_context.h
|
|
|
-index 9ccc1a6680bcedd452cade7f7531924ace7876cf..4e1c330c01a1d6d1ba702337f16d8f8a70cd76f5 100644
|
|
|
+index 6a5a7c90ef5ba82837095c7bb934881b108797f7..a033c58076ff229ae45ed7c454fc60a57e5707b7 100644
|
|
|
--- a/printing/printing_context.h
|
|
|
+++ b/printing/printing_context.h
|
|
|
-@@ -129,12 +129,12 @@ class PRINTING_EXPORT PrintingContext {
|
|
|
+@@ -131,12 +131,12 @@ class PRINTING_EXPORT PrintingContext {
|
|
|
|
|
|
int job_id() const { return job_id_; }
|
|
|
|