Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions patches/chromium/printing.patch
Original file line number Diff line number Diff line change
Expand Up @@ -614,13 +614,13 @@
+ result_code = printing_context_->UpdatePrintSettings(std::move(new_settings));
+ InvokeSettingsCallback(std::move(callback), result_code);
}
-

Check failure on line 617 in patches/chromium/printing.patch

View check run for this annotation

trop / Backportable? - 41-x-y

patches/chromium/printing.patch#L617

Patch Conflict
Raw output
++<<<<<<< HEAD
 +index 0dd564edd45425c75830f5e078f6fb375d10460b..61e0af99682502056f77426f6d17ee33463df6ae 100644
++=======
+ index dc2a15ab4d784b0b6c85b84a30c3c08a17ed8e3d..5ca7920c8525c3c72fd96b14709fb35a9cc28daf 100644
++>>>>>>> fix: avoid crash in window.print() when prefilling native print dialog

Check failure on line 617 in patches/chromium/printing.patch

View check run for this annotation

trop / Backportable? - 41-x-y

patches/chromium/printing.patch#L617

Patch Conflict
Raw output
++<<<<<<< HEAD
 +index 0dd564edd45425c75830f5e078f6fb375d10460b..61e0af99682502056f77426f6d17ee33463df6ae 100644
++=======
+ index dc2a15ab4d784b0b6c85b84a30c3c08a17ed8e3d..5ca7920c8525c3c72fd96b14709fb35a9cc28daf 100644
++>>>>>>> fix: avoid crash in window.print() when prefilling native print dialog

Check failure on line 617 in patches/chromium/printing.patch

View check run for this annotation

trop / Backportable? - 41-x-y

patches/chromium/printing.patch#L617

Patch Conflict
Raw output
++<<<<<<< HEAD
 +index 0dd564edd45425c75830f5e078f6fb375d10460b..61e0af99682502056f77426f6d17ee33463df6ae 100644
++=======
+ index dc2a15ab4d784b0b6c85b84a30c3c08a17ed8e3d..5ca7920c8525c3c72fd96b14709fb35a9cc28daf 100644
++>>>>>>> fix: avoid crash in `window.print()` when prefilling native print dialog (#50843)
- InvokeSettingsCallback(std::move(callback), result);
}

#if BUILDFLAG(IS_CHROMEOS)
diff --git a/chrome/browser/printing/printer_query_oop.cc b/chrome/browser/printing/printer_query_oop.cc
index dc2a15ab4d784b0b6c85b84a30c3c08a17ed8e3d..e197026e8a7f132c1bf90a0f5f1eabb4f5f064ee 100644
index dc2a15ab4d784b0b6c85b84a30c3c08a17ed8e3d..5ca7920c8525c3c72fd96b14709fb35a9cc28daf 100644
--- a/chrome/browser/printing/printer_query_oop.cc
+++ b/chrome/browser/printing/printer_query_oop.cc
@@ -126,7 +126,7 @@ void PrinterQueryOop::OnDidAskUserForSettings(
Expand All @@ -632,7 +632,7 @@
// Want the same PrintBackend service as the query so that we use the same
// device context.
print_document_client_id_ =
@@ -189,6 +189,21 @@ void PrinterQueryOop::GetSettingsWithUI(uint32_t document_page_count,
@@ -189,6 +189,28 @@ void PrinterQueryOop::GetSettingsWithUI(uint32_t document_page_count,
// browser process.
// - Other platforms don't have a system print UI or do not use OOP
// printing, so this does not matter.
Expand All @@ -643,12 +643,19 @@
+ // remote service context, not the local one used by the native dialog.
+ if (settings().dpi()) {
+ printing_context()->SetPrintSettings(settings());
+ printing_context()->UpdatePrinterSettings(PrintingContext::PrinterSettings{
+ if (printing_context()->UpdatePrinterSettings(
+ PrintingContext::PrinterSettings{
+#if BUILDFLAG(IS_MAC)
+ .external_preview = false,
+ .external_preview = false,
+#endif
+ .show_system_dialog = false,
+ });
+ .show_system_dialog = false,
+ }) != mojom::ResultCode::kSuccess) {
+ // Prefilling failed (e.g. the printer does not support the requested
+ // resolution). Reinitialize with defaults so that AskUserForSettings
+ // does not crash due to a null print_info_. The dialog will simply
+ // open without prefilled values.
+ printing_context()->UseDefaultSettings();
+ }
+ }
+
PrinterQuery::GetSettingsWithUI(
Expand Down
Loading