Add a function to create a bookmark app from a WebApplicationInfo.
[chromium-blink-merge.git] / components / cloud_devices / printer_description.h
blobcdfd20e254b55f23cedc8fbe96fa3adcacc86314
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
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_CLOUD_DEVICES_CLOUD_PRINTER_DESCRIPTION_H_
6 #define COMPONENTS_CLOUD_DEVICES_CLOUD_PRINTER_DESCRIPTION_H_
8 #include <string>
10 #include "base/logging.h"
11 #include "components/cloud_devices/description_items.h"
13 // Defines printer options, CDD and CJT items.
14 // https://developers.google.com/cloud-print/docs/cdd
16 namespace cloud_devices {
18 namespace printer {
20 typedef std::string ContentType;
22 enum DocumentSheetBack {
23 NORMAL,
24 ROTATED,
25 MANUAL_TUMBLE,
26 FLIPPED
29 struct PwgRasterConfig {
30 PwgRasterConfig();
32 DocumentSheetBack document_sheet_back;
33 bool reverse_order_streaming;
34 bool rotate_all_pages;
37 enum ColorType {
38 STANDARD_COLOR,
39 STANDARD_MONOCHROME,
40 CUSTOM_COLOR,
41 CUSTOM_MONOCHROME,
42 AUTO_COLOR,
45 struct Color {
46 Color();
47 explicit Color(ColorType type);
49 bool IsValid() const;
50 bool operator==(const Color& other) const;
51 bool operator!=(const Color& other) const {
52 return !(*this == other);
55 ColorType type;
56 std::string vendor_id;
57 std::string custom_display_name;
60 enum DuplexType {
61 NO_DUPLEX,
62 LONG_EDGE,
63 SHORT_EDGE,
66 enum OrientationType {
67 PORTRAIT,
68 LANDSCAPE,
69 AUTO_ORIENTATION,
72 enum MarginsType {
73 NO_MARGINS,
74 STANDARD_MARGINS,
75 CUSTOM_MARGINS,
78 struct Margins {
79 Margins();
80 Margins(MarginsType type,
81 int32 top_um,
82 int32 right_um,
83 int32 bottom_um,
84 int32 left_um);
86 bool operator==(const Margins& other) const;
87 bool operator!=(const Margins& other) const {
88 return !(*this == other);
91 MarginsType type;
92 int32 top_um;
93 int32 right_um;
94 int32 bottom_um;
95 int32 left_um;
98 struct Dpi {
99 Dpi();
100 Dpi(int32 horizontal, int32 vertical);
102 bool IsValid() const;
103 bool operator==(const Dpi& other) const;
104 bool operator!=(const Dpi& other) const {
105 return !(*this == other);
108 int32 horizontal;
109 int32 vertical;
112 enum FitToPageType {
113 NO_FITTING,
114 FIT_TO_PAGE,
115 GROW_TO_PAGE,
116 SHRINK_TO_PAGE,
117 FILL_PAGE,
120 enum MediaType {
121 CUSTOM_MEDIA,
123 // North American standard sheet media names.
124 NA_INDEX_3X5,
125 NA_PERSONAL,
126 NA_MONARCH,
127 NA_NUMBER_9,
128 NA_INDEX_4X6,
129 NA_NUMBER_10,
130 NA_A2,
131 NA_NUMBER_11,
132 NA_NUMBER_12,
133 NA_5X7,
134 NA_INDEX_5X8,
135 NA_NUMBER_14,
136 NA_INVOICE,
137 NA_INDEX_4X6_EXT,
138 NA_6X9,
139 NA_C5,
140 NA_7X9,
141 NA_EXECUTIVE,
142 NA_GOVT_LETTER,
143 NA_GOVT_LEGAL,
144 NA_QUARTO,
145 NA_LETTER,
146 NA_FANFOLD_EUR,
147 NA_LETTER_PLUS,
148 NA_FOOLSCAP,
149 NA_LEGAL,
150 NA_SUPER_A,
151 NA_9X11,
152 NA_ARCH_A,
153 NA_LETTER_EXTRA,
154 NA_LEGAL_EXTRA,
155 NA_10X11,
156 NA_10X13,
157 NA_10X14,
158 NA_10X15,
159 NA_11X12,
160 NA_EDP,
161 NA_FANFOLD_US,
162 NA_11X15,
163 NA_LEDGER,
164 NA_EUR_EDP,
165 NA_ARCH_B,
166 NA_12X19,
167 NA_B_PLUS,
168 NA_SUPER_B,
169 NA_C,
170 NA_ARCH_C,
171 NA_D,
172 NA_ARCH_D,
173 NA_ASME_F,
174 NA_WIDE_FORMAT,
175 NA_E,
176 NA_ARCH_E,
177 NA_F,
179 // Chinese standard sheet media size names.
180 ROC_16K,
181 ROC_8K,
182 PRC_32K,
183 PRC_1,
184 PRC_2,
185 PRC_4,
186 PRC_5,
187 PRC_8,
188 PRC_6,
189 PRC_3,
190 PRC_16K,
191 PRC_7,
192 OM_JUURO_KU_KAI,
193 OM_PA_KAI,
194 OM_DAI_PA_KAI,
195 PRC_10,
197 // ISO standard sheet media size names.
198 ISO_A10,
199 ISO_A9,
200 ISO_A8,
201 ISO_A7,
202 ISO_A6,
203 ISO_A5,
204 ISO_A5_EXTRA,
205 ISO_A4,
206 ISO_A4_TAB,
207 ISO_A4_EXTRA,
208 ISO_A3,
209 ISO_A4X3,
210 ISO_A4X4,
211 ISO_A4X5,
212 ISO_A4X6,
213 ISO_A4X7,
214 ISO_A4X8,
215 ISO_A4X9,
216 ISO_A3_EXTRA,
217 ISO_A2,
218 ISO_A3X3,
219 ISO_A3X4,
220 ISO_A3X5,
221 ISO_A3X6,
222 ISO_A3X7,
223 ISO_A1,
224 ISO_A2X3,
225 ISO_A2X4,
226 ISO_A2X5,
227 ISO_A0,
228 ISO_A1X3,
229 ISO_A1X4,
230 ISO_2A0,
231 ISO_A0X3,
232 ISO_B10,
233 ISO_B9,
234 ISO_B8,
235 ISO_B7,
236 ISO_B6,
237 ISO_B6C4,
238 ISO_B5,
239 ISO_B5_EXTRA,
240 ISO_B4,
241 ISO_B3,
242 ISO_B2,
243 ISO_B1,
244 ISO_B0,
245 ISO_C10,
246 ISO_C9,
247 ISO_C8,
248 ISO_C7,
249 ISO_C7C6,
250 ISO_C6,
251 ISO_C6C5,
252 ISO_C5,
253 ISO_C4,
254 ISO_C3,
255 ISO_C2,
256 ISO_C1,
257 ISO_C0,
258 ISO_DL,
259 ISO_RA2,
260 ISO_SRA2,
261 ISO_RA1,
262 ISO_SRA1,
263 ISO_RA0,
264 ISO_SRA0,
266 // Japanese standard sheet media size names.
267 JIS_B10,
268 JIS_B9,
269 JIS_B8,
270 JIS_B7,
271 JIS_B6,
272 JIS_B5,
273 JIS_B4,
274 JIS_B3,
275 JIS_B2,
276 JIS_B1,
277 JIS_B0,
278 JIS_EXEC,
279 JPN_CHOU4,
280 JPN_HAGAKI,
281 JPN_YOU4,
282 JPN_CHOU2,
283 JPN_CHOU3,
284 JPN_OUFUKU,
285 JPN_KAHU,
286 JPN_KAKU2,
288 // Other metric standard sheet media size names.
289 OM_SMALL_PHOTO,
290 OM_ITALIAN,
291 OM_POSTFIX,
292 OM_LARGE_PHOTO,
293 OM_FOLIO,
294 OM_FOLIO_SP,
295 OM_INVITE,
298 struct Media {
299 Media();
301 Media(MediaType type, int32 width_um, int32 height_um);
303 Media(const std::string& custom_display_name,
304 int32 width_um, int32 height_um);
306 bool MatchBySize();
308 bool IsValid() const;
309 bool operator==(const Media& other) const;
310 bool operator!=(const Media& other) const {
311 return !(*this == other);
314 MediaType type;
315 int32 width_um;
316 int32 height_um;
317 bool is_continuous_feed;
318 std::string custom_display_name;
321 struct Interval {
322 Interval();
323 Interval(int32 start, int32 end);
324 Interval(int32 start);
326 bool operator==(const Interval& other) const;
327 bool operator!=(const Interval& other) const {
328 return !(*this == other);
331 int32 start;
332 int32 end;
335 typedef std::vector<Interval> PageRange;
337 class ContentTypeTraits;
338 class PwgRasterConfigTraits;
339 class ColorTraits;
340 class DuplexTraits;
341 class OrientationTraits;
342 class MarginsTraits;
343 class DpiTraits;
344 class FitToPageTraits;
345 class MediaTraits;
346 class CopiesTraits;
347 class PageRangeTraits;
348 class CollateTraits;
350 typedef ListCapability<ContentType, ContentTypeTraits> ContentTypesCapability;
351 typedef ValueCapability<PwgRasterConfig, PwgRasterConfigTraits>
352 PwgRasterConfigCapability;
353 typedef SelectionCapability<Color, ColorTraits> ColorCapability;
354 typedef SelectionCapability<DuplexType, DuplexTraits> DuplexCapability;
355 typedef SelectionCapability<OrientationType,
356 OrientationTraits> OrientationCapability;
357 typedef SelectionCapability<Margins, MarginsTraits> MarginsCapability;
358 typedef SelectionCapability<Dpi, DpiTraits> DpiCapability;
359 typedef SelectionCapability<FitToPageType, FitToPageTraits> FitToPageCapability;
360 typedef SelectionCapability<Media, MediaTraits> MediaCapability;
361 typedef EmptyCapability<class CopiesTraits> CopiesCapability;
362 typedef EmptyCapability<class PageRangeTraits> PageRangeCapability;
363 typedef BooleanCapability<class CollateTraits> CollateCapability;
364 typedef BooleanCapability<class ReverseTraits> ReverseCapability;
366 typedef TicketItem<PwgRasterConfig, PwgRasterConfigTraits>
367 PwgRasterConfigTicketItem;
368 typedef TicketItem<Color, ColorTraits> ColorTicketItem;
369 typedef TicketItem<DuplexType, DuplexTraits> DuplexTicketItem;
370 typedef TicketItem<OrientationType, OrientationTraits> OrientationTicketItem;
371 typedef TicketItem<Margins, MarginsTraits> MarginsTicketItem;
372 typedef TicketItem<Dpi, DpiTraits> DpiTicketItem;
373 typedef TicketItem<FitToPageType, FitToPageTraits> FitToPageTicketItem;
374 typedef TicketItem<Media, MediaTraits> MediaTicketItem;
375 typedef TicketItem<int32, CopiesTraits> CopiesTicketItem;
376 typedef TicketItem<PageRange, PageRangeTraits> PageRangeTicketItem;
377 typedef TicketItem<bool, CollateTraits> CollateTicketItem;
378 typedef TicketItem<bool, ReverseTraits> ReverseTicketItem;
380 } // namespace printer
382 } // namespace cloud_devices
384 #endif // COMPONENTS_CLOUD_DEVICES_CLOUD_PRINTER_DESCRIPTION_H_