Skip to content

Commit

Permalink
print.mojom: Add (Color|Duplex|Pin)ModeRestriction enums
Browse files Browse the repository at this point in the history
This allows the mode restriction enums to be used by the local printer
mojo interface.

Bug: b/179305160

Change-Id: I515f3b1f8cb21d59a923a422c43ec9380dd3a800
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2861977
Reviewed-by: Greg Kerr <kerrnel@chromium.org>
Reviewed-by: Rebekah Potter <rbpotter@chromium.org>
Auto-Submit: Pranav Batra <batrapranav@chromium.org>
Commit-Queue: Pranav Batra <batrapranav@chromium.org>
Cr-Commit-Position: refs/heads/master@{#879195}
  • Loading branch information
tsite authored and Chromium LUCI CQ committed May 5, 2021
1 parent a66b3ee commit eb50e04
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 17 deletions.
24 changes: 7 additions & 17 deletions printing/backend/printing_restrictions.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,24 @@
#include "base/component_export.h"
#include "build/chromeos_buildflags.h"

#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "printing/mojom/print.mojom.h"
#endif

namespace printing {

#if BUILDFLAG(IS_CHROMEOS_ASH)
// Allowed printing modes as a bitmask.
// This is used in pref file and should never change.
enum class ColorModeRestriction {
kUnset = 0x0,
kMonochrome = 0x1,
kColor = 0x2,
};
using ColorModeRestriction = mojom::ColorModeRestriction;

// Allowed duplex modes as a bitmask.
// This is used in pref file and should never change.
enum class DuplexModeRestriction {
kUnset = 0x0,
kSimplex = 0x1,
kLongEdge = 0x2,
kShortEdge = 0x4,
kDuplex = 0x2 | 0x4,
};
using DuplexModeRestriction = mojom::DuplexModeRestriction;

// Allowed PIN printing modes.
// This is used in pref file and should never change.
enum class PinModeRestriction {
kUnset = 0,
kPin = 1,
kNoPin = 2,
};
using PinModeRestriction = mojom::PinModeRestriction;

// Dictionary key for printing policies.
// Must coincide with the name of field in `print_preview.Policies` in
Expand Down
29 changes: 29 additions & 0 deletions printing/mojom/print.mojom
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,32 @@ enum MarginType {
kPrintableAreaMargins,
kCustomMargins,
};

// Allowed printing modes as a bitmask.
// This is used in pref file and should never change.
[Stable, Extensible, EnableIf=is_chromeos]
enum ColorModeRestriction {
[Default] kUnset = 0x0,
kMonochrome = 0x1,
kColor = 0x2,
};

// Allowed duplex modes as a bitmask.
// This is used in pref file and should never change.
[Stable, Extensible, EnableIf=is_chromeos]
enum DuplexModeRestriction {
[Default] kUnset = 0x0,
kSimplex = 0x1,
kLongEdge = 0x2,
kShortEdge = 0x4,
kDuplex = 0x6,
};

// Allowed PIN printing modes as a bitmask.
// This is used in pref file and should never change.
[Stable, Extensible, EnableIf=is_chromeos]
enum PinModeRestriction {
[Default] kUnset = 0,
kPin = 1,
kNoPin = 2,
};

0 comments on commit eb50e04

Please sign in to comment.