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_COMMON_CLOUD_PRINTER_DESCRIPTION_H_
6 #define COMPONENTS_CLOUD_DEVICES_COMMON_CLOUD_PRINTER_DESCRIPTION_H_
10 #include "base/logging.h"
11 #include "components/cloud_devices/common/description_items.h"
13 // Defines printer options, CDD and CJT items.
14 // https://developers.google.com/cloud-print/docs/cdd
16 namespace cloud_devices
{
20 typedef std::string ContentType
;
22 enum DocumentSheetBack
{ NORMAL
, ROTATED
, MANUAL_TUMBLE
, FLIPPED
};
24 struct PwgRasterConfig
{
27 DocumentSheetBack document_sheet_back
;
28 bool reverse_order_streaming
;
29 bool rotate_all_pages
;
42 explicit Color(ColorType type
);
45 bool operator==(const Color
& other
) const;
46 bool operator!=(const Color
& other
) const { return !(*this == other
); }
49 std::string vendor_id
;
50 std::string custom_display_name
;
59 enum OrientationType
{
73 Margins(MarginsType type
,
79 bool operator==(const Margins
& other
) const;
80 bool operator!=(const Margins
& other
) const { return !(*this == other
); }
91 Dpi(int32 horizontal
, int32 vertical
);
94 bool operator==(const Dpi
& other
) const;
95 bool operator!=(const Dpi
& other
) const { return !(*this == other
); }
112 // North American standard sheet media names.
168 // Chinese standard sheet media size names.
186 // ISO standard sheet media size names.
255 // Japanese standard sheet media size names.
277 // Other metric standard sheet media size names.
290 explicit Media(MediaType type
);
292 Media(MediaType type
, int32 width_um
, int32 height_um
);
294 Media(const std::string
& custom_display_name
,
300 bool IsValid() const;
301 bool operator==(const Media
& other
) const;
302 bool operator!=(const Media
& other
) const { return !(*this == other
); }
307 bool is_continuous_feed
;
308 std::string custom_display_name
;
313 Interval(int32 start
, int32 end
);
314 Interval(int32 start
);
316 bool operator==(const Interval
& other
) const;
317 bool operator!=(const Interval
& other
) const { return !(*this == other
); }
323 typedef std::vector
<Interval
> PageRange
;
325 class ContentTypeTraits
;
326 class PwgRasterConfigTraits
;
329 class OrientationTraits
;
332 class FitToPageTraits
;
335 class PageRangeTraits
;
338 typedef ListCapability
<ContentType
, ContentTypeTraits
> ContentTypesCapability
;
339 typedef ValueCapability
<PwgRasterConfig
, PwgRasterConfigTraits
>
340 PwgRasterConfigCapability
;
341 typedef SelectionCapability
<Color
, ColorTraits
> ColorCapability
;
342 typedef SelectionCapability
<DuplexType
, DuplexTraits
> DuplexCapability
;
343 typedef SelectionCapability
<OrientationType
, OrientationTraits
>
344 OrientationCapability
;
345 typedef SelectionCapability
<Margins
, MarginsTraits
> MarginsCapability
;
346 typedef SelectionCapability
<Dpi
, DpiTraits
> DpiCapability
;
347 typedef SelectionCapability
<FitToPageType
, FitToPageTraits
> FitToPageCapability
;
348 typedef SelectionCapability
<Media
, MediaTraits
> MediaCapability
;
349 typedef EmptyCapability
<class CopiesTraits
> CopiesCapability
;
350 typedef EmptyCapability
<class PageRangeTraits
> PageRangeCapability
;
351 typedef BooleanCapability
<class CollateTraits
> CollateCapability
;
352 typedef BooleanCapability
<class ReverseTraits
> ReverseCapability
;
354 typedef TicketItem
<PwgRasterConfig
, PwgRasterConfigTraits
>
355 PwgRasterConfigTicketItem
;
356 typedef TicketItem
<Color
, ColorTraits
> ColorTicketItem
;
357 typedef TicketItem
<DuplexType
, DuplexTraits
> DuplexTicketItem
;
358 typedef TicketItem
<OrientationType
, OrientationTraits
> OrientationTicketItem
;
359 typedef TicketItem
<Margins
, MarginsTraits
> MarginsTicketItem
;
360 typedef TicketItem
<Dpi
, DpiTraits
> DpiTicketItem
;
361 typedef TicketItem
<FitToPageType
, FitToPageTraits
> FitToPageTicketItem
;
362 typedef TicketItem
<Media
, MediaTraits
> MediaTicketItem
;
363 typedef TicketItem
<int32
, CopiesTraits
> CopiesTicketItem
;
364 typedef TicketItem
<PageRange
, PageRangeTraits
> PageRangeTicketItem
;
365 typedef TicketItem
<bool, CollateTraits
> CollateTicketItem
;
366 typedef TicketItem
<bool, ReverseTraits
> ReverseTicketItem
;
368 } // namespace printer
370 } // namespace cloud_devices
372 #endif // COMPONENTS_CLOUD_DEVICES_COMMON_CLOUD_PRINTER_DESCRIPTION_H_