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

Side by Side Diff: printing/print_settings.h

Issue 325313003: Add vendor id and custom display name to media selection (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef PRINTING_PRINT_SETTINGS_H_ 5 #ifndef PRINTING_PRINT_SETTINGS_H_
6 #define PRINTING_PRINT_SETTINGS_H_ 6 #define PRINTING_PRINT_SETTINGS_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
(...skipping 11 matching lines...) Expand all
22 #if defined(USE_CUPS) 22 #if defined(USE_CUPS)
23 // Get the color model setting name and value for the |color_mode|. 23 // Get the color model setting name and value for the |color_mode|.
24 PRINTING_EXPORT void GetColorModelForMode(int color_mode, 24 PRINTING_EXPORT void GetColorModelForMode(int color_mode,
25 std::string* color_setting_name, 25 std::string* color_setting_name,
26 std::string* color_value); 26 std::string* color_value);
27 #endif 27 #endif
28 28
29 // OS-independent print settings. 29 // OS-independent print settings.
30 class PRINTING_EXPORT PrintSettings { 30 class PRINTING_EXPORT PrintSettings {
31 public: 31 public:
32 // Media properties requested by the user. Default instance represents
33 // default media selection.
34 struct RequestedMedia {
35 // Size of the media, in microns.
36 gfx::Size size_microns;
37 // Platform specific id to map it back to the particular media.
38 std::string vendor_id;
39
40 bool IsDefault() const {
41 return size_microns.IsEmpty() && vendor_id.empty();
42 }
43 };
44
32 PrintSettings(); 45 PrintSettings();
33 ~PrintSettings(); 46 ~PrintSettings();
34 47
35 // Reinitialize the settings to the default values. 48 // Reinitialize the settings to the default values.
36 void Clear(); 49 void Clear();
37 50
38 void SetCustomMargins(const PageMargins& requested_margins_in_points); 51 void SetCustomMargins(const PageMargins& requested_margins_in_points);
39 void set_margin_type(MarginType margin_type) { margin_type_ = margin_type; } 52 void set_margin_type(MarginType margin_type) { margin_type_ = margin_type; }
40 MarginType margin_type() const { return margin_type_; } 53 MarginType margin_type() const { return margin_type_; }
41 54
42 // Updates the orientation and flip the page if needed. 55 // Updates the orientation and flip the page if needed.
43 void SetOrientation(bool landscape); 56 void SetOrientation(bool landscape);
44 bool landscape() const { return landscape_; } 57 bool landscape() const { return landscape_; }
45 58
59 // Updates user requested media.
60 void set_requested_media(const RequestedMedia& media) {
61 requested_media_ = media;
62 }
63 // Media properties requested by the user. Translated into device media by the
64 // platform specific layers.
65 const RequestedMedia& requested_media() const {
66 return requested_media_;
67 }
68
46 // Set printer printable area in in device units. 69 // Set printer printable area in in device units.
47 // Some platforms already provide flipped area. Set |landscape_needs_flip| 70 // Some platforms already provide flipped area. Set |landscape_needs_flip|
48 // to false on those platforms to avoid double flipping. 71 // to false on those platforms to avoid double flipping.
49 void SetPrinterPrintableArea(const gfx::Size& physical_size_device_units, 72 void SetPrinterPrintableArea(const gfx::Size& physical_size_device_units,
50 const gfx::Rect& printable_area_device_units, 73 const gfx::Rect& printable_area_device_units,
51 bool landscape_needs_flip); 74 bool landscape_needs_flip);
52 const PageSetup& page_setup_device_units() const { 75 const PageSetup& page_setup_device_units() const {
53 return page_setup_device_units_; 76 return page_setup_device_units_;
54 } 77 }
55 78
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 190
168 // Number of copies user wants to print. 191 // Number of copies user wants to print.
169 int copies_; 192 int copies_;
170 193
171 // Duplex type user wants to use. 194 // Duplex type user wants to use.
172 DuplexMode duplex_mode_; 195 DuplexMode duplex_mode_;
173 196
174 // Printer device name as opened by the OS. 197 // Printer device name as opened by the OS.
175 base::string16 device_name_; 198 base::string16 device_name_;
176 199
200 // Media requested by the user.
201 RequestedMedia requested_media_;
202
177 // Page setup in device units. 203 // Page setup in device units.
178 PageSetup page_setup_device_units_; 204 PageSetup page_setup_device_units_;
179 205
180 // Printer's device effective dots per inch in both axis. 206 // Printer's device effective dots per inch in both axis.
181 int dpi_; 207 int dpi_;
182 208
183 // Is the orientation landscape or portrait. 209 // Is the orientation landscape or portrait.
184 bool landscape_; 210 bool landscape_;
185 211
186 // True if this printer supports AlphaBlend. 212 // True if this printer supports AlphaBlend.
187 bool supports_alpha_blend_; 213 bool supports_alpha_blend_;
188 214
189 // If margin type is custom, this is what was requested. 215 // If margin type is custom, this is what was requested.
190 PageMargins requested_custom_margins_in_points_; 216 PageMargins requested_custom_margins_in_points_;
191 }; 217 };
192 218
193 } // namespace printing 219 } // namespace printing
194 220
195 #endif // PRINTING_PRINT_SETTINGS_H_ 221 #endif // PRINTING_PRINT_SETTINGS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698