| 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 "public/platform/modules/shapedetection/barcodedetection.mojom-blink.h" |
| 14 | 15 |
| 15 namespace blink { | 16 namespace blink { |
| 16 | 17 |
| 17 class LocalFrame; | 18 class LocalFrame; |
| 18 | 19 |
| 19 class MODULES_EXPORT BarcodeDetector final : public ShapeDetector, | 20 class MODULES_EXPORT BarcodeDetector final : public ShapeDetector, |
| 20 public ScriptWrappable { | 21 public ScriptWrappable { |
| 21 DEFINE_WRAPPERTYPEINFO(); | 22 DEFINE_WRAPPERTYPEINFO(); |
| 22 | 23 |
| 23 public: | 24 public: |
| 24 static BarcodeDetector* create(Document&); | 25 static BarcodeDetector* create(Document&); |
| 25 | 26 |
| 26 ScriptPromise detect(ScriptState*, const CanvasImageSourceUnion&); | |
| 27 DECLARE_VIRTUAL_TRACE(); | 27 DECLARE_VIRTUAL_TRACE(); |
| 28 | 28 |
| 29 private: | 29 private: |
| 30 explicit BarcodeDetector(LocalFrame&); | 30 explicit BarcodeDetector(LocalFrame&); |
| 31 ~BarcodeDetector() override = default; | 31 ~BarcodeDetector() override = default; |
| 32 |
| 33 ScriptPromise doDetect(ScriptPromiseResolver*, |
| 34 mojo::ScopedSharedBufferHandle, |
| 35 int imageWidth, |
| 36 int imageHeight) override; |
| 37 void onDetectBarcodes(ScriptPromiseResolver*, |
| 38 Vector<mojom::blink::BarcodeDetectionResultPtr>); |
| 39 void onBarcodeServiceConnectionError(); |
| 40 |
| 41 mojom::blink::BarcodeDetectionPtr m_barcodeService; |
| 42 |
| 43 HeapHashSet<Member<ScriptPromiseResolver>> m_barcodeServiceRequests; |
| 32 }; | 44 }; |
| 33 | 45 |
| 34 } // namespace blink | 46 } // namespace blink |
| 35 | 47 |
| 36 #endif // BarcodeDetector_h | 48 #endif // BarcodeDetector_h |
| OLD | NEW |