Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2104)

Unified Diff: chrome/browser/ui/webui/settings/chromeos/cups_printers_handler.cc

Issue 2459943002: Use printer id to populate CUPS instead of printer name. (Closed)
Patch Set: proof Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/settings/chromeos/cups_printers_handler.cc
diff --git a/chrome/browser/ui/webui/settings/chromeos/cups_printers_handler.cc b/chrome/browser/ui/webui/settings/chromeos/cups_printers_handler.cc
index 53abf17f57a789dd8557d4a025240a51e3893979..4d4332551a3569fcf59a05e0339e9021640e5c76 100644
--- a/chrome/browser/ui/webui/settings/chromeos/cups_printers_handler.cc
+++ b/chrome/browser/ui/webui/settings/chromeos/cups_printers_handler.cc
@@ -182,20 +182,28 @@ void CupsPrintersHandler::HandleAddCupsPrinter(const base::ListValue* args) {
std::string printer_uri =
printer_protocol + "://" + printer_address + "/" + printer_queue;
- std::unique_ptr<Printer> printer = base::MakeUnique<Printer>();
- printer->set_id(printer_id);
+ std::unique_ptr<Printer> printer = base::MakeUnique<Printer>(printer_id);
+ printer_id = printer->id();
printer->set_display_name(printer_name);
printer->set_description(printer_description);
printer->set_manufacturer(printer_manufacturer);
printer->set_model(printer_model);
printer->set_uri(printer_uri);
+ if (!printer_ppd_path.empty()) {
+ printer->mutable_ppd_reference()->user_supplied_ppd_url = printer_ppd_path;
+ } else if (!printer_manufacturer.empty() && !printer_model.empty()) {
+ Printer::PpdReference* ppd = printer->mutable_ppd_reference();
+ ppd->effective_manufacturer = printer_manufacturer;
+ ppd->effective_model = printer_model;
+ }
chromeos::DebugDaemonClient* client =
chromeos::DBusThreadManager::Get()->GetDebugDaemonClient();
client->CupsAddPrinter(
- printer_name, printer_uri,
- printer_ppd_path,
- printer_ppd_path.empty() ? true : false, // ipp everywhere
+ printer_id, // record id
+ printer_uri, // uri
+ printer_ppd_path, // ppd location
+ printer_ppd_path.empty() ? true : false, // ipp everywhere
base::Bind(&CupsPrintersHandler::OnAddedPrinter,
weak_factory_.GetWeakPtr(), base::Passed(std::move(printer))),
base::Bind(&CupsPrintersHandler::OnAddPrinterError,

Powered by Google App Engine
This is Rietveld 408576698