|
@@ -11,10 +11,10 @@ majority of changes originally come from these PRs:
|
|
|
This patch also fixes callback for manual user cancellation and success.
|
|
|
|
|
|
diff --git a/BUILD.gn b/BUILD.gn
|
|
|
-index dc86196ebcb7bb630dc3ca5b7e78244ae1e5ddd5..3e2cf78dc14a1d4b3d23ec9db4418a132c8b9df2 100644
|
|
|
+index 99a80c73248bf54e7478d6038601442645f01158..beb628520129d48019c12a8383c5ab5d7a22e22d 100644
|
|
|
--- a/BUILD.gn
|
|
|
+++ b/BUILD.gn
|
|
|
-@@ -966,7 +966,6 @@ if (is_win) {
|
|
|
+@@ -969,7 +969,6 @@ if (is_win) {
|
|
|
"//media:media_unittests",
|
|
|
"//media/midi:midi_unittests",
|
|
|
"//net:net_unittests",
|
|
@@ -22,7 +22,7 @@ index dc86196ebcb7bb630dc3ca5b7e78244ae1e5ddd5..3e2cf78dc14a1d4b3d23ec9db4418a13
|
|
|
"//sql:sql_unittests",
|
|
|
"//third_party/breakpad:symupload($host_toolchain)",
|
|
|
"//ui/base:ui_base_unittests",
|
|
|
-@@ -975,6 +974,10 @@ if (is_win) {
|
|
|
+@@ -978,6 +977,10 @@ if (is_win) {
|
|
|
"//ui/views:views_unittests",
|
|
|
"//url:url_unittests",
|
|
|
]
|
|
@@ -34,7 +34,7 @@ index dc86196ebcb7bb630dc3ca5b7e78244ae1e5ddd5..3e2cf78dc14a1d4b3d23ec9db4418a13
|
|
|
}
|
|
|
|
|
|
diff --git a/chrome/browser/printing/print_job.cc b/chrome/browser/printing/print_job.cc
|
|
|
-index c27e2d50aa6cd45484c222221c6a8dda50baf8ff..43c48b75806bb08f3a4ea45689fe2469368cca4a 100644
|
|
|
+index 819ea8a1902bd4cbf52f6e52622203b34a096aae..c7111b8814cc9260de2201febdcaeb2f588e5d6a 100644
|
|
|
--- a/chrome/browser/printing/print_job.cc
|
|
|
+++ b/chrome/browser/printing/print_job.cc
|
|
|
@@ -93,6 +93,7 @@ bool PrintWithReducedRasterization(PrefService* prefs) {
|
|
@@ -66,7 +66,7 @@ index c27e2d50aa6cd45484c222221c6a8dda50baf8ff..43c48b75806bb08f3a4ea45689fe2469
|
|
|
#endif
|
|
|
|
|
|
auto new_doc = base::MakeRefCounted<PrintedDocument>(std::move(settings),
|
|
|
-@@ -381,8 +381,10 @@ void PrintJob::StartPdfToEmfConversion(
|
|
|
+@@ -387,8 +387,10 @@ void PrintJob::StartPdfToEmfConversion(
|
|
|
|
|
|
const PrintSettings& settings = document()->settings();
|
|
|
|
|
@@ -78,7 +78,7 @@ index c27e2d50aa6cd45484c222221c6a8dda50baf8ff..43c48b75806bb08f3a4ea45689fe2469
|
|
|
|
|
|
using RenderMode = PdfRenderSettings::Mode;
|
|
|
RenderMode mode = print_with_reduced_rasterization
|
|
|
-@@ -472,8 +474,10 @@ void PrintJob::StartPdfToPostScriptConversion(
|
|
|
+@@ -480,8 +482,10 @@ void PrintJob::StartPdfToPostScriptConversion(
|
|
|
if (ps_level2) {
|
|
|
mode = PdfRenderSettings::Mode::POSTSCRIPT_LEVEL2;
|
|
|
} else {
|
|
@@ -91,7 +91,7 @@ index c27e2d50aa6cd45484c222221c6a8dda50baf8ff..43c48b75806bb08f3a4ea45689fe2469
|
|
|
: PdfRenderSettings::Mode::POSTSCRIPT_LEVEL3;
|
|
|
}
|
|
|
diff --git a/chrome/browser/printing/print_view_manager_base.cc b/chrome/browser/printing/print_view_manager_base.cc
|
|
|
-index 040a37a9eab2af1491f7f8f4dc2e6ed78ac1d20e..fe4b29c905d89d96e3abf163eb25d7fae20e3b22 100644
|
|
|
+index 666ee7afbd6425bab3da68d2367db99121268758..4553693807136a7bc580e35b85c5445468cbda20 100644
|
|
|
--- a/chrome/browser/printing/print_view_manager_base.cc
|
|
|
+++ b/chrome/browser/printing/print_view_manager_base.cc
|
|
|
@@ -23,7 +23,9 @@
|
|
@@ -209,7 +209,7 @@ index 040a37a9eab2af1491f7f8f4dc2e6ed78ac1d20e..fe4b29c905d89d96e3abf163eb25d7fa
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
-@@ -342,12 +373,13 @@ void PrintViewManagerBase::OnDidUpdatePrintableArea(
|
|
|
+@@ -343,12 +374,13 @@ void PrintViewManagerBase::OnDidUpdatePrintableArea(
|
|
|
}
|
|
|
PRINTER_LOG(EVENT) << "Paper printable area updated for vendor id "
|
|
|
<< print_settings->requested_media().vendor_id;
|
|
@@ -224,7 +224,7 @@ index 040a37a9eab2af1491f7f8f4dc2e6ed78ac1d20e..fe4b29c905d89d96e3abf163eb25d7fa
|
|
|
base::Value::Dict job_settings,
|
|
|
std::unique_ptr<PrintSettings> print_settings,
|
|
|
UpdatePrintSettingsCallback callback) {
|
|
|
-@@ -355,7 +387,8 @@ void PrintViewManagerBase::CompleteUpdatePrintSettings(
|
|
|
+@@ -356,7 +388,8 @@ void PrintViewManagerBase::CompleteUpdatePrintSettings(
|
|
|
settings->pages = GetPageRangesFromJobSettings(job_settings);
|
|
|
settings->params = mojom::PrintParams::New();
|
|
|
RenderParamsFromPrintSettings(*print_settings, settings->params.get());
|
|
@@ -234,7 +234,7 @@ index 040a37a9eab2af1491f7f8f4dc2e6ed78ac1d20e..fe4b29c905d89d96e3abf163eb25d7fa
|
|
|
if (!PrintMsgPrintParamsIsValid(*settings->params)) {
|
|
|
mojom::PrinterType printer_type = static_cast<mojom::PrinterType>(
|
|
|
*job_settings.FindInt(kSettingPrinterType));
|
|
|
-@@ -367,6 +400,10 @@ void PrintViewManagerBase::CompleteUpdatePrintSettings(
|
|
|
+@@ -368,6 +401,10 @@ void PrintViewManagerBase::CompleteUpdatePrintSettings(
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -245,7 +245,7 @@ index 040a37a9eab2af1491f7f8f4dc2e6ed78ac1d20e..fe4b29c905d89d96e3abf163eb25d7fa
|
|
|
set_cookie(settings->params->document_cookie);
|
|
|
std::move(callback).Run(std::move(settings));
|
|
|
}
|
|
|
-@@ -502,7 +539,8 @@ void PrintViewManagerBase::GetDefaultPrintSettingsReply(
|
|
|
+@@ -503,7 +540,8 @@ void PrintViewManagerBase::GetDefaultPrintSettingsReply(
|
|
|
void PrintViewManagerBase::ScriptedPrintReply(
|
|
|
ScriptedPrintCallback callback,
|
|
|
int process_id,
|
|
@@ -255,7 +255,7 @@ index 040a37a9eab2af1491f7f8f4dc2e6ed78ac1d20e..fe4b29c905d89d96e3abf163eb25d7fa
|
|
|
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
|
|
|
|
|
#if BUILDFLAG(ENABLE_OOP_PRINTING)
|
|
|
-@@ -517,12 +555,15 @@ void PrintViewManagerBase::ScriptedPrintReply(
|
|
|
+@@ -518,12 +556,15 @@ void PrintViewManagerBase::ScriptedPrintReply(
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -273,7 +273,7 @@ index 040a37a9eab2af1491f7f8f4dc2e6ed78ac1d20e..fe4b29c905d89d96e3abf163eb25d7fa
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-@@ -650,10 +691,12 @@ void PrintViewManagerBase::DidPrintDocument(
|
|
|
+@@ -651,10 +692,12 @@ void PrintViewManagerBase::DidPrintDocument(
|
|
|
void PrintViewManagerBase::GetDefaultPrintSettings(
|
|
|
GetDefaultPrintSettingsCallback callback) {
|
|
|
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
|
@@ -286,7 +286,7 @@ index 040a37a9eab2af1491f7f8f4dc2e6ed78ac1d20e..fe4b29c905d89d96e3abf163eb25d7fa
|
|
|
#if BUILDFLAG(ENABLE_OOP_PRINTING)
|
|
|
if (printing::features::kEnableOopPrintDriversJobPrint.Get() &&
|
|
|
#if BUILDFLAG(ENABLE_PRINT_CONTENT_ANALYSIS)
|
|
|
-@@ -705,10 +748,12 @@ void PrintViewManagerBase::UpdatePrintSettings(
|
|
|
+@@ -706,10 +749,12 @@ void PrintViewManagerBase::UpdatePrintSettings(
|
|
|
base::Value::Dict job_settings,
|
|
|
UpdatePrintSettingsCallback callback) {
|
|
|
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
|
@@ -299,7 +299,7 @@ index 040a37a9eab2af1491f7f8f4dc2e6ed78ac1d20e..fe4b29c905d89d96e3abf163eb25d7fa
|
|
|
|
|
|
absl::optional<int> printer_type_value =
|
|
|
job_settings.FindInt(kSettingPrinterType);
|
|
|
-@@ -719,6 +764,7 @@ void PrintViewManagerBase::UpdatePrintSettings(
|
|
|
+@@ -720,6 +765,7 @@ void PrintViewManagerBase::UpdatePrintSettings(
|
|
|
|
|
|
mojom::PrinterType printer_type =
|
|
|
static_cast<mojom::PrinterType>(*printer_type_value);
|
|
@@ -307,7 +307,7 @@ index 040a37a9eab2af1491f7f8f4dc2e6ed78ac1d20e..fe4b29c905d89d96e3abf163eb25d7fa
|
|
|
if (printer_type != mojom::PrinterType::kExtension &&
|
|
|
printer_type != mojom::PrinterType::kPdf &&
|
|
|
printer_type != mojom::PrinterType::kLocal) {
|
|
|
-@@ -738,6 +784,7 @@ void PrintViewManagerBase::UpdatePrintSettings(
|
|
|
+@@ -739,6 +785,7 @@ void PrintViewManagerBase::UpdatePrintSettings(
|
|
|
if (value > 0)
|
|
|
job_settings.Set(kSettingRasterizePdfDpi, value);
|
|
|
}
|
|
@@ -315,7 +315,7 @@ index 040a37a9eab2af1491f7f8f4dc2e6ed78ac1d20e..fe4b29c905d89d96e3abf163eb25d7fa
|
|
|
|
|
|
std::unique_ptr<PrintSettings> print_settings =
|
|
|
PrintSettingsFromJobSettings(job_settings);
|
|
|
-@@ -757,7 +804,21 @@ void PrintViewManagerBase::UpdatePrintSettings(
|
|
|
+@@ -758,7 +805,21 @@ void PrintViewManagerBase::UpdatePrintSettings(
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -338,7 +338,7 @@ index 040a37a9eab2af1491f7f8f4dc2e6ed78ac1d20e..fe4b29c905d89d96e3abf163eb25d7fa
|
|
|
// TODO(crbug.com/1424368): Remove this if the printable areas can be made
|
|
|
// fully available from `PrintBackend::GetPrinterSemanticCapsAndDefaults()`
|
|
|
// for in-browser queries.
|
|
|
-@@ -779,8 +840,6 @@ void PrintViewManagerBase::UpdatePrintSettings(
|
|
|
+@@ -780,8 +841,6 @@ void PrintViewManagerBase::UpdatePrintSettings(
|
|
|
}
|
|
|
#endif
|
|
|
|
|
@@ -347,7 +347,7 @@ index 040a37a9eab2af1491f7f8f4dc2e6ed78ac1d20e..fe4b29c905d89d96e3abf163eb25d7fa
|
|
|
}
|
|
|
|
|
|
void PrintViewManagerBase::SetAccessibilityTree(
|
|
|
-@@ -796,7 +855,7 @@ void PrintViewManagerBase::SetAccessibilityTree(
|
|
|
+@@ -797,7 +856,7 @@ void PrintViewManagerBase::SetAccessibilityTree(
|
|
|
void PrintViewManagerBase::IsPrintingEnabled(
|
|
|
IsPrintingEnabledCallback callback) {
|
|
|
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
|
@@ -356,7 +356,7 @@ index 040a37a9eab2af1491f7f8f4dc2e6ed78ac1d20e..fe4b29c905d89d96e3abf163eb25d7fa
|
|
|
}
|
|
|
|
|
|
void PrintViewManagerBase::ScriptedPrint(mojom::ScriptedPrintParamsPtr params,
|
|
|
-@@ -812,14 +871,14 @@ void PrintViewManagerBase::ScriptedPrint(mojom::ScriptedPrintParamsPtr params,
|
|
|
+@@ -813,14 +872,14 @@ void PrintViewManagerBase::ScriptedPrint(mojom::ScriptedPrintParamsPtr params,
|
|
|
// didn't happen for some reason.
|
|
|
bad_message::ReceivedBadMessage(
|
|
|
render_process_host, bad_message::PVMB_SCRIPTED_PRINT_FENCED_FRAME);
|
|
@@ -373,7 +373,7 @@ index 040a37a9eab2af1491f7f8f4dc2e6ed78ac1d20e..fe4b29c905d89d96e3abf163eb25d7fa
|
|
|
return;
|
|
|
}
|
|
|
#endif
|
|
|
-@@ -861,6 +920,7 @@ void PrintViewManagerBase::PrintingFailed(int32_t cookie,
|
|
|
+@@ -862,6 +921,7 @@ void PrintViewManagerBase::PrintingFailed(int32_t cookie,
|
|
|
|
|
|
PrintManager::PrintingFailed(cookie, reason);
|
|
|
|
|
@@ -381,7 +381,7 @@ index 040a37a9eab2af1491f7f8f4dc2e6ed78ac1d20e..fe4b29c905d89d96e3abf163eb25d7fa
|
|
|
// `PrintingFailed()` can occur because asynchronous compositing results
|
|
|
// don't complete until after a print job has already failed and been
|
|
|
// destroyed. In such cases the error notification to the user will
|
|
|
-@@ -870,7 +930,7 @@ void PrintViewManagerBase::PrintingFailed(int32_t cookie,
|
|
|
+@@ -871,7 +931,7 @@ void PrintViewManagerBase::PrintingFailed(int32_t cookie,
|
|
|
print_job_->document()->cookie() == cookie) {
|
|
|
ShowPrintErrorDialogForGenericError();
|
|
|
}
|
|
@@ -390,7 +390,7 @@ index 040a37a9eab2af1491f7f8f4dc2e6ed78ac1d20e..fe4b29c905d89d96e3abf163eb25d7fa
|
|
|
ReleasePrinterQuery();
|
|
|
}
|
|
|
|
|
|
-@@ -882,15 +942,24 @@ void PrintViewManagerBase::RemoveTestObserver(TestObserver& observer) {
|
|
|
+@@ -883,15 +943,24 @@ void PrintViewManagerBase::RemoveTestObserver(TestObserver& observer) {
|
|
|
test_observers_.RemoveObserver(&observer);
|
|
|
}
|
|
|
|
|
@@ -415,7 +415,7 @@ index 040a37a9eab2af1491f7f8f4dc2e6ed78ac1d20e..fe4b29c905d89d96e3abf163eb25d7fa
|
|
|
}
|
|
|
|
|
|
void PrintViewManagerBase::RenderFrameDeleted(
|
|
|
-@@ -942,7 +1011,12 @@ void PrintViewManagerBase::OnJobDone() {
|
|
|
+@@ -943,7 +1012,12 @@ void PrintViewManagerBase::OnJobDone() {
|
|
|
// Printing is done, we don't need it anymore.
|
|
|
// print_job_->is_job_pending() may still be true, depending on the order
|
|
|
// of object registration.
|
|
@@ -429,7 +429,7 @@ index 040a37a9eab2af1491f7f8f4dc2e6ed78ac1d20e..fe4b29c905d89d96e3abf163eb25d7fa
|
|
|
ReleasePrintJob();
|
|
|
}
|
|
|
|
|
|
-@@ -951,9 +1025,10 @@ void PrintViewManagerBase::OnCanceling() {
|
|
|
+@@ -952,9 +1026,10 @@ void PrintViewManagerBase::OnCanceling() {
|
|
|
}
|
|
|
|
|
|
void PrintViewManagerBase::OnFailed() {
|
|
@@ -441,7 +441,7 @@ index 040a37a9eab2af1491f7f8f4dc2e6ed78ac1d20e..fe4b29c905d89d96e3abf163eb25d7fa
|
|
|
TerminatePrintJob(true);
|
|
|
}
|
|
|
|
|
|
-@@ -963,7 +1038,7 @@ bool PrintViewManagerBase::RenderAllMissingPagesNow() {
|
|
|
+@@ -964,7 +1039,7 @@ bool PrintViewManagerBase::RenderAllMissingPagesNow() {
|
|
|
|
|
|
// Is the document already complete?
|
|
|
if (print_job_->document() && print_job_->document()->IsComplete()) {
|
|
@@ -450,7 +450,7 @@ index 040a37a9eab2af1491f7f8f4dc2e6ed78ac1d20e..fe4b29c905d89d96e3abf163eb25d7fa
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
-@@ -1011,7 +1086,10 @@ bool PrintViewManagerBase::CreateNewPrintJob(
|
|
|
+@@ -1017,7 +1092,10 @@ bool PrintViewManagerBase::SetupNewPrintJob(
|
|
|
|
|
|
// Disconnect the current `print_job_`.
|
|
|
auto weak_this = weak_ptr_factory_.GetWeakPtr();
|
|
@@ -462,7 +462,7 @@ index 040a37a9eab2af1491f7f8f4dc2e6ed78ac1d20e..fe4b29c905d89d96e3abf163eb25d7fa
|
|
|
if (!weak_this)
|
|
|
return false;
|
|
|
|
|
|
-@@ -1032,7 +1110,7 @@ bool PrintViewManagerBase::CreateNewPrintJob(
|
|
|
+@@ -1037,7 +1115,7 @@ bool PrintViewManagerBase::SetupNewPrintJob(
|
|
|
#endif
|
|
|
print_job_->AddObserver(*this);
|
|
|
|
|
@@ -471,7 +471,7 @@ index 040a37a9eab2af1491f7f8f4dc2e6ed78ac1d20e..fe4b29c905d89d96e3abf163eb25d7fa
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
-@@ -1100,6 +1178,11 @@ void PrintViewManagerBase::ReleasePrintJob() {
|
|
|
+@@ -1105,6 +1183,11 @@ void PrintViewManagerBase::ReleasePrintJob() {
|
|
|
}
|
|
|
#endif
|
|
|
|
|
@@ -483,7 +483,7 @@ index 040a37a9eab2af1491f7f8f4dc2e6ed78ac1d20e..fe4b29c905d89d96e3abf163eb25d7fa
|
|
|
if (!print_job_)
|
|
|
return;
|
|
|
|
|
|
-@@ -1107,7 +1190,7 @@ void PrintViewManagerBase::ReleasePrintJob() {
|
|
|
+@@ -1112,7 +1195,7 @@ void PrintViewManagerBase::ReleasePrintJob() {
|
|
|
// printing_rfh_ should only ever point to a RenderFrameHost with a live
|
|
|
// RenderFrame.
|
|
|
DCHECK(rfh->IsRenderFrameLive());
|
|
@@ -492,7 +492,7 @@ index 040a37a9eab2af1491f7f8f4dc2e6ed78ac1d20e..fe4b29c905d89d96e3abf163eb25d7fa
|
|
|
}
|
|
|
|
|
|
print_job_->RemoveObserver(*this);
|
|
|
-@@ -1149,7 +1232,7 @@ bool PrintViewManagerBase::RunInnerMessageLoop() {
|
|
|
+@@ -1154,7 +1237,7 @@ bool PrintViewManagerBase::RunInnerMessageLoop() {
|
|
|
}
|
|
|
|
|
|
bool PrintViewManagerBase::OpportunisticallyCreatePrintJob(int cookie) {
|
|
@@ -501,7 +501,7 @@ index 040a37a9eab2af1491f7f8f4dc2e6ed78ac1d20e..fe4b29c905d89d96e3abf163eb25d7fa
|
|
|
return true;
|
|
|
|
|
|
if (!cookie) {
|
|
|
-@@ -1295,7 +1378,7 @@ void PrintViewManagerBase::ReleasePrinterQuery() {
|
|
|
+@@ -1300,7 +1383,7 @@ void PrintViewManagerBase::ReleasePrinterQuery() {
|
|
|
}
|
|
|
|
|
|
void PrintViewManagerBase::CompletePrintNow(content::RenderFrameHost* rfh) {
|
|
@@ -510,7 +510,7 @@ index 040a37a9eab2af1491f7f8f4dc2e6ed78ac1d20e..fe4b29c905d89d96e3abf163eb25d7fa
|
|
|
|
|
|
for (auto& observer : GetTestObservers()) {
|
|
|
observer.OnPrintNow(rfh);
|
|
|
-@@ -1345,7 +1428,7 @@ void PrintViewManagerBase::CompleteScriptedPrintAfterContentAnalysis(
|
|
|
+@@ -1350,7 +1433,7 @@ void PrintViewManagerBase::CompleteScriptedPrintAfterContentAnalysis(
|
|
|
set_analyzing_content(/*analyzing=*/false);
|
|
|
if (!allowed || !printing_rfh_ || IsCrashed() ||
|
|
|
!printing_rfh_->IsRenderFrameLive()) {
|
|
@@ -520,7 +520,7 @@ index 040a37a9eab2af1491f7f8f4dc2e6ed78ac1d20e..fe4b29c905d89d96e3abf163eb25d7fa
|
|
|
}
|
|
|
CompleteScriptedPrint(printing_rfh_, std::move(params), std::move(callback));
|
|
|
diff --git a/chrome/browser/printing/print_view_manager_base.h b/chrome/browser/printing/print_view_manager_base.h
|
|
|
-index 9f62238a3f5a73219a604061e434c2a0400fba44..e46800600d53b3f0d1357eaa2fccd7d2e7c59251 100644
|
|
|
+index ae2339d1ab82bd7cfa971ed03a188cfc26d6e1c0..186414ee72c6b431b87b02623abd4d1903de812b 100644
|
|
|
--- a/chrome/browser/printing/print_view_manager_base.h
|
|
|
+++ b/chrome/browser/printing/print_view_manager_base.h
|
|
|
@@ -44,6 +44,8 @@ namespace printing {
|
|
@@ -570,7 +570,7 @@ index 9f62238a3f5a73219a604061e434c2a0400fba44..e46800600d53b3f0d1357eaa2fccd7d2
|
|
|
protected:
|
|
|
explicit PrintViewManagerBase(content::WebContents* web_contents);
|
|
|
|
|
|
-@@ -277,6 +292,7 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
|
|
|
+@@ -281,6 +296,7 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
|
|
|
bool success);
|
|
|
#endif
|
|
|
void CompleteUpdatePrintSettings(
|
|
@@ -578,7 +578,7 @@ index 9f62238a3f5a73219a604061e434c2a0400fba44..e46800600d53b3f0d1357eaa2fccd7d2
|
|
|
base::Value::Dict job_settings,
|
|
|
std::unique_ptr<PrintSettings> print_settings,
|
|
|
UpdatePrintSettingsCallback callback);
|
|
|
-@@ -306,7 +322,8 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
|
|
|
+@@ -310,7 +326,8 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
|
|
|
// Runs `callback` with `params` to reply to ScriptedPrint().
|
|
|
void ScriptedPrintReply(ScriptedPrintCallback callback,
|
|
|
int process_id,
|
|
@@ -588,7 +588,7 @@ index 9f62238a3f5a73219a604061e434c2a0400fba44..e46800600d53b3f0d1357eaa2fccd7d2
|
|
|
|
|
|
// Requests the RenderView to render all the missing pages for the print job.
|
|
|
// No-op if no print job is pending. Returns true if at least one page has
|
|
|
-@@ -387,8 +404,11 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
|
|
|
+@@ -391,8 +408,11 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
|
|
|
// The current RFH that is printing with a system printing dialog.
|
|
|
raw_ptr<content::RenderFrameHost> printing_rfh_ = nullptr;
|
|
|
|
|
@@ -681,10 +681,10 @@ index ca71560874a0189068dd11fbc039f5673bf6bd96..a8551d95e64da2afbc1685b2df8f1fc3
|
|
|
mojom::PrintFailureReason reason) override;
|
|
|
|
|
|
diff --git a/components/printing/common/print.mojom b/components/printing/common/print.mojom
|
|
|
-index 0f535d5dd1db2e538382a91a0cf06f37d6b4961f..8156c74ad9ffeabfc0d87570a2d2ae1304f1ffa7 100644
|
|
|
+index 3f9a514fb41d72c5d06de6ac989f9d7c0513a4e7..0e7ada9df962808dad7caf074a08ebdedbd45604 100644
|
|
|
--- a/components/printing/common/print.mojom
|
|
|
+++ b/components/printing/common/print.mojom
|
|
|
-@@ -302,7 +302,7 @@ union PrintWithParamsResult {
|
|
|
+@@ -300,7 +300,7 @@ union PrintWithParamsResult {
|
|
|
interface PrintRenderFrame {
|
|
|
// Tells the RenderFrame to switch the CSS to print media type, render every
|
|
|
// requested page, and then switch back the CSS to display media type.
|
|
@@ -693,7 +693,7 @@ index 0f535d5dd1db2e538382a91a0cf06f37d6b4961f..8156c74ad9ffeabfc0d87570a2d2ae13
|
|
|
|
|
|
// Requests the frame to be printed with specified parameters. This is used
|
|
|
// to programmatically produce PDF by request from the browser (e.g. over
|
|
|
-@@ -396,7 +396,10 @@ interface PrintManagerHost {
|
|
|
+@@ -394,7 +394,10 @@ interface PrintManagerHost {
|
|
|
// UI to the user to select the final print settings. If the user cancels or
|
|
|
// an error occurs, return null.
|
|
|
[Sync]
|
|
@@ -706,7 +706,7 @@ index 0f535d5dd1db2e538382a91a0cf06f37d6b4961f..8156c74ad9ffeabfc0d87570a2d2ae13
|
|
|
// Tells the browser printing failed.
|
|
|
PrintingFailed(int32 cookie, PrintFailureReason reason);
|
|
|
diff --git a/components/printing/renderer/print_render_frame_helper.cc b/components/printing/renderer/print_render_frame_helper.cc
|
|
|
-index 8a510d66964572fab9facf34339239ba14028423..73ba3030b38af91e53fa2ac878fbcb5e61dd25c0 100644
|
|
|
+index cf97fc794294cbd5c2bcfd8a358c7b2291723e74..f55a1a6fd0eaeb9f1b2487dfcb272c301c9f9b1c 100644
|
|
|
--- a/components/printing/renderer/print_render_frame_helper.cc
|
|
|
+++ b/components/printing/renderer/print_render_frame_helper.cc
|
|
|
@@ -45,6 +45,7 @@
|
|
@@ -750,9 +750,9 @@ index 8a510d66964572fab9facf34339239ba14028423..73ba3030b38af91e53fa2ac878fbcb5e
|
|
|
- Print(frame, plugin, PrintRequestType::kRegular);
|
|
|
+ Print(frame, plugin, PrintRequestType::kRegular, silent, std::move(settings));
|
|
|
|
|
|
- if (!render_frame_gone_) {
|
|
|
- frame->DispatchAfterPrintEvent();
|
|
|
-@@ -1452,7 +1453,8 @@ void PrintRenderFrameHelper::PrintForSystemDialog() {
|
|
|
+ if (render_frame_gone_) {
|
|
|
+ return;
|
|
|
+@@ -1458,7 +1459,8 @@ void PrintRenderFrameHelper::PrintForSystemDialog() {
|
|
|
}
|
|
|
|
|
|
Print(frame, print_preview_context_.source_node(),
|
|
@@ -762,7 +762,7 @@ index 8a510d66964572fab9facf34339239ba14028423..73ba3030b38af91e53fa2ac878fbcb5e
|
|
|
if (render_frame_gone_) {
|
|
|
return;
|
|
|
}
|
|
|
-@@ -1515,6 +1517,8 @@ void PrintRenderFrameHelper::PrintPreview(base::Value::Dict settings) {
|
|
|
+@@ -1521,6 +1523,8 @@ void PrintRenderFrameHelper::PrintPreview(base::Value::Dict settings) {
|
|
|
if (ipc_nesting_level_ > kAllowedIpcDepthForPrint)
|
|
|
return;
|
|
|
|
|
@@ -771,17 +771,17 @@ index 8a510d66964572fab9facf34339239ba14028423..73ba3030b38af91e53fa2ac878fbcb5e
|
|
|
print_preview_context_.OnPrintPreview();
|
|
|
|
|
|
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
|
|
-@@ -2145,7 +2149,8 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) {
|
|
|
+@@ -2153,7 +2157,8 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) {
|
|
|
}
|
|
|
|
|
|
Print(duplicate_node.GetDocument().GetFrame(), duplicate_node,
|
|
|
- PrintRequestType::kRegular);
|
|
|
+ PrintRequestType::kRegular, false /* silent */,
|
|
|
+ base::Value::Dict() /* new_settings */);
|
|
|
- // Check if |this| is still valid.
|
|
|
+ // Check if `this` is still valid.
|
|
|
if (!weak_this) {
|
|
|
return;
|
|
|
-@@ -2161,7 +2166,9 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) {
|
|
|
+@@ -2169,7 +2174,9 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) {
|
|
|
|
|
|
void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame,
|
|
|
const blink::WebNode& node,
|
|
@@ -792,7 +792,7 @@ index 8a510d66964572fab9facf34339239ba14028423..73ba3030b38af91e53fa2ac878fbcb5e
|
|
|
// If still not finished with earlier print request simply ignore.
|
|
|
if (prep_frame_view_)
|
|
|
return;
|
|
|
-@@ -2169,7 +2176,7 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame,
|
|
|
+@@ -2177,7 +2184,7 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame,
|
|
|
FrameReference frame_ref(frame);
|
|
|
|
|
|
uint32_t expected_page_count = 0;
|
|
@@ -801,7 +801,7 @@ index 8a510d66964572fab9facf34339239ba14028423..73ba3030b38af91e53fa2ac878fbcb5e
|
|
|
DidFinishPrinting(PrintingResult::kFailPrintInit);
|
|
|
return; // Failed to init print page settings.
|
|
|
}
|
|
|
-@@ -2188,8 +2195,15 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame,
|
|
|
+@@ -2196,8 +2203,15 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame,
|
|
|
print_pages_params_->params->print_scaling_option;
|
|
|
|
|
|
auto self = weak_ptr_factory_.GetWeakPtr();
|
|
@@ -815,10 +815,10 @@ index 8a510d66964572fab9facf34339239ba14028423..73ba3030b38af91e53fa2ac878fbcb5e
|
|
|
+ print_settings = GetPrintSettingsFromUser(
|
|
|
frame_ref.GetFrame(), node, expected_page_count, print_request_type);
|
|
|
+ }
|
|
|
- // Check if |this| is still valid.
|
|
|
+ // Check if `this` is still valid.
|
|
|
if (!self)
|
|
|
return;
|
|
|
-@@ -2433,35 +2447,47 @@ void PrintRenderFrameHelper::IPCProcessed() {
|
|
|
+@@ -2441,35 +2455,47 @@ void PrintRenderFrameHelper::IPCProcessed() {
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -876,7 +876,7 @@ index 8a510d66964572fab9facf34339239ba14028423..73ba3030b38af91e53fa2ac878fbcb5e
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
-@@ -2566,7 +2592,7 @@ mojom::PrintPagesParamsPtr PrintRenderFrameHelper::GetPrintSettingsFromUser(
|
|
|
+@@ -2574,7 +2600,7 @@ mojom::PrintPagesParamsPtr PrintRenderFrameHelper::GetPrintSettingsFromUser(
|
|
|
std::move(params),
|
|
|
base::BindOnce(
|
|
|
[](base::OnceClosure quit_closure, mojom::PrintPagesParamsPtr* output,
|
|
@@ -886,7 +886,7 @@ index 8a510d66964572fab9facf34339239ba14028423..73ba3030b38af91e53fa2ac878fbcb5e
|
|
|
std::move(quit_closure).Run();
|
|
|
},
|
|
|
diff --git a/components/printing/renderer/print_render_frame_helper.h b/components/printing/renderer/print_render_frame_helper.h
|
|
|
-index 731b0fa4c0e1b3a5b4ce73d5bf2322767c70f9be..58921e7fdb9c33e21694186f436f409f74c81c3a 100644
|
|
|
+index 8d65b7b6440c8e653eb1b3f9c50b40944b7ae61b..eb6b4a42d507ff216fc07328c1907815a082ef19 100644
|
|
|
--- a/components/printing/renderer/print_render_frame_helper.h
|
|
|
+++ b/components/printing/renderer/print_render_frame_helper.h
|
|
|
@@ -247,7 +247,7 @@ class PrintRenderFrameHelper
|
|
@@ -927,10 +927,10 @@ index 731b0fa4c0e1b3a5b4ce73d5bf2322767c70f9be..58921e7fdb9c33e21694186f436f409f
|
|
|
#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
|
|
// Set options for print preset from source PDF document.
|
|
|
diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn
|
|
|
-index aeda95912420895271ecdf1883f04da07b32296e..2f165461b7326b4e426d4b2552766896bb273c29 100644
|
|
|
+index 7dcbbbba95fbc85c574f02dcd8b64a461d0652ec..180a4bbe8f0b39858f154d41aca8ffbb483c7cab 100644
|
|
|
--- a/content/browser/BUILD.gn
|
|
|
+++ b/content/browser/BUILD.gn
|
|
|
-@@ -2914,8 +2914,9 @@ source_set("browser") {
|
|
|
+@@ -2946,8 +2946,9 @@ source_set("browser") {
|
|
|
"//ppapi/shared_impl",
|
|
|
]
|
|
|
|