| 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 FaceDetector_h | 5 #ifndef BarcodeDetector_h |
| 6 #define FaceDetector_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 "public/platform/modules/shapedetection/shapedetection.mojom-blink.h" | 14 #include "public/platform/modules/shapedetection/shapedetection.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 FaceDetector final | 20 class MODULES_EXPORT BarcodeDetector final : public ShapeDetector, |
| 20 : public GarbageCollectedFinalized<FaceDetector>, | 21 public ScriptWrappable { |
| 21 public ScriptWrappable { | |
| 22 DEFINE_WRAPPERTYPEINFO(); | 22 DEFINE_WRAPPERTYPEINFO(); |
| 23 | 23 |
| 24 public: | 24 public: |
| 25 static FaceDetector* create(ScriptState*); | 25 static BarcodeDetector* create(ScriptState*); |
| 26 | 26 |
| 27 ScriptPromise detect(ScriptState*, const CanvasImageSourceUnion&); | 27 ScriptPromise detect(ScriptState*, const CanvasImageSourceUnion&); |
| 28 DECLARE_TRACE(); | 28 DECLARE_VIRTUAL_TRACE(); |
| 29 | 29 |
| 30 private: | 30 private: |
| 31 explicit FaceDetector(LocalFrame&); | 31 explicit BarcodeDetector(LocalFrame&); |
| 32 ScriptPromise detectFacesOnImageElement(ScriptPromiseResolver*, | 32 ~BarcodeDetector() override = default; |
| 33 const HTMLImageElement*); | |
| 34 ScriptPromise detectFacesOnImageBitmap(ScriptPromiseResolver*, ImageBitmap*); | |
| 35 ScriptPromise detectFacesOnVideoElement(ScriptPromiseResolver*, | |
| 36 const HTMLVideoElement*); | |
| 37 | |
| 38 ScriptPromise detectFacesOnData(ScriptPromiseResolver*, | |
| 39 uint8_t* data, | |
| 40 int size, | |
| 41 int width, | |
| 42 int height); | |
| 43 void onDetectFace(ScriptPromiseResolver*, | |
| 44 mojom::blink::FaceDetectionResultPtr); | |
| 45 | |
| 46 mojom::blink::ShapeDetectionPtr m_service; | |
| 47 | |
| 48 HeapHashSet<Member<ScriptPromiseResolver>> m_serviceRequests; | |
| 49 }; | 33 }; |
| 50 | 34 |
| 51 } // namespace blink | 35 } // namespace blink |
| 52 | 36 |
| 53 #endif // FaceDetector_h | 37 #endif // BarcodeDetector_h |
| OLD | NEW |