| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 #ifndef CHROME_BROWSER_CHROMEOS_PRINTING_SPECIFICS_TRANSLATION_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_PRINTING_SPECIFICS_TRANSLATION_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_PRINTING_SPECIFICS_TRANSLATION_H_ | 6 #define CHROME_BROWSER_CHROMEOS_PRINTING_SPECIFICS_TRANSLATION_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "chromeos/printing/printer_configuration.h" | 10 #include "chromeos/printing/printer_configuration.h" |
| 11 #include "components/sync/protocol/printer_specifics.pb.h" | 11 #include "components/sync/protocol/printer_specifics.pb.h" |
| 12 | 12 |
| 13 namespace chromeos { | 13 namespace chromeos { |
| 14 namespace printing { | |
| 15 | 14 |
| 16 // Convert |printer| into its local representation. Enforces that only one | 15 // Convert |printer| into its local representation. Enforces that only one |
| 17 // field in PpdReference is filled in. In order of preference, we populate | 16 // field in PpdReference is filled in. In order of preference, we populate |
| 18 // autoconf, user_supplied_ppd_url, or effective_make_and_model. | 17 // autoconf, user_supplied_ppd_url, or effective_make_and_model. |
| 19 std::unique_ptr<Printer> SpecificsToPrinter( | 18 std::unique_ptr<Printer> SpecificsToPrinter( |
| 20 const sync_pb::PrinterSpecifics& printer); | 19 const sync_pb::PrinterSpecifics& printer); |
| 21 | 20 |
| 22 // Convert |printer| into its proto representation. | 21 // Convert |printer| into its proto representation. |
| 23 std::unique_ptr<sync_pb::PrinterSpecifics> PrinterToSpecifics( | 22 std::unique_ptr<sync_pb::PrinterSpecifics> PrinterToSpecifics( |
| 24 const Printer& printer); | 23 const Printer& printer); |
| 25 | 24 |
| 26 // Merge fields from |printer| into |specifics|. Merge strategy is to only | 25 // Merge fields from |printer| into |specifics|. Merge strategy is to only |
| 27 // write non-default fields from |printer| into the appropriate field in | 26 // write non-default fields from |printer| into the appropriate field in |
| 28 // |specifics|. Default fields are skipped to prevent accidentally clearing | 27 // |specifics|. Default fields are skipped to prevent accidentally clearing |
| 29 // |specifics|. Enforces field exclusivity in PpdReference as described in | 28 // |specifics|. Enforces field exclusivity in PpdReference as described in |
| 30 // SpecificsToPrinter. | 29 // SpecificsToPrinter. |
| 31 void MergePrinterToSpecifics(const Printer& printer, | 30 void MergePrinterToSpecifics(const Printer& printer, |
| 32 sync_pb::PrinterSpecifics* specifics); | 31 sync_pb::PrinterSpecifics* specifics); |
| 33 | 32 |
| 34 } // namespace printing | |
| 35 } // namespace chromeos | 33 } // namespace chromeos |
| 36 | 34 |
| 37 #endif // CHROME_BROWSER_CHROMEOS_PRINTING_SPECIFICS_TRANSLATION_H_ | 35 #endif // CHROME_BROWSER_CHROMEOS_PRINTING_SPECIFICS_TRANSLATION_H_ |
| OLD | NEW |