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

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: rebase Created 4 years, 1 month 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
« no previous file with comments | « no previous file | chromeos/printing/printer_configuration.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 fb7ebb240c5b863c6ebccd761107c89ad7883f50..4eb854f2edc073adcd9fd65a3e10d71fb32906ca 100644
--- a/chrome/browser/ui/webui/settings/chromeos/cups_printers_handler.cc
+++ b/chrome/browser/ui/webui/settings/chromeos/cups_printers_handler.cc
@@ -204,20 +204,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,
« no previous file with comments | « no previous file | chromeos/printing/printer_configuration.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698