Chromium Code Reviews| Index: chrome/browser/ui/webui/print_preview/print_preview_handler.cc |
| diff --git a/chrome/browser/ui/webui/print_preview/print_preview_handler.cc b/chrome/browser/ui/webui/print_preview/print_preview_handler.cc |
| index 42a5088b10f5cbda5ad61163fe323596a27fd2b0..dcd1c3130b3c40fc38de941dc38c55ec45ab2503 100644 |
| --- a/chrome/browser/ui/webui/print_preview/print_preview_handler.cc |
| +++ b/chrome/browser/ui/webui/print_preview/print_preview_handler.cc |
| @@ -383,6 +383,11 @@ std::pair<std::string, std::string> GetPrinterNameAndDescription( |
| if (it != printer.options.end()) |
| real_description = it->second; |
| return std::make_pair(real_name, real_description); |
| +#elif defined(OS_CHROMEOS) |
| + // Display the display name. printer.printer_name contains the name |
| + // registered in CUPS which is not human readable. |
| + return std::make_pair(printer.printer_display_name, |
|
xdai1
2016/10/31 18:08:15
Where does printer_display_name come from? Seems t
skau
2016/11/02 22:08:35
printer_display_name is defined in the dependent p
|
| + printer.printer_description); |
| #else |
| return std::make_pair(printer.printer_name, printer.printer_description); |
| #endif |
| @@ -391,18 +396,19 @@ std::pair<std::string, std::string> GetPrinterNameAndDescription( |
| void PrintersToValues(const printing::PrinterList& printer_list, |
| base::ListValue* printers) { |
| for (const printing::PrinterBasicInfo& printer : printer_list) { |
| - std::unique_ptr<base::DictionaryValue> printer_info( |
| - new base::DictionaryValue); |
| + std::unique_ptr<base::DictionaryValue> printer_info = |
| + base::MakeUnique<base::DictionaryValue>(); |
| + printer_info->SetString(printing::kSettingDeviceName, printer.printer_name); |
| + |
| const auto printer_name_description = GetPrinterNameAndDescription(printer); |
| const std::string& printer_name = printer_name_description.first; |
| const std::string& printer_description = printer_name_description.second; |
| - printer_info->SetString(printing::kSettingDeviceName, printer.printer_name); |
| printer_info->SetString(printing::kSettingPrinterName, printer_name); |
| printer_info->SetString(printing::kSettingPrinterDescription, |
| printer_description); |
| - base::DictionaryValue* options = new base::DictionaryValue; |
| - printer_info->Set(printing::kSettingPrinterOptions, options); |
| + auto options = base::MakeUnique<base::DictionaryValue>(); |
| + printer_info->Set(printing::kSettingPrinterOptions, std::move(options)); |
| for (const auto opt_it : printer.options) |
| options->SetString(opt_it.first, opt_it.second); |