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" |
| 11 #include "base/time/time.h" |
11 #include "chrome/browser/chromeos/printing/specifics_translation.h" | 12 #include "chrome/browser/chromeos/printing/specifics_translation.h" |
12 #include "chromeos/printing/printer_configuration.h" | 13 #include "chromeos/printing/printer_configuration.h" |
13 #include "components/sync/protocol/printer_specifics.pb.h" | 14 #include "components/sync/protocol/printer_specifics.pb.h" |
14 | 15 |
15 namespace chromeos { | 16 namespace chromeos { |
16 namespace printing { | 17 namespace printing { |
17 | 18 |
18 namespace { | 19 namespace { |
19 | 20 |
20 Printer::PpdReference SpecificsToPpd( | 21 Printer::PpdReference SpecificsToPpd( |
(...skipping 20 matching lines...) Expand all Loading... |
41 specifics->set_effective_make_and_model(ref.effective_make_and_model); | 42 specifics->set_effective_make_and_model(ref.effective_make_and_model); |
42 } | 43 } |
43 } | 44 } |
44 | 45 |
45 } // namespace | 46 } // namespace |
46 | 47 |
47 std::unique_ptr<Printer> SpecificsToPrinter( | 48 std::unique_ptr<Printer> SpecificsToPrinter( |
48 const sync_pb::PrinterSpecifics& specifics) { | 49 const sync_pb::PrinterSpecifics& specifics) { |
49 DCHECK(!specifics.id().empty()); | 50 DCHECK(!specifics.id().empty()); |
50 | 51 |
51 auto printer = base::MakeUnique<Printer>(specifics.id()); | 52 auto printer = base::MakeUnique<Printer>( |
| 53 specifics.id(), base::Time::FromJavaTime(specifics.updated_timestamp())); |
52 printer->set_display_name(specifics.display_name()); | 54 printer->set_display_name(specifics.display_name()); |
53 printer->set_description(specifics.description()); | 55 printer->set_description(specifics.description()); |
54 printer->set_manufacturer(specifics.manufacturer()); | 56 printer->set_manufacturer(specifics.manufacturer()); |
55 printer->set_model(specifics.model()); | 57 printer->set_model(specifics.model()); |
56 printer->set_uri(specifics.uri()); | 58 printer->set_uri(specifics.uri()); |
57 printer->set_uuid(specifics.uuid()); | 59 printer->set_uuid(specifics.uuid()); |
58 | 60 |
59 *printer->mutable_ppd_reference() = SpecificsToPpd(specifics.ppd_reference()); | 61 *printer->mutable_ppd_reference() = SpecificsToPpd(specifics.ppd_reference()); |
60 | 62 |
61 return printer; | 63 return printer; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 | 95 |
94 if (!printer.uuid().empty()) | 96 if (!printer.uuid().empty()) |
95 specifics->set_uuid(printer.uuid()); | 97 specifics->set_uuid(printer.uuid()); |
96 | 98 |
97 MergeReferenceToSpecifics(specifics->mutable_ppd_reference(), | 99 MergeReferenceToSpecifics(specifics->mutable_ppd_reference(), |
98 printer.ppd_reference()); | 100 printer.ppd_reference()); |
99 } | 101 } |
100 | 102 |
101 } // namespace printing | 103 } // namespace printing |
102 } // namespace chromeos | 104 } // namespace chromeos |
OLD | NEW |