|
@@ -91,7 +91,7 @@ index 163eacc8bb6654880d37111923a87ea5a6134485..565258e9bd4cc52e347e1f4a72ee29ec
|
|
|
: 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 e53414c7288f087a6d9ae47c8e96b516430e5419..3084546bee021eb2752335b8d31d48d28a6e5af1 100644
|
|
|
+index 5c2be309159b3f7c67601a08366b5221c198a1fb..10ceb545e5ff98b36c57d23584e701ba0e2c752e 100644
|
|
|
--- a/chrome/browser/printing/print_view_manager_base.cc
|
|
|
+++ b/chrome/browser/printing/print_view_manager_base.cc
|
|
|
@@ -87,6 +87,20 @@ namespace printing {
|
|
@@ -234,7 +234,17 @@ index e53414c7288f087a6d9ae47c8e96b516430e5419..3084546bee021eb2752335b8d31d48d2
|
|
|
set_cookie(settings->params->document_cookie);
|
|
|
std::move(callback).Run(std::move(settings));
|
|
|
}
|
|
|
-@@ -440,7 +466,7 @@ void PrintViewManagerBase::StartLocalPrintJob(
|
|
|
+@@ -412,7 +438,9 @@ void PrintViewManagerBase::OnPrintSettingsDone(
|
|
|
+ UnregisterSystemPrintClient();
|
|
|
+ }
|
|
|
+ #endif
|
|
|
++#if 0 // Electron does not use Chromium error dialogs
|
|
|
+ ShowPrintErrorDialogForGenericError();
|
|
|
++#endif
|
|
|
+ std::move(callback).Run(base::Value("Update settings failed"));
|
|
|
+ return;
|
|
|
+ }
|
|
|
+@@ -441,7 +469,7 @@ void PrintViewManagerBase::StartLocalPrintJob(
|
|
|
PrinterHandler::PrintCallback callback) {
|
|
|
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
|
|
|
|
@@ -243,7 +253,7 @@ index e53414c7288f087a6d9ae47c8e96b516430e5419..3084546bee021eb2752335b8d31d48d2
|
|
|
// Populating `content_analysis_before_printing_document_` if needed should be
|
|
|
// done first in this function's workflow, this way other code can check if
|
|
|
// content analysis is going to happen and delay starting `print_job_` to
|
|
|
-@@ -673,7 +699,7 @@ void PrintViewManagerBase::GetDefaultPrintSettings(
|
|
|
+@@ -674,7 +702,7 @@ void PrintViewManagerBase::GetDefaultPrintSettings(
|
|
|
|
|
|
#if BUILDFLAG(ENABLE_OOP_PRINTING)
|
|
|
if (ShouldPrintJobOop() &&
|
|
@@ -252,7 +262,7 @@ index e53414c7288f087a6d9ae47c8e96b516430e5419..3084546bee021eb2752335b8d31d48d2
|
|
|
!analyzing_content_ &&
|
|
|
#endif
|
|
|
!query_with_ui_client_id().has_value()) {
|
|
|
-@@ -701,7 +727,7 @@ void PrintViewManagerBase::GetDefaultPrintSettings(
|
|
|
+@@ -702,7 +730,7 @@ void PrintViewManagerBase::GetDefaultPrintSettings(
|
|
|
|
|
|
// Sometimes it is desired to get the PDF settings as opposed to the settings
|
|
|
// of the default system print driver.
|
|
@@ -261,7 +271,7 @@ index e53414c7288f087a6d9ae47c8e96b516430e5419..3084546bee021eb2752335b8d31d48d2
|
|
|
bool want_pdf_settings = analyzing_content_;
|
|
|
#else
|
|
|
bool want_pdf_settings = false;
|
|
|
-@@ -745,10 +771,7 @@ void PrintViewManagerBase::UpdatePrintSettings(
|
|
|
+@@ -746,10 +774,7 @@ void PrintViewManagerBase::UpdatePrintSettings(
|
|
|
// `job_settings` does not yet contain the rasterized PDF dpi, so if the user
|
|
|
// has the print preference set, fetch it for use in
|
|
|
// `PrintSettingsFromJobSettings()`.
|
|
@@ -273,7 +283,7 @@ index e53414c7288f087a6d9ae47c8e96b516430e5419..3084546bee021eb2752335b8d31d48d2
|
|
|
if (prefs && prefs->HasPrefPath(prefs::kPrintRasterizePdfDpi)) {
|
|
|
int value = prefs->GetInteger(prefs::kPrintRasterizePdfDpi);
|
|
|
if (value > 0)
|
|
|
-@@ -773,8 +796,22 @@ void PrintViewManagerBase::UpdatePrintSettings(
|
|
|
+@@ -774,8 +799,22 @@ void PrintViewManagerBase::UpdatePrintSettings(
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -298,7 +308,7 @@ index e53414c7288f087a6d9ae47c8e96b516430e5419..3084546bee021eb2752335b8d31d48d2
|
|
|
// fully available from `PrintBackend::GetPrinterSemanticCapsAndDefaults()`
|
|
|
// for in-browser queries.
|
|
|
if (printer_type == mojom::PrinterType::kLocal) {
|
|
|
-@@ -795,8 +832,6 @@ void PrintViewManagerBase::UpdatePrintSettings(
|
|
|
+@@ -796,8 +835,6 @@ void PrintViewManagerBase::UpdatePrintSettings(
|
|
|
}
|
|
|
#endif
|
|
|
|
|
@@ -307,7 +317,7 @@ index e53414c7288f087a6d9ae47c8e96b516430e5419..3084546bee021eb2752335b8d31d48d2
|
|
|
}
|
|
|
|
|
|
void PrintViewManagerBase::SetAccessibilityTree(
|
|
|
-@@ -812,7 +847,7 @@ void PrintViewManagerBase::SetAccessibilityTree(
|
|
|
+@@ -813,7 +850,7 @@ void PrintViewManagerBase::SetAccessibilityTree(
|
|
|
void PrintViewManagerBase::IsPrintingEnabled(
|
|
|
IsPrintingEnabledCallback callback) {
|
|
|
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
|
@@ -316,7 +326,7 @@ index e53414c7288f087a6d9ae47c8e96b516430e5419..3084546bee021eb2752335b8d31d48d2
|
|
|
}
|
|
|
|
|
|
void PrintViewManagerBase::ScriptedPrint(mojom::ScriptedPrintParamsPtr params,
|
|
|
-@@ -838,7 +873,7 @@ void PrintViewManagerBase::ScriptedPrint(mojom::ScriptedPrintParamsPtr params,
|
|
|
+@@ -839,7 +876,7 @@ void PrintViewManagerBase::ScriptedPrint(mojom::ScriptedPrintParamsPtr params,
|
|
|
return;
|
|
|
}
|
|
|
#endif
|
|
@@ -325,7 +335,7 @@ index e53414c7288f087a6d9ae47c8e96b516430e5419..3084546bee021eb2752335b8d31d48d2
|
|
|
std::optional<enterprise_connectors::ContentAnalysisDelegate::Data>
|
|
|
scanning_data = enterprise_data_protection::GetPrintAnalysisData(
|
|
|
web_contents(), enterprise_data_protection::PrintScanningContext::
|
|
|
-@@ -868,11 +903,9 @@ void PrintViewManagerBase::PrintingFailed(int32_t cookie,
|
|
|
+@@ -869,11 +906,9 @@ void PrintViewManagerBase::PrintingFailed(int32_t cookie,
|
|
|
// destroyed. In such cases the error notification to the user will
|
|
|
// have already been displayed, and a second message should not be
|
|
|
// shown.
|
|
@@ -339,7 +349,7 @@ index e53414c7288f087a6d9ae47c8e96b516430e5419..3084546bee021eb2752335b8d31d48d2
|
|
|
ReleasePrinterQuery();
|
|
|
}
|
|
|
|
|
|
-@@ -884,15 +917,24 @@ void PrintViewManagerBase::RemoveTestObserver(TestObserver& observer) {
|
|
|
+@@ -885,15 +920,24 @@ void PrintViewManagerBase::RemoveTestObserver(TestObserver& observer) {
|
|
|
test_observers_.RemoveObserver(&observer);
|
|
|
}
|
|
|
|
|
@@ -364,7 +374,7 @@ index e53414c7288f087a6d9ae47c8e96b516430e5419..3084546bee021eb2752335b8d31d48d2
|
|
|
}
|
|
|
|
|
|
void PrintViewManagerBase::RenderFrameDeleted(
|
|
|
-@@ -940,7 +982,7 @@ void PrintViewManagerBase::SystemDialogCancelled() {
|
|
|
+@@ -941,7 +985,7 @@ void PrintViewManagerBase::SystemDialogCancelled() {
|
|
|
#endif
|
|
|
|
|
|
bool PrintViewManagerBase::GetPrintingEnabledBooleanPref() const {
|
|
@@ -373,7 +383,7 @@ index e53414c7288f087a6d9ae47c8e96b516430e5419..3084546bee021eb2752335b8d31d48d2
|
|
|
}
|
|
|
|
|
|
void PrintViewManagerBase::OnDocDone(int job_id, PrintedDocument* document) {
|
|
|
-@@ -957,7 +999,12 @@ void PrintViewManagerBase::OnJobDone() {
|
|
|
+@@ -958,7 +1002,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.
|
|
@@ -387,7 +397,7 @@ index e53414c7288f087a6d9ae47c8e96b516430e5419..3084546bee021eb2752335b8d31d48d2
|
|
|
ReleasePrintJob();
|
|
|
}
|
|
|
|
|
|
-@@ -966,9 +1013,9 @@ void PrintViewManagerBase::OnCanceling() {
|
|
|
+@@ -967,9 +1016,9 @@ void PrintViewManagerBase::OnCanceling() {
|
|
|
}
|
|
|
|
|
|
void PrintViewManagerBase::OnFailed() {
|
|
@@ -399,7 +409,7 @@ index e53414c7288f087a6d9ae47c8e96b516430e5419..3084546bee021eb2752335b8d31d48d2
|
|
|
TerminatePrintJob(true);
|
|
|
}
|
|
|
|
|
|
-@@ -978,7 +1025,7 @@ bool PrintViewManagerBase::RenderAllMissingPagesNow() {
|
|
|
+@@ -979,7 +1028,7 @@ bool PrintViewManagerBase::RenderAllMissingPagesNow() {
|
|
|
|
|
|
// Is the document already complete?
|
|
|
if (print_job_->document() && print_job_->document()->IsComplete()) {
|
|
@@ -408,7 +418,7 @@ index e53414c7288f087a6d9ae47c8e96b516430e5419..3084546bee021eb2752335b8d31d48d2
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
-@@ -1031,7 +1078,10 @@ bool PrintViewManagerBase::SetupNewPrintJob(
|
|
|
+@@ -1032,7 +1081,10 @@ bool PrintViewManagerBase::SetupNewPrintJob(
|
|
|
|
|
|
// Disconnect the current `print_job_`.
|
|
|
auto weak_this = weak_ptr_factory_.GetWeakPtr();
|
|
@@ -420,7 +430,7 @@ index e53414c7288f087a6d9ae47c8e96b516430e5419..3084546bee021eb2752335b8d31d48d2
|
|
|
if (!weak_this)
|
|
|
return false;
|
|
|
|
|
|
-@@ -1051,7 +1101,7 @@ bool PrintViewManagerBase::SetupNewPrintJob(
|
|
|
+@@ -1052,7 +1104,7 @@ bool PrintViewManagerBase::SetupNewPrintJob(
|
|
|
#endif
|
|
|
print_job_->AddObserver(*this);
|
|
|
|
|
@@ -429,7 +439,7 @@ index e53414c7288f087a6d9ae47c8e96b516430e5419..3084546bee021eb2752335b8d31d48d2
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
-@@ -1109,7 +1159,7 @@ void PrintViewManagerBase::ReleasePrintJob() {
|
|
|
+@@ -1110,7 +1162,7 @@ void PrintViewManagerBase::ReleasePrintJob() {
|
|
|
// Ensure that any residual registration of printing client is released.
|
|
|
// This might be necessary in some abnormal cases, such as the associated
|
|
|
// render process having terminated.
|
|
@@ -438,7 +448,7 @@ index e53414c7288f087a6d9ae47c8e96b516430e5419..3084546bee021eb2752335b8d31d48d2
|
|
|
if (!analyzing_content_) {
|
|
|
UnregisterSystemPrintClient();
|
|
|
}
|
|
|
-@@ -1119,6 +1169,11 @@ void PrintViewManagerBase::ReleasePrintJob() {
|
|
|
+@@ -1120,6 +1172,11 @@ void PrintViewManagerBase::ReleasePrintJob() {
|
|
|
}
|
|
|
#endif
|
|
|
|
|
@@ -450,7 +460,7 @@ index e53414c7288f087a6d9ae47c8e96b516430e5419..3084546bee021eb2752335b8d31d48d2
|
|
|
if (!print_job_)
|
|
|
return;
|
|
|
|
|
|
-@@ -1126,7 +1181,7 @@ void PrintViewManagerBase::ReleasePrintJob() {
|
|
|
+@@ -1127,7 +1184,7 @@ void PrintViewManagerBase::ReleasePrintJob() {
|
|
|
// printing_rfh_ should only ever point to a RenderFrameHost with a live
|
|
|
// RenderFrame.
|
|
|
DCHECK(rfh->IsRenderFrameLive());
|
|
@@ -459,7 +469,7 @@ index e53414c7288f087a6d9ae47c8e96b516430e5419..3084546bee021eb2752335b8d31d48d2
|
|
|
}
|
|
|
|
|
|
print_job_->RemoveObserver(*this);
|
|
|
-@@ -1168,7 +1223,7 @@ bool PrintViewManagerBase::RunInnerMessageLoop() {
|
|
|
+@@ -1169,7 +1226,7 @@ bool PrintViewManagerBase::RunInnerMessageLoop() {
|
|
|
}
|
|
|
|
|
|
bool PrintViewManagerBase::OpportunisticallyCreatePrintJob(int cookie) {
|
|
@@ -468,7 +478,7 @@ index e53414c7288f087a6d9ae47c8e96b516430e5419..3084546bee021eb2752335b8d31d48d2
|
|
|
return true;
|
|
|
|
|
|
if (!cookie) {
|
|
|
-@@ -1191,7 +1246,7 @@ bool PrintViewManagerBase::OpportunisticallyCreatePrintJob(int cookie) {
|
|
|
+@@ -1192,7 +1249,7 @@ bool PrintViewManagerBase::OpportunisticallyCreatePrintJob(int cookie) {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
@@ -477,7 +487,7 @@ index e53414c7288f087a6d9ae47c8e96b516430e5419..3084546bee021eb2752335b8d31d48d2
|
|
|
// Don't start printing if enterprise checks are being performed to check if
|
|
|
// printing is allowed, or if content analysis is going to take place right
|
|
|
// before starting `print_job_`.
|
|
|
-@@ -1322,6 +1377,8 @@ void PrintViewManagerBase::CompleteScriptedPrint(
|
|
|
+@@ -1323,6 +1380,8 @@ void PrintViewManagerBase::CompleteScriptedPrint(
|
|
|
auto callback_wrapper = base::BindOnce(
|
|
|
&PrintViewManagerBase::ScriptedPrintReply, weak_ptr_factory_.GetWeakPtr(),
|
|
|
std::move(callback), render_process_host->GetID());
|
|
@@ -486,7 +496,7 @@ index e53414c7288f087a6d9ae47c8e96b516430e5419..3084546bee021eb2752335b8d31d48d2
|
|
|
#if BUILDFLAG(IS_WIN) && BUILDFLAG(GOOGLE_CHROME_BRANDING)
|
|
|
DisableThirdPartyBlocking();
|
|
|
#endif
|
|
|
-@@ -1336,10 +1393,10 @@ void PrintViewManagerBase::CompleteScriptedPrint(
|
|
|
+@@ -1337,10 +1396,10 @@ void PrintViewManagerBase::CompleteScriptedPrint(
|
|
|
params->expected_pages_count, params->has_selection, params->margin_type,
|
|
|
params->is_scripted, !render_process_host->IsPdf(),
|
|
|
base::BindOnce(&OnDidScriptedPrint, queue_, std::move(printer_query),
|