barcode_detection_provider_mac.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // Copyright 2018 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.
  4. #ifndef SERVICES_SHAPE_DETECTION_BARCODE_DETECTION_PROVIDER_MAC_H_
  5. #define SERVICES_SHAPE_DETECTION_BARCODE_DETECTION_PROVIDER_MAC_H_
  6. #include <memory>
  7. #include <vector>
  8. #include "mojo/public/cpp/bindings/pending_receiver.h"
  9. #include "services/shape_detection/barcode_detection_impl_mac_vision_api.h"
  10. #include "services/shape_detection/public/mojom/barcodedetection.mojom.h"
  11. #include "services/shape_detection/public/mojom/barcodedetection_provider.mojom.h"
  12. class VisionAPIInterface;
  13. namespace shape_detection {
  14. // The BarcodeDetectionProviderMac class is a provider that binds an
  15. // implementation of mojom::BarcodeDetection with Core Image or Vision
  16. // Framework.
  17. class BarcodeDetectionProviderMac
  18. : public shape_detection::mojom::BarcodeDetectionProvider {
  19. public:
  20. BarcodeDetectionProviderMac();
  21. explicit BarcodeDetectionProviderMac(std::unique_ptr<VisionAPIInterface>);
  22. BarcodeDetectionProviderMac(const BarcodeDetectionProviderMac&) = delete;
  23. BarcodeDetectionProviderMac& operator=(const BarcodeDetectionProviderMac&) =
  24. delete;
  25. ~BarcodeDetectionProviderMac() override;
  26. // Binds BarcodeDetection provider receiver to the implementation of
  27. // mojom::BarcodeDetectionProvider.
  28. static void Create(
  29. mojo::PendingReceiver<mojom::BarcodeDetectionProvider> receiver);
  30. void CreateBarcodeDetection(
  31. mojo::PendingReceiver<mojom::BarcodeDetection> receiver,
  32. mojom::BarcodeDetectorOptionsPtr options) override;
  33. void EnumerateSupportedFormats(
  34. EnumerateSupportedFormatsCallback callback) override;
  35. absl::optional<std::vector<mojom::BarcodeFormat>> supported_formats_;
  36. std::unique_ptr<VisionAPIInterface> vision_api_;
  37. };
  38. } // namespace shape_detection
  39. #endif // SERVICES_SHAPE_DETECTION_BARCODE_DETECTION_PROVIDER_MAC_H_