1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64

ash / webui / scanning / mojom / scanning_type_converters.h [blame]

// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef ASH_WEBUI_SCANNING_MOJOM_SCANNING_TYPE_CONVERTERS_H_
#define ASH_WEBUI_SCANNING_MOJOM_SCANNING_TYPE_CONVERTERS_H_

#include "ash/webui/scanning/mojom/scanning.mojom.h"
#include "chromeos/ash/components/dbus/lorgnette/lorgnette_service.pb.h"
#include "mojo/public/cpp/bindings/enum_traits.h"
#include "mojo/public/cpp/bindings/struct_traits.h"

namespace mojo {

template <>
struct EnumTraits<ash::scanning::mojom::ColorMode, lorgnette::ColorMode> {
  static ash::scanning::mojom::ColorMode ToMojom(
      lorgnette::ColorMode color_mode);
  static bool FromMojom(ash::scanning::mojom::ColorMode input,
                        lorgnette::ColorMode* out);
};

template <>
struct EnumTraits<ash::scanning::mojom::SourceType, lorgnette::SourceType> {
  static ash::scanning::mojom::SourceType ToMojom(
      lorgnette::SourceType source_type);
  static bool FromMojom(ash::scanning::mojom::SourceType input,
                        lorgnette::SourceType* out);
};

template <>
struct EnumTraits<ash::scanning::mojom::FileType, lorgnette::ImageFormat> {
  static ash::scanning::mojom::FileType ToMojom(
      lorgnette::ImageFormat image_format);
  static bool FromMojom(ash::scanning::mojom::FileType input,
                        lorgnette::ImageFormat* out);
};

template <>
struct EnumTraits<ash::scanning::mojom::ScanResult,
                  lorgnette::ScanFailureMode> {
  static ash::scanning::mojom::ScanResult ToMojom(
      lorgnette::ScanFailureMode lorgnette_failure_mode);
  static bool FromMojom(ash::scanning::mojom::ScanResult input,
                        lorgnette::ScanFailureMode* out);
};

template <>
struct StructTraits<ash::scanning::mojom::ScannerCapabilitiesPtr,
                    lorgnette::ScannerCapabilities> {
  static ash::scanning::mojom::ScannerCapabilitiesPtr ToMojom(
      const lorgnette::ScannerCapabilities& lorgnette_caps);
};

template <>
struct StructTraits<lorgnette::ScanSettings,
                    ash::scanning::mojom::ScanSettingsPtr> {
  static lorgnette::ScanSettings ToMojom(
      const ash::scanning::mojom::ScanSettingsPtr& mojo_settings);
};

}  // namespace mojo

#endif  // ASH_WEBUI_SCANNING_MOJOM_SCANNING_TYPE_CONVERTERS_H_