Chromium Code Reviews| Index: chrome/browser/chromeos/printing/specifics_translation.cc |
| diff --git a/chrome/browser/chromeos/printing/specifics_translation.cc b/chrome/browser/chromeos/printing/specifics_translation.cc |
| index 4719092f42219221ea3a5c14088d49f8ac1bcb41..2829cd154c865f6699bf7c00eedff225cca0922c 100644 |
| --- a/chrome/browser/chromeos/printing/specifics_translation.cc |
| +++ b/chrome/browser/chromeos/printing/specifics_translation.cc |
| @@ -8,6 +8,8 @@ |
| #include "base/logging.h" |
| #include "base/memory/ptr_util.h" |
| +#include "base/strings/string_piece.h" |
| +#include "base/strings/string_util.h" |
| #include "base/time/time.h" |
| #include "chrome/browser/chromeos/printing/specifics_translation.h" |
| #include "chromeos/printing/printer_configuration.h" |
| @@ -49,6 +51,11 @@ void MergeReferenceToSpecifics(sync_pb::PrinterPPDReference* specifics, |
| } |
| } |
| +std::string MakeAndModel(base::StringPiece make, base::StringPiece model) { |
|
Carlson
2017/06/28 17:38:36
Function comment. Also, I'm not 100% sure this wi
skau
2017/06/28 21:25:35
I think it's a small enough subset. Mostly, I'm t
|
| + return model.starts_with(make) ? model.as_string() |
| + : base::JoinString({make, model}, " "); |
| +} |
| + |
| } // namespace |
| std::unique_ptr<Printer> SpecificsToPrinter( |
| @@ -61,6 +68,12 @@ std::unique_ptr<Printer> SpecificsToPrinter( |
| printer->set_description(specifics.description()); |
| printer->set_manufacturer(specifics.manufacturer()); |
| printer->set_model(specifics.model()); |
| + if (!specifics.make_and_model().empty()) { |
| + printer->set_make_and_model(specifics.make_and_model()); |
| + } else { |
| + printer->set_make_and_model( |
| + MakeAndModel(specifics.manufacturer(), specifics.model())); |
| + } |
| printer->set_uri(specifics.uri()); |
| printer->set_uuid(specifics.uuid()); |
| @@ -96,6 +109,9 @@ void MergePrinterToSpecifics(const Printer& printer, |
| if (!printer.model().empty()) |
| specifics->set_model(printer.model()); |
| + if (!printer.make_and_model().empty()) |
| + specifics->set_make_and_model(printer.make_and_model()); |
| + |
| if (!printer.uri().empty()) |
| specifics->set_uri(printer.uri()); |