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_
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
{
20 typedef std::string ContentType
;
22 enum DocumentSheetBack
{
29 struct PwgRasterConfig
{
32 DocumentSheetBack document_sheet_back
;
33 bool reverse_order_streaming
;
34 bool rotate_all_pages
;
47 explicit Color(ColorType type
);
50 bool operator==(const Color
& other
) const;
51 bool operator!=(const Color
& other
) const {
52 return !(*this == other
);
56 std::string vendor_id
;
57 std::string custom_display_name
;
66 enum OrientationType
{
80 Margins(MarginsType type
,
86 bool operator==(const Margins
& other
) const;
87 bool operator!=(const Margins
& other
) const {
88 return !(*this == other
);
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
);
123 // North American standard sheet media names.
179 // Chinese standard sheet media size names.
197 // ISO standard sheet media size names.
266 // Japanese standard sheet media size names.
288 // Other metric standard sheet media size names.
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
);
308 bool IsValid() const;
309 bool operator==(const Media
& other
) const;
310 bool operator!=(const Media
& other
) const {
311 return !(*this == other
);
317 bool is_continuous_feed
;
318 std::string custom_display_name
;
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
);
335 typedef std::vector
<Interval
> PageRange
;
337 class ContentTypeTraits
;
338 class PwgRasterConfigTraits
;
341 class OrientationTraits
;
344 class FitToPageTraits
;
347 class PageRangeTraits
;
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_