Commit ca91319f authored by Sean Kau's avatar Sean Kau Committed by Commit Bot

Fix invalid call to on-manually-add-discovered-printer.

on-manually-add-discovered-printer was being called with invalid
parameters.  Refactor so it's easier to call properly and fix
the bad callsite.

Observed behavior was that the setup dialog would close without
any messaging.  User is prompted for a PPD now.

Bug: 835476
Change-Id: I85ae96cf1f9638098cd819fccb47b30e16274a58
Reviewed-on: https://chromium-review.googlesource.com/1023040
Commit-Queue: Sean Kau <skau@chromium.org>
Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Reviewed-by: default avatarXiaoqian Dai <xdai@chromium.org>
Cr-Commit-Position: refs/heads/master@{#553827}
parent 391985f9
......@@ -408,8 +408,7 @@ void CupsPrintersHandler::OnAutoconfQueriedDiscovered(
// We don't have enough from discovery to configure the printer. Fill in as
// much information as we can about the printer, and ask the user to supply
// the rest.
FireWebUIListener("on-manually-add-discovered-printer",
*GetCupsPrinterInfo(*printer));
FireManuallyAddDiscoveredPrinter(*printer);
}
void CupsPrintersHandler::OnAutoconfQueried(const std::string& callback_id,
......@@ -581,9 +580,9 @@ void CupsPrintersHandler::OnAddedDiscoveredPrinter(
FireWebUIListener("on-add-cups-printer", base::Value(result_code),
base::Value(printer.display_name()));
} else {
FireWebUIListener("on-manually-add-discovered-printer",
base::Value(result_code == PrinterSetupResult::kSuccess),
base::Value(printer.display_name()));
// TODO(crubg.com/836434): Log in printer log.
// Could not set up printer. Asking user for manufacturer data.
FireManuallyAddDiscoveredPrinter(printer);
}
}
......@@ -824,8 +823,7 @@ void CupsPrintersHandler::HandleAddDiscoveredPrinter(
weak_factory_.GetWeakPtr(), base::Passed(&printer)));
} else {
// If it's not an IPP printer, the user must choose a PPD.
FireWebUIListener("on-manually-add-discovered-printer",
*GetCupsPrinterInfo(*printer));
FireManuallyAddDiscoveredPrinter(*printer);
}
}
......@@ -865,5 +863,11 @@ void CupsPrintersHandler::OnGetPrinterPpdManufacturerAndModel(
ResolveJavascriptCallback(base::Value(callback_id), info);
}
void CupsPrintersHandler::FireManuallyAddDiscoveredPrinter(
const Printer& printer) {
FireWebUIListener("on-manually-add-discovered-printer",
*GetCupsPrinterInfo(printer));
}
} // namespace settings
} // namespace chromeos
......@@ -152,6 +152,10 @@ class CupsPrintersHandler : public ::settings::SettingsPageUIHandler,
void VerifyPpdContents(const base::FilePath& path,
const std::string& contents);
// Fires the on-manually-add-discovered-printer event with the appropriate
// parameters. See https://crbug.com/835476
void FireManuallyAddDiscoveredPrinter(const Printer& printer);
Profile* profile_;
// Discovery support. discovery_active_ tracks whether or not the UI
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment