|
@@ -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/BUILD.gn b/BUILD.gn
|
|
|
-index 357647127147f797663a7ae3b82449f58991c388..cbbb8bc6df74fb932bc669fad2dac950c9d8661f 100644
|
|
|
+index 83530a3a22a75ec4010ed2ffb20e7a6f4751b835..f7b75fa8f943861b211cbe9a981face8317cc8f0 100644
|
|
|
--- a/BUILD.gn
|
|
|
+++ b/BUILD.gn
|
|
|
@@ -971,7 +971,6 @@ if (is_win) {
|
|
@@ -91,7 +91,7 @@ index 3a66a52b8d3c6da9cd8d7e9afdc8d59f528ec3d5..facaa6fbca8ee7c04f83607e62b81b95
|
|
|
: 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 97847278fc73e3a8fc80bef1bfbea5a9d0497b36..9f0e7a1e8b7e0c22623d6f681ebcd6b568dbb0cd 100644
|
|
|
+index 0c4e987c5bf3298c3600e248f0213fb9288a59c7..8ae1217098b15f1634612945a6f10508025af64c 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 97847278fc73e3a8fc80bef1bfbea5a9d0497b36..9f0e7a1e8b7e0c22623d6f681ebcd6b5
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
-@@ -313,12 +344,13 @@ void PrintViewManagerBase::OnDidUpdatePrintableArea(
|
|
|
+@@ -327,12 +358,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 97847278fc73e3a8fc80bef1bfbea5a9d0497b36..9f0e7a1e8b7e0c22623d6f681ebcd6b5
|
|
|
base::Value::Dict job_settings,
|
|
|
std::unique_ptr<PrintSettings> print_settings,
|
|
|
UpdatePrintSettingsCallback callback) {
|
|
|
-@@ -326,7 +358,8 @@ void PrintViewManagerBase::CompleteUpdatePrintSettings(
|
|
|
+@@ -340,7 +372,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 97847278fc73e3a8fc80bef1bfbea5a9d0497b36..9f0e7a1e8b7e0c22623d6f681ebcd6b5
|
|
|
if (!PrintMsgPrintParamsIsValid(*settings->params)) {
|
|
|
mojom::PrinterType printer_type = static_cast<mojom::PrinterType>(
|
|
|
*job_settings.FindInt(kSettingPrinterType));
|
|
|
-@@ -338,6 +371,10 @@ void PrintViewManagerBase::CompleteUpdatePrintSettings(
|
|
|
+@@ -352,6 +385,10 @@ void PrintViewManagerBase::CompleteUpdatePrintSettings(
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -245,7 +245,7 @@ index 97847278fc73e3a8fc80bef1bfbea5a9d0497b36..9f0e7a1e8b7e0c22623d6f681ebcd6b5
|
|
|
set_cookie(settings->params->document_cookie);
|
|
|
std::move(callback).Run(std::move(settings));
|
|
|
}
|
|
|
-@@ -442,7 +479,8 @@ void PrintViewManagerBase::GetDefaultPrintSettingsReply(
|
|
|
+@@ -487,7 +524,8 @@ void PrintViewManagerBase::GetDefaultPrintSettingsReply(
|
|
|
void PrintViewManagerBase::ScriptedPrintReply(
|
|
|
ScriptedPrintCallback callback,
|
|
|
int process_id,
|
|
@@ -255,7 +255,7 @@ index 97847278fc73e3a8fc80bef1bfbea5a9d0497b36..9f0e7a1e8b7e0c22623d6f681ebcd6b5
|
|
|
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
|
|
|
|
|
#if BUILDFLAG(ENABLE_OOP_PRINTING)
|
|
|
-@@ -457,12 +495,15 @@ void PrintViewManagerBase::ScriptedPrintReply(
|
|
|
+@@ -502,12 +540,15 @@ void PrintViewManagerBase::ScriptedPrintReply(
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -273,7 +273,7 @@ index 97847278fc73e3a8fc80bef1bfbea5a9d0497b36..9f0e7a1e8b7e0c22623d6f681ebcd6b5
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-@@ -599,10 +640,12 @@ void PrintViewManagerBase::DidPrintDocument(
|
|
|
+@@ -647,10 +688,12 @@ void PrintViewManagerBase::DidPrintDocument(
|
|
|
void PrintViewManagerBase::GetDefaultPrintSettings(
|
|
|
GetDefaultPrintSettingsCallback callback) {
|
|
|
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
|
@@ -286,7 +286,7 @@ index 97847278fc73e3a8fc80bef1bfbea5a9d0497b36..9f0e7a1e8b7e0c22623d6f681ebcd6b5
|
|
|
#if BUILDFLAG(ENABLE_OOP_PRINTING)
|
|
|
if (printing::features::kEnableOopPrintDriversJobPrint.Get() &&
|
|
|
#if BUILDFLAG(ENABLE_PRINT_CONTENT_ANALYSIS)
|
|
|
-@@ -654,10 +697,12 @@ void PrintViewManagerBase::UpdatePrintSettings(
|
|
|
+@@ -702,10 +745,12 @@ void PrintViewManagerBase::UpdatePrintSettings(
|
|
|
base::Value::Dict job_settings,
|
|
|
UpdatePrintSettingsCallback callback) {
|
|
|
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
|
@@ -299,7 +299,7 @@ index 97847278fc73e3a8fc80bef1bfbea5a9d0497b36..9f0e7a1e8b7e0c22623d6f681ebcd6b5
|
|
|
|
|
|
absl::optional<int> printer_type_value =
|
|
|
job_settings.FindInt(kSettingPrinterType);
|
|
|
-@@ -668,6 +713,7 @@ void PrintViewManagerBase::UpdatePrintSettings(
|
|
|
+@@ -716,6 +761,7 @@ void PrintViewManagerBase::UpdatePrintSettings(
|
|
|
|
|
|
mojom::PrinterType printer_type =
|
|
|
static_cast<mojom::PrinterType>(*printer_type_value);
|
|
@@ -307,7 +307,7 @@ index 97847278fc73e3a8fc80bef1bfbea5a9d0497b36..9f0e7a1e8b7e0c22623d6f681ebcd6b5
|
|
|
if (printer_type != mojom::PrinterType::kExtension &&
|
|
|
printer_type != mojom::PrinterType::kPdf &&
|
|
|
printer_type != mojom::PrinterType::kLocal) {
|
|
|
-@@ -687,6 +733,7 @@ void PrintViewManagerBase::UpdatePrintSettings(
|
|
|
+@@ -735,6 +781,7 @@ void PrintViewManagerBase::UpdatePrintSettings(
|
|
|
if (value > 0)
|
|
|
job_settings.Set(kSettingRasterizePdfDpi, value);
|
|
|
}
|
|
@@ -315,7 +315,7 @@ index 97847278fc73e3a8fc80bef1bfbea5a9d0497b36..9f0e7a1e8b7e0c22623d6f681ebcd6b5
|
|
|
|
|
|
std::unique_ptr<PrintSettings> print_settings =
|
|
|
PrintSettingsFromJobSettings(job_settings);
|
|
|
-@@ -706,7 +753,21 @@ void PrintViewManagerBase::UpdatePrintSettings(
|
|
|
+@@ -754,7 +801,21 @@ void PrintViewManagerBase::UpdatePrintSettings(
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -338,7 +338,7 @@ index 97847278fc73e3a8fc80bef1bfbea5a9d0497b36..9f0e7a1e8b7e0c22623d6f681ebcd6b5
|
|
|
// TODO(crbug.com/1424368): Remove this if the printable areas can be made
|
|
|
// fully available from `PrintBackend::GetPrinterSemanticCapsAndDefaults()`
|
|
|
// for in-browser queries.
|
|
|
-@@ -728,15 +789,13 @@ void PrintViewManagerBase::UpdatePrintSettings(
|
|
|
+@@ -776,15 +837,13 @@ void PrintViewManagerBase::UpdatePrintSettings(
|
|
|
}
|
|
|
#endif
|
|
|
|
|
@@ -355,7 +355,7 @@ index 97847278fc73e3a8fc80bef1bfbea5a9d0497b36..9f0e7a1e8b7e0c22623d6f681ebcd6b5
|
|
|
}
|
|
|
|
|
|
void PrintViewManagerBase::ScriptedPrint(mojom::ScriptedPrintParamsPtr params,
|
|
|
-@@ -752,14 +811,14 @@ void PrintViewManagerBase::ScriptedPrint(mojom::ScriptedPrintParamsPtr params,
|
|
|
+@@ -800,14 +859,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);
|
|
@@ -372,7 +372,7 @@ index 97847278fc73e3a8fc80bef1bfbea5a9d0497b36..9f0e7a1e8b7e0c22623d6f681ebcd6b5
|
|
|
return;
|
|
|
}
|
|
|
#endif
|
|
|
-@@ -795,6 +854,7 @@ void PrintViewManagerBase::PrintingFailed(int32_t cookie,
|
|
|
+@@ -843,6 +902,7 @@ void PrintViewManagerBase::PrintingFailed(int32_t cookie,
|
|
|
|
|
|
PrintManager::PrintingFailed(cookie, reason);
|
|
|
|
|
@@ -380,7 +380,7 @@ index 97847278fc73e3a8fc80bef1bfbea5a9d0497b36..9f0e7a1e8b7e0c22623d6f681ebcd6b5
|
|
|
// `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
|
|
|
-@@ -804,7 +864,7 @@ void PrintViewManagerBase::PrintingFailed(int32_t cookie,
|
|
|
+@@ -852,7 +912,7 @@ void PrintViewManagerBase::PrintingFailed(int32_t cookie,
|
|
|
print_job_->document()->cookie() == cookie) {
|
|
|
ShowPrintErrorDialogForGenericError();
|
|
|
}
|
|
@@ -389,7 +389,7 @@ index 97847278fc73e3a8fc80bef1bfbea5a9d0497b36..9f0e7a1e8b7e0c22623d6f681ebcd6b5
|
|
|
ReleasePrinterQuery();
|
|
|
}
|
|
|
|
|
|
-@@ -816,15 +876,24 @@ void PrintViewManagerBase::RemoveTestObserver(TestObserver& observer) {
|
|
|
+@@ -864,15 +924,24 @@ void PrintViewManagerBase::RemoveTestObserver(TestObserver& observer) {
|
|
|
test_observers_.RemoveObserver(&observer);
|
|
|
}
|
|
|
|
|
@@ -414,7 +414,7 @@ index 97847278fc73e3a8fc80bef1bfbea5a9d0497b36..9f0e7a1e8b7e0c22623d6f681ebcd6b5
|
|
|
}
|
|
|
|
|
|
void PrintViewManagerBase::RenderFrameDeleted(
|
|
|
-@@ -876,7 +945,12 @@ void PrintViewManagerBase::OnJobDone() {
|
|
|
+@@ -924,7 +993,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.
|
|
@@ -428,7 +428,7 @@ index 97847278fc73e3a8fc80bef1bfbea5a9d0497b36..9f0e7a1e8b7e0c22623d6f681ebcd6b5
|
|
|
ReleasePrintJob();
|
|
|
}
|
|
|
|
|
|
-@@ -885,9 +959,10 @@ void PrintViewManagerBase::OnCanceling() {
|
|
|
+@@ -933,9 +1007,10 @@ void PrintViewManagerBase::OnCanceling() {
|
|
|
}
|
|
|
|
|
|
void PrintViewManagerBase::OnFailed() {
|
|
@@ -440,7 +440,7 @@ index 97847278fc73e3a8fc80bef1bfbea5a9d0497b36..9f0e7a1e8b7e0c22623d6f681ebcd6b5
|
|
|
TerminatePrintJob(true);
|
|
|
}
|
|
|
|
|
|
-@@ -897,7 +972,7 @@ bool PrintViewManagerBase::RenderAllMissingPagesNow() {
|
|
|
+@@ -945,7 +1020,7 @@ bool PrintViewManagerBase::RenderAllMissingPagesNow() {
|
|
|
|
|
|
// Is the document already complete?
|
|
|
if (print_job_->document() && print_job_->document()->IsComplete()) {
|
|
@@ -449,7 +449,7 @@ index 97847278fc73e3a8fc80bef1bfbea5a9d0497b36..9f0e7a1e8b7e0c22623d6f681ebcd6b5
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
-@@ -945,7 +1020,10 @@ bool PrintViewManagerBase::CreateNewPrintJob(
|
|
|
+@@ -993,7 +1068,10 @@ bool PrintViewManagerBase::CreateNewPrintJob(
|
|
|
|
|
|
// Disconnect the current `print_job_`.
|
|
|
auto weak_this = weak_ptr_factory_.GetWeakPtr();
|
|
@@ -461,7 +461,7 @@ index 97847278fc73e3a8fc80bef1bfbea5a9d0497b36..9f0e7a1e8b7e0c22623d6f681ebcd6b5
|
|
|
if (!weak_this)
|
|
|
return false;
|
|
|
|
|
|
-@@ -966,7 +1044,7 @@ bool PrintViewManagerBase::CreateNewPrintJob(
|
|
|
+@@ -1014,7 +1092,7 @@ bool PrintViewManagerBase::CreateNewPrintJob(
|
|
|
#endif
|
|
|
print_job_->AddObserver(*this);
|
|
|
|
|
@@ -470,7 +470,7 @@ index 97847278fc73e3a8fc80bef1bfbea5a9d0497b36..9f0e7a1e8b7e0c22623d6f681ebcd6b5
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
-@@ -1034,6 +1112,11 @@ void PrintViewManagerBase::ReleasePrintJob() {
|
|
|
+@@ -1082,6 +1160,11 @@ void PrintViewManagerBase::ReleasePrintJob() {
|
|
|
}
|
|
|
#endif
|
|
|
|
|
@@ -482,7 +482,7 @@ index 97847278fc73e3a8fc80bef1bfbea5a9d0497b36..9f0e7a1e8b7e0c22623d6f681ebcd6b5
|
|
|
if (!print_job_)
|
|
|
return;
|
|
|
|
|
|
-@@ -1041,7 +1124,7 @@ void PrintViewManagerBase::ReleasePrintJob() {
|
|
|
+@@ -1089,7 +1172,7 @@ void PrintViewManagerBase::ReleasePrintJob() {
|
|
|
// printing_rfh_ should only ever point to a RenderFrameHost with a live
|
|
|
// RenderFrame.
|
|
|
DCHECK(rfh->IsRenderFrameLive());
|
|
@@ -491,7 +491,7 @@ index 97847278fc73e3a8fc80bef1bfbea5a9d0497b36..9f0e7a1e8b7e0c22623d6f681ebcd6b5
|
|
|
}
|
|
|
|
|
|
print_job_->RemoveObserver(*this);
|
|
|
-@@ -1083,7 +1166,7 @@ bool PrintViewManagerBase::RunInnerMessageLoop() {
|
|
|
+@@ -1131,7 +1214,7 @@ bool PrintViewManagerBase::RunInnerMessageLoop() {
|
|
|
}
|
|
|
|
|
|
bool PrintViewManagerBase::OpportunisticallyCreatePrintJob(int cookie) {
|
|
@@ -500,7 +500,7 @@ index 97847278fc73e3a8fc80bef1bfbea5a9d0497b36..9f0e7a1e8b7e0c22623d6f681ebcd6b5
|
|
|
return true;
|
|
|
|
|
|
if (!cookie) {
|
|
|
-@@ -1227,7 +1310,7 @@ void PrintViewManagerBase::ReleasePrinterQuery() {
|
|
|
+@@ -1277,7 +1360,7 @@ void PrintViewManagerBase::ReleasePrinterQuery() {
|
|
|
}
|
|
|
|
|
|
void PrintViewManagerBase::CompletePrintNow(content::RenderFrameHost* rfh) {
|
|
@@ -509,8 +509,8 @@ index 97847278fc73e3a8fc80bef1bfbea5a9d0497b36..9f0e7a1e8b7e0c22623d6f681ebcd6b5
|
|
|
|
|
|
for (auto& observer : GetTestObservers()) {
|
|
|
observer.OnPrintNow(rfh);
|
|
|
-@@ -1277,7 +1360,7 @@ void PrintViewManagerBase::CompleteScriptedPrintAfterContentAnalysis(
|
|
|
- set_analyzing_content(/*analyzing*/ false);
|
|
|
+@@ -1327,7 +1410,7 @@ void PrintViewManagerBase::CompleteScriptedPrintAfterContentAnalysis(
|
|
|
+ set_analyzing_content(/*analyzing=*/false);
|
|
|
if (!allowed || !printing_rfh_ || IsCrashed() ||
|
|
|
!printing_rfh_->IsRenderFrameLive()) {
|
|
|
- std::move(callback).Run(nullptr);
|
|
@@ -519,7 +519,7 @@ index 97847278fc73e3a8fc80bef1bfbea5a9d0497b36..9f0e7a1e8b7e0c22623d6f681ebcd6b5
|
|
|
}
|
|
|
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 fcee7b58a8eebd9fc044bab51a5d0e540de0de7d..160b5a6ad2d5cb6e0292f9ff1d16ee556d950880 100644
|
|
|
+index 78c9218049835cafdc9a0d7719bc073a81432c81..f233546a63a3b0f3531042b055a0011cc1980958 100644
|
|
|
--- a/chrome/browser/printing/print_view_manager_base.h
|
|
|
+++ b/chrome/browser/printing/print_view_manager_base.h
|
|
|
@@ -47,6 +47,8 @@ namespace printing {
|
|
@@ -569,7 +569,7 @@ index fcee7b58a8eebd9fc044bab51a5d0e540de0de7d..160b5a6ad2d5cb6e0292f9ff1d16ee55
|
|
|
protected:
|
|
|
explicit PrintViewManagerBase(content::WebContents* web_contents);
|
|
|
|
|
|
-@@ -275,6 +290,7 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
|
|
|
+@@ -285,6 +300,7 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
|
|
|
bool success);
|
|
|
#endif
|
|
|
void CompleteUpdatePrintSettings(
|
|
@@ -577,7 +577,7 @@ index fcee7b58a8eebd9fc044bab51a5d0e540de0de7d..160b5a6ad2d5cb6e0292f9ff1d16ee55
|
|
|
base::Value::Dict job_settings,
|
|
|
std::unique_ptr<PrintSettings> print_settings,
|
|
|
UpdatePrintSettingsCallback callback);
|
|
|
-@@ -304,7 +320,8 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
|
|
|
+@@ -320,7 +336,8 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
|
|
|
// Runs `callback` with `params` to reply to ScriptedPrint().
|
|
|
void ScriptedPrintReply(ScriptedPrintCallback callback,
|
|
|
int process_id,
|
|
@@ -587,7 +587,7 @@ index fcee7b58a8eebd9fc044bab51a5d0e540de0de7d..160b5a6ad2d5cb6e0292f9ff1d16ee55
|
|
|
|
|
|
// 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
|
|
|
-@@ -374,8 +391,11 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
|
|
|
+@@ -401,8 +418,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;
|
|
|
|
|
@@ -680,10 +680,10 @@ index ca71560874a0189068dd11fbc039f5673bf6bd96..a8551d95e64da2afbc1685b2df8f1fc3
|
|
|
mojom::PrintFailureReason reason) override;
|
|
|
|
|
|
diff --git a/components/printing/common/print.mojom b/components/printing/common/print.mojom
|
|
|
-index c97825d05cb7d132c9af489998f4ed8c32603c00..fde20b8a6c4811ce728abfee26b2ab7b53027a94 100644
|
|
|
+index c46e272beafd30a089b06d0920f0e94d8736b81b..b5d61250dc58d20e9c17958ac26a519b7c888ccc 100644
|
|
|
--- a/components/printing/common/print.mojom
|
|
|
+++ b/components/printing/common/print.mojom
|
|
|
-@@ -296,7 +296,7 @@ union PrintWithParamsResult {
|
|
|
+@@ -302,7 +302,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.
|
|
@@ -692,7 +692,7 @@ index c97825d05cb7d132c9af489998f4ed8c32603c00..fde20b8a6c4811ce728abfee26b2ab7b
|
|
|
|
|
|
// Requests the frame to be printed with specified parameters. This is used
|
|
|
// to programmatically produce PDF by request from the browser (e.g. over
|
|
|
-@@ -390,7 +390,10 @@ interface PrintManagerHost {
|
|
|
+@@ -396,7 +396,10 @@ interface PrintManagerHost {
|
|
|
// UI to the user to select the final print settings. If the user cancels or
|
|
|
// an error occurs, return null.
|
|
|
[Sync]
|
|
@@ -705,7 +705,7 @@ index c97825d05cb7d132c9af489998f4ed8c32603c00..fde20b8a6c4811ce728abfee26b2ab7b
|
|
|
// 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 59c7a51279bdb703a84c13154a810f268062c345..a1e9f3e25589bc6436b18a550609ad2997824a27 100644
|
|
|
+index bc7a6f8d4fb1778af3b56f2c336e8941567ad4a7..d7811ae12c6828ecbe28824a46c139e0b645513a 100644
|
|
|
--- a/components/printing/renderer/print_render_frame_helper.cc
|
|
|
+++ b/components/printing/renderer/print_render_frame_helper.cc
|
|
|
@@ -46,6 +46,7 @@
|
|
@@ -716,7 +716,7 @@ index 59c7a51279bdb703a84c13154a810f268062c345..a1e9f3e25589bc6436b18a550609ad29
|
|
|
#include "printing/units.h"
|
|
|
#include "services/metrics/public/cpp/ukm_source_id.h"
|
|
|
#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
|
|
|
-@@ -1382,7 +1383,8 @@ void PrintRenderFrameHelper::ScriptedPrint(bool user_initiated) {
|
|
|
+@@ -1384,7 +1385,8 @@ void PrintRenderFrameHelper::ScriptedPrint(bool user_initiated) {
|
|
|
if (!weak_this)
|
|
|
return;
|
|
|
|
|
@@ -726,7 +726,7 @@ index 59c7a51279bdb703a84c13154a810f268062c345..a1e9f3e25589bc6436b18a550609ad29
|
|
|
if (!weak_this)
|
|
|
return;
|
|
|
|
|
|
-@@ -1414,7 +1416,7 @@ void PrintRenderFrameHelper::BindPrintRenderFrameReceiver(
|
|
|
+@@ -1416,7 +1418,7 @@ void PrintRenderFrameHelper::BindPrintRenderFrameReceiver(
|
|
|
receivers_.Add(this, std::move(receiver));
|
|
|
}
|
|
|
|
|
@@ -735,7 +735,7 @@ index 59c7a51279bdb703a84c13154a810f268062c345..a1e9f3e25589bc6436b18a550609ad29
|
|
|
ScopedIPC scoped_ipc(weak_ptr_factory_.GetWeakPtr());
|
|
|
if (ipc_nesting_level_ > kAllowedIpcDepthForPrint)
|
|
|
return;
|
|
|
-@@ -1430,7 +1432,7 @@ void PrintRenderFrameHelper::PrintRequestedPages() {
|
|
|
+@@ -1432,7 +1434,7 @@ void PrintRenderFrameHelper::PrintRequestedPages() {
|
|
|
// plugin node and print that instead.
|
|
|
auto plugin = delegate_->GetPdfElement(frame);
|
|
|
|
|
@@ -744,7 +744,7 @@ index 59c7a51279bdb703a84c13154a810f268062c345..a1e9f3e25589bc6436b18a550609ad29
|
|
|
|
|
|
if (!render_frame_gone_) {
|
|
|
RecordBeforeAfterPrintEventForDebugging(__LINE__);
|
|
|
-@@ -1514,7 +1516,8 @@ void PrintRenderFrameHelper::PrintForSystemDialog() {
|
|
|
+@@ -1516,7 +1518,8 @@ void PrintRenderFrameHelper::PrintForSystemDialog() {
|
|
|
}
|
|
|
|
|
|
Print(frame, print_preview_context_.source_node(),
|
|
@@ -754,7 +754,7 @@ index 59c7a51279bdb703a84c13154a810f268062c345..a1e9f3e25589bc6436b18a550609ad29
|
|
|
if (!render_frame_gone_) {
|
|
|
RecordBeforeAfterPrintEventForDebugging(__LINE__);
|
|
|
print_preview_context_.DispatchAfterPrintEvent();
|
|
|
-@@ -1567,6 +1570,8 @@ void PrintRenderFrameHelper::PrintPreview(base::Value::Dict settings) {
|
|
|
+@@ -1570,6 +1573,8 @@ void PrintRenderFrameHelper::PrintPreview(base::Value::Dict settings) {
|
|
|
if (ipc_nesting_level_ > kAllowedIpcDepthForPrint)
|
|
|
return;
|
|
|
|
|
@@ -763,7 +763,7 @@ index 59c7a51279bdb703a84c13154a810f268062c345..a1e9f3e25589bc6436b18a550609ad29
|
|
|
print_preview_context_.OnPrintPreview();
|
|
|
|
|
|
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
|
|
-@@ -2183,7 +2188,8 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) {
|
|
|
+@@ -2193,7 +2198,8 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) {
|
|
|
return;
|
|
|
|
|
|
Print(duplicate_node.GetDocument().GetFrame(), duplicate_node,
|
|
@@ -773,7 +773,7 @@ index 59c7a51279bdb703a84c13154a810f268062c345..a1e9f3e25589bc6436b18a550609ad29
|
|
|
// Check if |this| is still valid.
|
|
|
if (!weak_this)
|
|
|
return;
|
|
|
-@@ -2199,7 +2205,9 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) {
|
|
|
+@@ -2209,7 +2215,9 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) {
|
|
|
|
|
|
void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame,
|
|
|
const blink::WebNode& node,
|
|
@@ -784,16 +784,16 @@ index 59c7a51279bdb703a84c13154a810f268062c345..a1e9f3e25589bc6436b18a550609ad29
|
|
|
// If still not finished with earlier print request simply ignore.
|
|
|
if (prep_frame_view_)
|
|
|
return;
|
|
|
-@@ -2207,7 +2215,7 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame,
|
|
|
+@@ -2217,7 +2225,7 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame,
|
|
|
FrameReference frame_ref(frame);
|
|
|
|
|
|
uint32_t expected_page_count = 0;
|
|
|
- if (!CalculateNumberOfPages(frame, node, &expected_page_count)) {
|
|
|
+ if (!CalculateNumberOfPages(frame, node, &expected_page_count, std::move(settings))) {
|
|
|
- DidFinishPrinting(FAIL_PRINT_INIT);
|
|
|
+ DidFinishPrinting(PrintingResult::kFailPrintInit);
|
|
|
return; // Failed to init print page settings.
|
|
|
}
|
|
|
-@@ -2226,8 +2234,15 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame,
|
|
|
+@@ -2236,8 +2244,15 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame,
|
|
|
print_pages_params_->params->print_scaling_option;
|
|
|
|
|
|
auto self = weak_ptr_factory_.GetWeakPtr();
|
|
@@ -810,7 +810,7 @@ index 59c7a51279bdb703a84c13154a810f268062c345..a1e9f3e25589bc6436b18a550609ad29
|
|
|
// Check if |this| is still valid.
|
|
|
if (!self)
|
|
|
return;
|
|
|
-@@ -2460,35 +2475,47 @@ void PrintRenderFrameHelper::IPCProcessed() {
|
|
|
+@@ -2480,35 +2495,47 @@ void PrintRenderFrameHelper::IPCProcessed() {
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -868,7 +868,7 @@ index 59c7a51279bdb703a84c13154a810f268062c345..a1e9f3e25589bc6436b18a550609ad29
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
-@@ -2592,7 +2619,7 @@ mojom::PrintPagesParamsPtr PrintRenderFrameHelper::GetPrintSettingsFromUser(
|
|
|
+@@ -2613,7 +2640,7 @@ mojom::PrintPagesParamsPtr PrintRenderFrameHelper::GetPrintSettingsFromUser(
|
|
|
std::move(params),
|
|
|
base::BindOnce(
|
|
|
[](base::OnceClosure quit_closure, mojom::PrintPagesParamsPtr* output,
|
|
@@ -878,7 +878,7 @@ index 59c7a51279bdb703a84c13154a810f268062c345..a1e9f3e25589bc6436b18a550609ad29
|
|
|
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 0fea424325081a0ef6720000841ea321b89024d0..c700de4b81fc0c157946e76faedaca6b59aeac0c 100644
|
|
|
+index 54241ff910b7198761fd76a21e4fe4bd42cc7ce2..51735091523fdd208b2c799a1c7910fdcc703e44 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
|
|
@@ -919,10 +919,10 @@ index 0fea424325081a0ef6720000841ea321b89024d0..c700de4b81fc0c157946e76faedaca6b
|
|
|
#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 e83a8746c00800ef8236a696ea1052a76ae6b2fb..183c520baa855d3065f34f3bc90c8c590237192c 100644
|
|
|
+index 904c0ef40a0fa23e0f3b7d0023e6418500ce45e9..88eca71122353752154a29e4f54693c3ac13f930 100644
|
|
|
--- a/content/browser/BUILD.gn
|
|
|
+++ b/content/browser/BUILD.gn
|
|
|
-@@ -2913,8 +2913,9 @@ source_set("browser") {
|
|
|
+@@ -2916,8 +2916,9 @@ source_set("browser") {
|
|
|
"//ppapi/shared_impl",
|
|
|
]
|
|
|
|