barcode_detection_provider_barhopper.cc 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. // Copyright 2020 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. #include "services/shape_detection/barcode_detection_provider_barhopper.h"
  5. #include <memory>
  6. #include <utility>
  7. #include "mojo/public/cpp/bindings/pending_receiver.h"
  8. #include "mojo/public/cpp/bindings/self_owned_receiver.h"
  9. #include "services/shape_detection/barcode_detection_impl_barhopper.h"
  10. #include "services/shape_detection/public/mojom/barcodedetection.mojom.h"
  11. #include "services/shape_detection/public/mojom/barcodedetection_provider.mojom.h"
  12. namespace shape_detection {
  13. // static
  14. void BarcodeDetectionProviderBarhopper::Create(
  15. mojo::PendingReceiver<mojom::BarcodeDetectionProvider> receiver) {
  16. mojo::MakeSelfOwnedReceiver(
  17. std::make_unique<BarcodeDetectionProviderBarhopper>(),
  18. std::move(receiver));
  19. }
  20. void BarcodeDetectionProviderBarhopper::CreateBarcodeDetection(
  21. mojo::PendingReceiver<shape_detection::mojom::BarcodeDetection> receiver,
  22. shape_detection::mojom::BarcodeDetectorOptionsPtr options) {
  23. mojo::MakeSelfOwnedReceiver(
  24. std::make_unique<BarcodeDetectionImplBarhopper>(std::move(options)),
  25. std::move(receiver));
  26. }
  27. void BarcodeDetectionProviderBarhopper::EnumerateSupportedFormats(
  28. EnumerateSupportedFormatsCallback callback) {
  29. std::move(callback).Run(BarcodeDetectionImplBarhopper::GetSupportedFormats());
  30. }
  31. } // namespace shape_detection