Chromium Code Reviews| 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 "chromeos/printing/printer_translator.h" | 5 #include "chromeos/printing/printer_translator.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 58 printer->set_description(description); | 58 printer->set_description(description); |
| 59 | 59 |
| 60 std::string manufacturer; | 60 std::string manufacturer; |
| 61 if (value.GetString(kManufacturer, &manufacturer)) | 61 if (value.GetString(kManufacturer, &manufacturer)) |
| 62 printer->set_manufacturer(manufacturer); | 62 printer->set_manufacturer(manufacturer); |
| 63 | 63 |
| 64 std::string model; | 64 std::string model; |
| 65 if (value.GetString(kModel, &model)) | 65 if (value.GetString(kModel, &model)) |
| 66 printer->set_model(model); | 66 printer->set_model(model); |
| 67 | 67 |
| 68 std::string make_and_model = manufacturer; | |
| 69 if (!make_and_model.empty() && !model.empty()) | |
| 70 make_and_model.append(" "); | |
| 71 make_and_model.append(model); | |
|
Carlson
2017/06/28 17:38:36
Nit: I think it's a little clearer if this line i
skau
2017/06/28 21:25:35
But that wouldn't be equivalent. If model is not
Carlson
2017/06/28 22:22:04
Indeed, I fail at logic today. Alas!
Can I sugge
skau
2017/06/28 22:41:05
Done.
| |
| 72 printer->set_make_and_model(make_and_model); | |
| 73 | |
| 68 std::string uuid; | 74 std::string uuid; |
| 69 if (value.GetString(kUUID, &uuid)) | 75 if (value.GetString(kUUID, &uuid)) |
| 70 printer->set_uuid(uuid); | 76 printer->set_uuid(uuid); |
| 71 | 77 |
| 72 return true; | 78 return true; |
| 73 } | 79 } |
| 74 | 80 |
| 75 } // namespace | 81 } // namespace |
| 76 | 82 |
| 77 namespace printing { | 83 namespace printing { |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 106 // Make and model is mandatory | 112 // Make and model is mandatory |
| 107 LOG(WARNING) << "Missing model information for policy printer."; | 113 LOG(WARNING) << "Missing model information for policy printer."; |
| 108 return nullptr; | 114 return nullptr; |
| 109 } | 115 } |
| 110 | 116 |
| 111 return printer; | 117 return printer; |
| 112 } | 118 } |
| 113 | 119 |
| 114 } // namespace printing | 120 } // namespace printing |
| 115 } // namespace chromeos | 121 } // namespace chromeos |
| OLD | NEW |