| 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 25 matching lines...) Expand all Loading... |
| 36 // Store the name used in CUPS, Printer#id in |printer_name|, the description | 36 // Store the name used in CUPS, Printer#id in |printer_name|, the description |
| 37 // as the system_driverinfo option value, and the Printer#display_name in | 37 // as the system_driverinfo option value, and the Printer#display_name in |
| 38 // the |printer_description| field. This will match how Mac OS X presents | 38 // the |printer_description| field. This will match how Mac OS X presents |
| 39 // printer information. | 39 // printer information. |
| 40 printing::PrinterBasicInfo ToBasicInfo(const chromeos::Printer& printer) { | 40 printing::PrinterBasicInfo ToBasicInfo(const chromeos::Printer& printer) { |
| 41 PrinterBasicInfo basic_info; | 41 PrinterBasicInfo basic_info; |
| 42 | 42 |
| 43 // TODO(skau): Unify Mac with the other platforms for display name | 43 // TODO(skau): Unify Mac with the other platforms for display name |
| 44 // presentation so I can remove this strange code. | 44 // presentation so I can remove this strange code. |
| 45 basic_info.options[kDriverInfoTagName] = printer.description(); | 45 basic_info.options[kDriverInfoTagName] = printer.description(); |
| 46 basic_info.options[kCUPSEnterprisePrinter] = |
| 47 (printer.source() == chromeos::Printer::SRC_POLICY) ? kValueTrue |
| 48 : kValueFalse; |
| 46 basic_info.printer_name = printer.id(); | 49 basic_info.printer_name = printer.id(); |
| 47 basic_info.printer_description = printer.display_name(); | 50 basic_info.printer_description = printer.display_name(); |
| 48 return basic_info; | 51 return basic_info; |
| 49 } | 52 } |
| 50 | 53 |
| 51 void AddPrintersToList( | 54 void AddPrintersToList( |
| 52 const std::vector<std::unique_ptr<chromeos::Printer>>& printers, | 55 const std::vector<std::unique_ptr<chromeos::Printer>>& printers, |
| 53 PrinterList* list) { | 56 PrinterList* list) { |
| 54 for (const auto& printer : printers) { | 57 for (const auto& printer : printers) { |
| 55 list->push_back(ToBasicInfo(*printer)); | 58 list->push_back(ToBasicInfo(*printer)); |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 }; | 219 }; |
| 217 | 220 |
| 218 } // namespace | 221 } // namespace |
| 219 | 222 |
| 220 std::unique_ptr<PrinterBackendProxy> PrinterBackendProxy::Create( | 223 std::unique_ptr<PrinterBackendProxy> PrinterBackendProxy::Create( |
| 221 Profile* profile) { | 224 Profile* profile) { |
| 222 return base::MakeUnique<PrinterBackendProxyChromeos>(profile); | 225 return base::MakeUnique<PrinterBackendProxyChromeos>(profile); |
| 223 } | 226 } |
| 224 | 227 |
| 225 } // namespace printing | 228 } // namespace printing |
| OLD | NEW |