| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef BarcodeDetector_h | 5 #ifndef BarcodeDetector_h |
| 6 #define BarcodeDetector_h | 6 #define BarcodeDetector_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScriptPromise.h" | 8 #include "bindings/core/v8/ScriptPromise.h" |
| 9 #include "bindings/core/v8/ScriptPromiseResolver.h" | 9 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 10 #include "bindings/core/v8/ScriptWrappable.h" | 10 #include "bindings/core/v8/ScriptWrappable.h" |
| 11 #include "modules/ModulesExport.h" | 11 #include "modules/ModulesExport.h" |
| 12 #include "modules/canvas2d/CanvasRenderingContext2D.h" | 12 #include "modules/canvas2d/CanvasRenderingContext2D.h" |
| 13 #include "modules/shapedetection/ShapeDetector.h" | 13 #include "modules/shapedetection/ShapeDetector.h" |
| 14 #include "services/shape_detection/public/interfaces/barcodedetection.mojom-blin
k.h" | 14 #include "services/shape_detection/public/interfaces/barcodedetection.mojom-blin
k.h" |
| 15 | 15 |
| 16 namespace blink { | 16 namespace blink { |
| 17 | 17 |
| 18 class LocalFrame; | |
| 19 | |
| 20 class MODULES_EXPORT BarcodeDetector final : public ShapeDetector, | 18 class MODULES_EXPORT BarcodeDetector final : public ShapeDetector, |
| 21 public ScriptWrappable { | 19 public ScriptWrappable { |
| 22 DEFINE_WRAPPERTYPEINFO(); | 20 DEFINE_WRAPPERTYPEINFO(); |
| 23 | 21 |
| 24 public: | 22 public: |
| 25 static BarcodeDetector* create(Document&); | 23 static BarcodeDetector* create(); |
| 26 | 24 |
| 27 DECLARE_VIRTUAL_TRACE(); | 25 DECLARE_VIRTUAL_TRACE(); |
| 28 | 26 |
| 29 private: | 27 private: |
| 30 explicit BarcodeDetector(LocalFrame&); | 28 BarcodeDetector(); |
| 31 ~BarcodeDetector() override = default; | 29 ~BarcodeDetector() override = default; |
| 32 | 30 |
| 33 ScriptPromise doDetect(ScriptPromiseResolver*, | 31 ScriptPromise doDetect(ScriptPromiseResolver*, |
| 34 mojo::ScopedSharedBufferHandle, | 32 mojo::ScopedSharedBufferHandle, |
| 35 int imageWidth, | 33 int imageWidth, |
| 36 int imageHeight) override; | 34 int imageHeight) override; |
| 37 void onDetectBarcodes( | 35 void onDetectBarcodes( |
| 38 ScriptPromiseResolver*, | 36 ScriptPromiseResolver*, |
| 39 Vector<shape_detection::mojom::blink::BarcodeDetectionResultPtr>); | 37 Vector<shape_detection::mojom::blink::BarcodeDetectionResultPtr>); |
| 40 void onBarcodeServiceConnectionError(); | 38 void onBarcodeServiceConnectionError(); |
| 41 | 39 |
| 42 shape_detection::mojom::blink::BarcodeDetectionPtr m_barcodeService; | 40 shape_detection::mojom::blink::BarcodeDetectionPtr m_barcodeService; |
| 43 | 41 |
| 44 HeapHashSet<Member<ScriptPromiseResolver>> m_barcodeServiceRequests; | 42 HeapHashSet<Member<ScriptPromiseResolver>> m_barcodeServiceRequests; |
| 45 }; | 43 }; |
| 46 | 44 |
| 47 } // namespace blink | 45 } // namespace blink |
| 48 | 46 |
| 49 #endif // BarcodeDetector_h | 47 #endif // BarcodeDetector_h |
| OLD | NEW |