Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Side by Side Diff: trunk/src/chrome/common/cloud_print/cloud_print_cdd_conversion.cc

Issue 319373004: Revert 275646 "Generalize printer color model handling, get rid ..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
8 #include "components/cloud_devices/common/printer_description.h" 7 #include "components/cloud_devices/common/printer_description.h"
9 #include "printing/backend/print_backend.h" 8 #include "printing/backend/print_backend.h"
10 9
11 namespace cloud_print { 10 namespace cloud_print {
12 11
13 scoped_ptr<base::DictionaryValue> PrinterSemanticCapsAndDefaultsToCdd( 12 scoped_ptr<base::DictionaryValue> PrinterSemanticCapsAndDefaultsToCdd(
14 const printing::PrinterSemanticCapsAndDefaults& semantic_info) { 13 const printing::PrinterSemanticCapsAndDefaults& semantic_info) {
15 using namespace cloud_devices::printer; 14 using namespace cloud_devices::printer;
16 cloud_devices::CloudDeviceDescription description; 15 cloud_devices::CloudDeviceDescription description;
17 16
(...skipping 18 matching lines...) Expand all
36 NO_DUPLEX, semantic_info.duplex_default == printing::SIMPLEX); 35 NO_DUPLEX, semantic_info.duplex_default == printing::SIMPLEX);
37 duplex.AddDefaultOption( 36 duplex.AddDefaultOption(
38 LONG_EDGE, semantic_info.duplex_default == printing::LONG_EDGE); 37 LONG_EDGE, semantic_info.duplex_default == printing::LONG_EDGE);
39 duplex.AddDefaultOption( 38 duplex.AddDefaultOption(
40 SHORT_EDGE, semantic_info.duplex_default == printing::SHORT_EDGE); 39 SHORT_EDGE, semantic_info.duplex_default == printing::SHORT_EDGE);
41 duplex.SaveTo(&description); 40 duplex.SaveTo(&description);
42 } 41 }
43 42
44 ColorCapability color; 43 ColorCapability color;
45 if (semantic_info.color_default || semantic_info.color_changeable) { 44 if (semantic_info.color_default || semantic_info.color_changeable) {
46 Color standard_color(STANDARD_COLOR); 45 color.AddDefaultOption(Color(STANDARD_COLOR), semantic_info.color_default);
47 standard_color.vendor_id = base::IntToString(semantic_info.color_model);
48 color.AddDefaultOption(standard_color, semantic_info.color_default);
49 } 46 }
50 if (!semantic_info.color_default || semantic_info.color_changeable) { 47 if (!semantic_info.color_default || semantic_info.color_changeable) {
51 Color standard_monochrome(STANDARD_MONOCHROME); 48 color.AddDefaultOption(Color(STANDARD_MONOCHROME),
52 standard_monochrome.vendor_id = base::IntToString(semantic_info.bw_model); 49 !semantic_info.color_default);
53 color.AddDefaultOption(standard_monochrome, !semantic_info.color_default);
54 } 50 }
55 color.SaveTo(&description); 51 color.SaveTo(&description);
56 52
57 #if defined(OS_WIN) 53 #if defined(OS_WIN)
58 if (!semantic_info.papers.empty()) { 54 if (!semantic_info.papers.empty()) {
59 Media default_media(semantic_info.default_paper.name, 55 Media default_media(semantic_info.default_paper.name,
60 semantic_info.default_paper.size_um.width(), 56 semantic_info.default_paper.size_um.width(),
61 semantic_info.default_paper.size_um.height()); 57 semantic_info.default_paper.size_um.height());
62 default_media.MatchBySize(); 58 default_media.MatchBySize();
63 59
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 OrientationCapability orientation; 111 OrientationCapability orientation;
116 orientation.AddDefaultOption(PORTRAIT, true); 112 orientation.AddDefaultOption(PORTRAIT, true);
117 orientation.AddOption(LANDSCAPE); 113 orientation.AddOption(LANDSCAPE);
118 orientation.AddOption(AUTO_ORIENTATION); 114 orientation.AddOption(AUTO_ORIENTATION);
119 orientation.SaveTo(&description); 115 orientation.SaveTo(&description);
120 116
121 return scoped_ptr<base::DictionaryValue>(description.root().DeepCopy()); 117 return scoped_ptr<base::DictionaryValue>(description.root().DeepCopy());
122 } 118 }
123 119
124 } // namespace cloud_print 120 } // namespace cloud_print
OLDNEW
« no previous file with comments | « trunk/src/chrome/common/chrome_utility_messages.h ('k') | trunk/src/chrome/test/data/webui/print_preview.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698