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 FaceDetector_h |
6 #define FaceDetector_h | 6 #define FaceDetector_h |
7 | 7 |
8 #include "bindings/core/v8/ScriptPromise.h" | 8 #include "bindings/core/v8/ScriptPromise.h" |
| 9 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 10 #include "bindings/core/v8/ScriptWrappable.h" |
9 #include "modules/ModulesExport.h" | 11 #include "modules/ModulesExport.h" |
10 #include "modules/shapedetection/Detector.h" | 12 #include "public/platform/modules/shapedetection/shapedetection.mojom-blink.h" |
11 | 13 |
12 namespace blink { | 14 namespace blink { |
13 | 15 |
14 class MODULES_EXPORT FaceDetector final : public Detector { | 16 class Document; |
| 17 class HTMLImageElement; |
| 18 class LocalFrame; |
| 19 |
| 20 class MODULES_EXPORT FaceDetector final |
| 21 : public GarbageCollectedFinalized<FaceDetector>, |
| 22 public ScriptWrappable { |
15 DEFINE_WRAPPERTYPEINFO(); | 23 DEFINE_WRAPPERTYPEINFO(); |
16 | 24 |
17 public: | 25 public: |
18 static FaceDetector* create(); | 26 static FaceDetector* create(const Document&); |
| 27 ScriptPromise detect(ScriptState*, const HTMLImageElement*); |
| 28 DECLARE_TRACE(); |
19 | 29 |
20 ScriptPromise detect(ScriptState*, const HTMLImageElement*); | 30 private: |
| 31 explicit FaceDetector(LocalFrame&); |
| 32 void onDetectFace(ScriptPromiseResolver*, |
| 33 mojom::blink::FaceDetectionResultPtr); |
| 34 |
| 35 mojom::blink::ShapeDetectionPtr m_service; |
| 36 |
| 37 HeapHashSet<Member<ScriptPromiseResolver>> m_serviceRequests; |
21 }; | 38 }; |
22 | 39 |
23 } // namespace blink | 40 } // namespace blink |
24 | 41 |
25 #endif // FaceDetector_h | 42 #endif // FaceDetector_h |
OLD | NEW |