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
,
295 const std::string
& vendor_id
,
301 bool IsValid() const;
302 bool operator==(const Media
& other
) const;
303 bool operator!=(const Media
& other
) const { return !(*this == other
); }
308 bool is_continuous_feed
;
309 std::string custom_display_name
;
310 std::string vendor_id
;
315 Interval(int32 start
, int32 end
);
316 explicit Interval(int32 start
);
318 bool operator==(const Interval
& other
) const;
319 bool operator!=(const Interval
& other
) const { return !(*this == other
); }
325 typedef std::vector
<Interval
> PageRange
;
327 class ContentTypeTraits
;
328 class PwgRasterConfigTraits
;
331 class OrientationTraits
;
334 class FitToPageTraits
;
337 class PageRangeTraits
;
340 typedef ListCapability
<ContentType
, ContentTypeTraits
> ContentTypesCapability
;
341 typedef ValueCapability
<PwgRasterConfig
, PwgRasterConfigTraits
>
342 PwgRasterConfigCapability
;
343 typedef SelectionCapability
<Color
, ColorTraits
> ColorCapability
;
344 typedef SelectionCapability
<DuplexType
, DuplexTraits
> DuplexCapability
;
345 typedef SelectionCapability
<OrientationType
, OrientationTraits
>
346 OrientationCapability
;
347 typedef SelectionCapability
<Margins
, MarginsTraits
> MarginsCapability
;
348 typedef SelectionCapability
<Dpi
, DpiTraits
> DpiCapability
;
349 typedef SelectionCapability
<FitToPageType
, FitToPageTraits
> FitToPageCapability
;
350 typedef SelectionCapability
<Media
, MediaTraits
> MediaCapability
;
351 typedef EmptyCapability
<class CopiesTraits
> CopiesCapability
;
352 typedef EmptyCapability
<class PageRangeTraits
> PageRangeCapability
;
353 typedef BooleanCapability
<class CollateTraits
> CollateCapability
;
354 typedef BooleanCapability
<class ReverseTraits
> ReverseCapability
;
356 typedef TicketItem
<PwgRasterConfig
, PwgRasterConfigTraits
>
357 PwgRasterConfigTicketItem
;
358 typedef TicketItem
<Color
, ColorTraits
> ColorTicketItem
;
359 typedef TicketItem
<DuplexType
, DuplexTraits
> DuplexTicketItem
;
360 typedef TicketItem
<OrientationType
, OrientationTraits
> OrientationTicketItem
;
361 typedef TicketItem
<Margins
, MarginsTraits
> MarginsTicketItem
;
362 typedef TicketItem
<Dpi
, DpiTraits
> DpiTicketItem
;
363 typedef TicketItem
<FitToPageType
, FitToPageTraits
> FitToPageTicketItem
;
364 typedef TicketItem
<Media
, MediaTraits
> MediaTicketItem
;
365 typedef TicketItem
<int32
, CopiesTraits
> CopiesTicketItem
;
366 typedef TicketItem
<PageRange
, PageRangeTraits
> PageRangeTicketItem
;
367 typedef TicketItem
<bool, CollateTraits
> CollateTicketItem
;
368 typedef TicketItem
<bool, ReverseTraits
> ReverseTicketItem
;
370 } // namespace printer
372 } // namespace cloud_devices
374 #endif // COMPONENTS_CLOUD_DEVICES_COMMON_CLOUD_PRINTER_DESCRIPTION_H_