Chromium Code Reviews| 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 #include <memory> | 5 #include <memory> |
| 6 #include <string> | 6 #include <string> |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 22 const sync_pb::PrinterPPDReference& specifics) { | 22 const sync_pb::PrinterPPDReference& specifics) { |
| 23 Printer::PpdReference ref; | 23 Printer::PpdReference ref; |
| 24 if (specifics.has_user_supplied_ppd_url()) { | 24 if (specifics.has_user_supplied_ppd_url()) { |
| 25 ref.user_supplied_ppd_url = specifics.user_supplied_ppd_url(); | 25 ref.user_supplied_ppd_url = specifics.user_supplied_ppd_url(); |
| 26 } | 26 } |
| 27 | 27 |
| 28 if (specifics.has_effective_make_and_model()) { | 28 if (specifics.has_effective_make_and_model()) { |
| 29 ref.effective_make_and_model = specifics.effective_make_and_model(); | 29 ref.effective_make_and_model = specifics.effective_make_and_model(); |
| 30 } | 30 } |
| 31 | 31 |
| 32 if (specifics.has_autoconf()) { | |
|
Carlson
2017/05/16 16:15:27
This conditional isn't useful, I think. If you li
skau
2017/05/16 18:48:06
Acknowledged.
| |
| 33 ref.autoconf = specifics.autoconf(); | |
| 34 } | |
| 35 | |
| 32 return ref; | 36 return ref; |
| 33 } | 37 } |
| 34 | 38 |
| 35 void MergeReferenceToSpecifics(sync_pb::PrinterPPDReference* specifics, | 39 void MergeReferenceToSpecifics(sync_pb::PrinterPPDReference* specifics, |
| 36 const Printer::PpdReference& ref) { | 40 const Printer::PpdReference& ref) { |
| 37 if (!ref.user_supplied_ppd_url.empty()) { | 41 if (!ref.user_supplied_ppd_url.empty()) { |
| 38 specifics->set_user_supplied_ppd_url(ref.user_supplied_ppd_url); | 42 specifics->set_user_supplied_ppd_url(ref.user_supplied_ppd_url); |
| 39 } | 43 } |
| 40 | 44 |
| 41 if (!ref.effective_make_and_model.empty()) { | 45 if (!ref.effective_make_and_model.empty()) { |
| 42 specifics->set_effective_make_and_model(ref.effective_make_and_model); | 46 specifics->set_effective_make_and_model(ref.effective_make_and_model); |
| 43 } | 47 } |
| 48 | |
| 49 specifics->set_autoconf(ref.autoconf); | |
|
Carlson
2017/05/16 16:15:27
Conversely, this probably *should* be wrapped in a
skau
2017/05/16 18:48:06
I've made autoconf optional in PpdRefernce so that
Carlson
2017/05/22 23:46:07
I don't understand what you mean by this. Do you
skau
2017/05/23 01:00:21
Acknowledged.
| |
| 44 } | 50 } |
| 45 | 51 |
| 46 } // namespace | 52 } // namespace |
| 47 | 53 |
| 48 std::unique_ptr<Printer> SpecificsToPrinter( | 54 std::unique_ptr<Printer> SpecificsToPrinter( |
| 49 const sync_pb::PrinterSpecifics& specifics) { | 55 const sync_pb::PrinterSpecifics& specifics) { |
| 50 DCHECK(!specifics.id().empty()); | 56 DCHECK(!specifics.id().empty()); |
| 51 | 57 |
| 52 auto printer = base::MakeUnique<Printer>( | 58 auto printer = base::MakeUnique<Printer>( |
| 53 specifics.id(), base::Time::FromJavaTime(specifics.updated_timestamp())); | 59 specifics.id(), base::Time::FromJavaTime(specifics.updated_timestamp())); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 95 | 101 |
| 96 if (!printer.uuid().empty()) | 102 if (!printer.uuid().empty()) |
| 97 specifics->set_uuid(printer.uuid()); | 103 specifics->set_uuid(printer.uuid()); |
| 98 | 104 |
| 99 MergeReferenceToSpecifics(specifics->mutable_ppd_reference(), | 105 MergeReferenceToSpecifics(specifics->mutable_ppd_reference(), |
| 100 printer.ppd_reference()); | 106 printer.ppd_reference()); |
| 101 } | 107 } |
| 102 | 108 |
| 103 } // namespace printing | 109 } // namespace printing |
| 104 } // namespace chromeos | 110 } // namespace chromeos |
| OLD | NEW |