| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/common/cloud_print/cloud_print_cdd_conversion.h" | 5 #include "chrome/common/cloud_print/cloud_print_cdd_conversion.h" |
| 6 | 6 |
| 7 #include "base/strings/string_number_conversions.h" |
| 7 #include "components/cloud_devices/common/printer_description.h" | 8 #include "components/cloud_devices/common/printer_description.h" |
| 8 #include "printing/backend/print_backend.h" | 9 #include "printing/backend/print_backend.h" |
| 9 | 10 |
| 10 namespace cloud_print { | 11 namespace cloud_print { |
| 11 | 12 |
| 12 scoped_ptr<base::DictionaryValue> PrinterSemanticCapsAndDefaultsToCdd( | 13 scoped_ptr<base::DictionaryValue> PrinterSemanticCapsAndDefaultsToCdd( |
| 13 const printing::PrinterSemanticCapsAndDefaults& semantic_info) { | 14 const printing::PrinterSemanticCapsAndDefaults& semantic_info) { |
| 14 using namespace cloud_devices::printer; | 15 using namespace cloud_devices::printer; |
| 15 cloud_devices::CloudDeviceDescription description; | 16 cloud_devices::CloudDeviceDescription description; |
| 16 | 17 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 35 NO_DUPLEX, semantic_info.duplex_default == printing::SIMPLEX); | 36 NO_DUPLEX, semantic_info.duplex_default == printing::SIMPLEX); |
| 36 duplex.AddDefaultOption( | 37 duplex.AddDefaultOption( |
| 37 LONG_EDGE, semantic_info.duplex_default == printing::LONG_EDGE); | 38 LONG_EDGE, semantic_info.duplex_default == printing::LONG_EDGE); |
| 38 duplex.AddDefaultOption( | 39 duplex.AddDefaultOption( |
| 39 SHORT_EDGE, semantic_info.duplex_default == printing::SHORT_EDGE); | 40 SHORT_EDGE, semantic_info.duplex_default == printing::SHORT_EDGE); |
| 40 duplex.SaveTo(&description); | 41 duplex.SaveTo(&description); |
| 41 } | 42 } |
| 42 | 43 |
| 43 ColorCapability color; | 44 ColorCapability color; |
| 44 if (semantic_info.color_default || semantic_info.color_changeable) { | 45 if (semantic_info.color_default || semantic_info.color_changeable) { |
| 45 color.AddDefaultOption(Color(STANDARD_COLOR), semantic_info.color_default); | 46 Color standard_color(STANDARD_COLOR); |
| 47 standard_color.vendor_id = base::IntToString(semantic_info.color_model); |
| 48 color.AddDefaultOption(standard_color, semantic_info.color_default); |
| 46 } | 49 } |
| 47 if (!semantic_info.color_default || semantic_info.color_changeable) { | 50 if (!semantic_info.color_default || semantic_info.color_changeable) { |
| 48 color.AddDefaultOption(Color(STANDARD_MONOCHROME), | 51 Color standard_monochrome(STANDARD_MONOCHROME); |
| 49 !semantic_info.color_default); | 52 standard_monochrome.vendor_id = base::IntToString(semantic_info.bw_model); |
| 53 color.AddDefaultOption(standard_monochrome, !semantic_info.color_default); |
| 50 } | 54 } |
| 51 color.SaveTo(&description); | 55 color.SaveTo(&description); |
| 52 | 56 |
| 53 #if defined(OS_WIN) | 57 #if defined(OS_WIN) |
| 54 if (!semantic_info.papers.empty()) { | 58 if (!semantic_info.papers.empty()) { |
| 55 Media default_media(semantic_info.default_paper.name, | 59 Media default_media(semantic_info.default_paper.name, |
| 56 semantic_info.default_paper.size_um.width(), | 60 semantic_info.default_paper.size_um.width(), |
| 57 semantic_info.default_paper.size_um.height()); | 61 semantic_info.default_paper.size_um.height()); |
| 58 default_media.MatchBySize(); | 62 default_media.MatchBySize(); |
| 59 | 63 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 OrientationCapability orientation; | 115 OrientationCapability orientation; |
| 112 orientation.AddDefaultOption(PORTRAIT, true); | 116 orientation.AddDefaultOption(PORTRAIT, true); |
| 113 orientation.AddOption(LANDSCAPE); | 117 orientation.AddOption(LANDSCAPE); |
| 114 orientation.AddOption(AUTO_ORIENTATION); | 118 orientation.AddOption(AUTO_ORIENTATION); |
| 115 orientation.SaveTo(&description); | 119 orientation.SaveTo(&description); |
| 116 | 120 |
| 117 return scoped_ptr<base::DictionaryValue>(description.root().DeepCopy()); | 121 return scoped_ptr<base::DictionaryValue>(description.root().DeepCopy()); |
| 118 } | 122 } |
| 119 | 123 |
| 120 } // namespace cloud_print | 124 } // namespace cloud_print |
| OLD | NEW |