#include "printing/backend/mojom/print_backend_mojom_traits.h"
#include <map>
#include "base/containers/contains.h"
#include "base/logging.h"
#include "build/build_config.h"
#include "ui/gfx/geometry/mojom/geometry.mojom-shared.h"
#include "ui/gfx/geometry/mojom/geometry_mojom_traits.h"
namespace std {
template <>
struct less<::gfx::Size> { … };
template <>
struct less<::printing::PrinterSemanticCapsAndDefaults::Paper> { … };
#if BUILDFLAG(IS_CHROMEOS)
template <>
struct less<::printing::AdvancedCapability> {
bool operator()(const ::printing::AdvancedCapability& lhs,
const ::printing::AdvancedCapability& rhs) const {
if (lhs.name < rhs.name)
return true;
return lhs.display_name < rhs.display_name;
}
};
#endif
}
namespace mojo {
namespace {
template <class Key>
class DuplicateChecker { … };
}
bool StructTraits<printing::mojom::PrinterBasicInfoDataView,
printing::PrinterBasicInfo>::
Read(printing::mojom::PrinterBasicInfoDataView data,
printing::PrinterBasicInfo* out) { … }
bool StructTraits<printing::mojom::PaperDataView,
printing::PrinterSemanticCapsAndDefaults::Paper>::
Read(printing::mojom::PaperDataView data,
printing::PrinterSemanticCapsAndDefaults::Paper* out) { … }
bool StructTraits<printing::mojom::MediaTypeDataView,
printing::PrinterSemanticCapsAndDefaults::MediaType>::
Read(printing::mojom::MediaTypeDataView data,
printing::PrinterSemanticCapsAndDefaults::MediaType* out) { … }
#if BUILDFLAG(IS_CHROMEOS)
printing::mojom::AdvancedCapabilityType
EnumTraits<printing::mojom::AdvancedCapabilityType,
::printing::AdvancedCapability::Type>::
ToMojom(::printing::AdvancedCapability::Type input) {
switch (input) {
case ::printing::AdvancedCapability::Type::kBoolean:
return printing::mojom::AdvancedCapabilityType::kBoolean;
case ::printing::AdvancedCapability::Type::kFloat:
return printing::mojom::AdvancedCapabilityType::kFloat;
case ::printing::AdvancedCapability::Type::kInteger:
return printing::mojom::AdvancedCapabilityType::kInteger;
case ::printing::AdvancedCapability::Type::kString:
return printing::mojom::AdvancedCapabilityType::kString;
}
NOTREACHED_IN_MIGRATION();
return printing::mojom::AdvancedCapabilityType::kString;
}
bool EnumTraits<printing::mojom::AdvancedCapabilityType,
::printing::AdvancedCapability::Type>::
FromMojom(printing::mojom::AdvancedCapabilityType input,
::printing::AdvancedCapability::Type* output) {
switch (input) {
case printing::mojom::AdvancedCapabilityType::kBoolean:
*output = ::printing::AdvancedCapability::Type::kBoolean;
return true;
case printing::mojom::AdvancedCapabilityType::kFloat:
*output = ::printing::AdvancedCapability::Type::kFloat;
return true;
case printing::mojom::AdvancedCapabilityType::kInteger:
*output = ::printing::AdvancedCapability::Type::kInteger;
return true;
case printing::mojom::AdvancedCapabilityType::kString:
*output = ::printing::AdvancedCapability::Type::kString;
return true;
}
NOTREACHED_IN_MIGRATION();
return false;
}
bool StructTraits<printing::mojom::AdvancedCapabilityValueDataView,
::printing::AdvancedCapabilityValue>::
Read(printing::mojom::AdvancedCapabilityValueDataView data,
::printing::AdvancedCapabilityValue* out) {
return data.ReadName(&out->name) && data.ReadDisplayName(&out->display_name);
}
bool StructTraits<printing::mojom::AdvancedCapabilityDataView,
::printing::AdvancedCapability>::
Read(printing::mojom::AdvancedCapabilityDataView data,
::printing::AdvancedCapability* out) {
return data.ReadName(&out->name) &&
data.ReadDisplayName(&out->display_name) &&
data.ReadType(&out->type) &&
data.ReadDefaultValue(&out->default_value) &&
data.ReadValues(&out->values);
}
#endif
#if BUILDFLAG(IS_WIN)
bool StructTraits<printing::mojom::PageOutputQualityAttributeDataView,
printing::PageOutputQualityAttribute>::
Read(printing::mojom::PageOutputQualityAttributeDataView data,
printing::PageOutputQualityAttribute* out) {
return data.ReadDisplayName(&out->display_name) && data.ReadName(&out->name);
}
bool StructTraits<printing::mojom::PageOutputQualityDataView,
printing::PageOutputQuality>::
Read(printing::mojom::PageOutputQualityDataView data,
printing::PageOutputQuality* out) {
return data.ReadQualities(&out->qualities) &&
data.ReadDefaultQuality(&out->default_quality);
}
#endif
bool StructTraits<printing::mojom::PrinterSemanticCapsAndDefaultsDataView,
printing::PrinterSemanticCapsAndDefaults>::
Read(printing::mojom::PrinterSemanticCapsAndDefaultsDataView data,
printing::PrinterSemanticCapsAndDefaults* out) { … }
}