| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/webui/print_preview/printer_backend_proxy.h" | 5 #include "chrome/browser/ui/webui/print_preview/printer_backend_proxy.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 // Store the name used in CUPS, Printer#id in |printer_name|, the description | 34 // Store the name used in CUPS, Printer#id in |printer_name|, the description |
| 35 // as the system_driverinfo option value, and the Printer#display_name in | 35 // as the system_driverinfo option value, and the Printer#display_name in |
| 36 // the |printer_description| field. This will match how Mac OS X presents | 36 // the |printer_description| field. This will match how Mac OS X presents |
| 37 // printer information. | 37 // printer information. |
| 38 printing::PrinterBasicInfo ToBasicInfo(const chromeos::Printer& printer) { | 38 printing::PrinterBasicInfo ToBasicInfo(const chromeos::Printer& printer) { |
| 39 PrinterBasicInfo basic_info; | 39 PrinterBasicInfo basic_info; |
| 40 | 40 |
| 41 // TODO(skau): Unify Mac with the other platforms for display name | 41 // TODO(skau): Unify Mac with the other platforms for display name |
| 42 // presentation so I can remove this strange code. | 42 // presentation so I can remove this strange code. |
| 43 basic_info.options[kDriverInfoTagName] = printer.description(); | 43 basic_info.options[kDriverInfoTagName] = printer.description(); |
| 44 basic_info.options[kCUPSEnterprisePrinter] = |
| 45 (printer.source() == chromeos::Printer::SRC_POLICY) ? kValueTrue |
| 46 : kValueFalse; |
| 44 basic_info.printer_name = printer.id(); | 47 basic_info.printer_name = printer.id(); |
| 45 basic_info.printer_description = printer.display_name(); | 48 basic_info.printer_description = printer.display_name(); |
| 46 return basic_info; | 49 return basic_info; |
| 47 } | 50 } |
| 48 | 51 |
| 49 void AddPrintersToList( | 52 void AddPrintersToList( |
| 50 const std::vector<std::unique_ptr<chromeos::Printer>>& printers, | 53 const std::vector<std::unique_ptr<chromeos::Printer>>& printers, |
| 51 PrinterList* list) { | 54 PrinterList* list) { |
| 52 for (const auto& printer : printers) { | 55 for (const auto& printer : printers) { |
| 53 list->push_back(ToBasicInfo(*printer)); | 56 list->push_back(ToBasicInfo(*printer)); |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 }; | 214 }; |
| 212 | 215 |
| 213 } // namespace | 216 } // namespace |
| 214 | 217 |
| 215 std::unique_ptr<PrinterBackendProxy> PrinterBackendProxy::Create( | 218 std::unique_ptr<PrinterBackendProxy> PrinterBackendProxy::Create( |
| 216 Profile* profile) { | 219 Profile* profile) { |
| 217 return base::MakeUnique<PrinterBackendProxyChromeos>(profile); | 220 return base::MakeUnique<PrinterBackendProxyChromeos>(profile); |
| 218 } | 221 } |
| 219 | 222 |
| 220 } // namespace printing | 223 } // namespace printing |
| OLD | NEW |