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 6f5cbae08387434ebea3d3826f6d666bcf82a73a..6e5b1baf50a13932e618ed5d921a7835ed1188bf 100644 |
| --- a/chrome/browser/chromeos/printing/specifics_translation.cc |
| +++ b/chrome/browser/chromeos/printing/specifics_translation.cc |
| @@ -21,25 +21,34 @@ namespace { |
| Printer::PpdReference SpecificsToPpd( |
| const sync_pb::PrinterPPDReference& specifics) { |
| Printer::PpdReference ref; |
| - if (specifics.has_user_supplied_ppd_url()) { |
| + if (specifics.has_autoconf() && specifics.autoconf()) { |
|
Carlson
2017/05/22 23:46:07
The has_autoconf() here is not needed.
skau
2017/05/23 01:00:21
Done.
|
| + ref.autoconf = specifics.autoconf(); |
| + } else if (specifics.has_user_supplied_ppd_url()) { |
| ref.user_supplied_ppd_url = specifics.user_supplied_ppd_url(); |
| - } |
| - |
| - if (specifics.has_effective_make_and_model()) { |
| + } else if (specifics.has_effective_make_and_model()) { |
| ref.effective_make_and_model = specifics.effective_make_and_model(); |
| } |
| return ref; |
| } |
| +// Overwrite fields in |specifics| with an appropriately filled field from |
| +// |ref|. If |ref| is the default object, nothing will be changed in |
|
Carlson
2017/05/22 23:46:07
Not sure what "default object" means here -- you m
|
| +// |specifics|. |
| void MergeReferenceToSpecifics(sync_pb::PrinterPPDReference* specifics, |
| const Printer::PpdReference& ref) { |
| - if (!ref.user_supplied_ppd_url.empty()) { |
| + if (ref.autoconf) { |
| + specifics->set_autoconf(ref.autoconf); |
|
Carlson
2017/05/22 23:46:07
You could write each of these as
if (...) {
speci
skau
2017/05/23 01:00:21
Done.
|
| + specifics->clear_user_supplied_ppd_url(); |
| + specifics->clear_effective_make_and_model(); |
| + } else if (!ref.user_supplied_ppd_url.empty()) { |
| specifics->set_user_supplied_ppd_url(ref.user_supplied_ppd_url); |
| - } |
| - |
| - if (!ref.effective_make_and_model.empty()) { |
| + specifics->clear_autoconf(); |
| + specifics->clear_effective_make_and_model(); |
| + } else if (!ref.effective_make_and_model.empty()) { |
| specifics->set_effective_make_and_model(ref.effective_make_and_model); |
| + specifics->clear_autoconf(); |
| + specifics->clear_user_supplied_ppd_url(); |
| } |
| } |