Skip to content
This repository has been archived by the owner on Oct 30, 2023. It is now read-only.

Commit

Permalink
fix: delegate to PrintViewManagerBase on failed print (electron#34893)
Browse files Browse the repository at this point in the history
fix: delegate to PrintViewManagerBase on failed print
  • Loading branch information
codebytere authored and khalwa committed Feb 22, 2023
1 parent 5afbefa commit b7540e5
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions shell/browser/printing/print_view_manager_electron.cc
Expand Up @@ -163,12 +163,23 @@ void PrintViewManagerElectron::ScriptedPrint(
}

void PrintViewManagerElectron::ShowInvalidPrinterSettingsError() {
if (headless_jobs_.size() == 0) {
PrintViewManagerBase::ShowInvalidPrinterSettingsError();
return;
}

ReleaseJob(INVALID_PRINTER_SETTINGS);
}

void PrintViewManagerElectron::PrintingFailed(
int32_t cookie,
printing::mojom::PrintFailureReason reason) {
auto entry = std::find(headless_jobs_.begin(), headless_jobs_.end(), cookie);
if (entry == headless_jobs_.end()) {
PrintViewManagerBase::PrintingFailed(cookie, reason);
return;
}

ReleaseJob(reason == printing::mojom::PrintFailureReason::kInvalidPageRange
? PAGE_COUNT_EXCEEDED
: PRINTING_FAILED);
Expand Down

0 comments on commit b7540e5

Please sign in to comment.