Chromium Code Reviews| 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 ShapeDetector_h | 5 #ifndef ShapeDetector_h |
| 6 #define ShapeDetector_h | 6 #define ShapeDetector_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 "modules/ModulesExport.h" | 10 #include "modules/ModulesExport.h" |
| 11 #include "modules/canvas2d/CanvasRenderingContext2D.h" | 11 #include "modules/canvas2d/CanvasRenderingContext2D.h" |
| 12 #include "modules/shapedetection/FaceDetectorOptions.h" | 12 #include "modules/shapedetection/FaceDetectorOptions.h" |
| 13 #include "public/platform/modules/shapedetection/shapedetection.mojom-blink.h" | 13 #include "public/platform/modules/shapedetection/shapedetection.mojom-blink.h" |
| 14 | 14 |
| 15 namespace blink { | 15 namespace blink { |
| 16 | 16 |
| 17 class LocalFrame; | 17 class LocalFrame; |
| 18 | 18 |
| 19 class MODULES_EXPORT ShapeDetector | 19 class MODULES_EXPORT ShapeDetector |
| 20 : public GarbageCollectedFinalized<ShapeDetector> { | 20 : public GarbageCollectedFinalized<ShapeDetector> { |
| 21 public: | 21 public: |
| 22 enum class DetectorType { | 22 enum class DetectorType { |
| 23 Face, | 23 Face, |
| 24 Barcode | 24 Barcode |
| 25 // TODO(mcasas): Implement TextDetector after | 25 // TODO(mcasas): Implement TextDetector after |
| 26 // https://github.com/WICG/shape-detection-api/issues/6 | 26 // https://github.com/WICG/shape-detection-api/issues/6 |
| 27 }; | 27 }; |
| 28 explicit ShapeDetector(LocalFrame&); | 28 explicit ShapeDetector(LocalFrame&); |
| 29 explicit ShapeDetector(LocalFrame&, const FaceDetectorOptions&); | |
|
haraken
2016/11/23 01:37:33
Nit: Drop explicit.
| |
| 29 virtual ~ShapeDetector() = default; | 30 virtual ~ShapeDetector() = default; |
| 30 | 31 |
| 31 ScriptPromise detectShapes(ScriptState*, | 32 ScriptPromise detectShapes(ScriptState*, |
| 32 DetectorType, | 33 DetectorType, |
| 33 const CanvasImageSourceUnion&); | 34 const CanvasImageSourceUnion&); |
| 34 DECLARE_VIRTUAL_TRACE(); | 35 DECLARE_VIRTUAL_TRACE(); |
| 35 | 36 |
| 36 private: | 37 private: |
| 37 ScriptPromise detectShapesOnImageElement(DetectorType, | 38 ScriptPromise detectShapesOnImageElement(DetectorType, |
| 38 ScriptPromiseResolver*, | 39 ScriptPromiseResolver*, |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 59 | 60 |
| 60 HeapHashSet<Member<ScriptPromiseResolver>> m_serviceRequests; | 61 HeapHashSet<Member<ScriptPromiseResolver>> m_serviceRequests; |
| 61 | 62 |
| 62 protected: | 63 protected: |
| 63 mojom::blink::FaceDetectorOptionsPtr m_options; | 64 mojom::blink::FaceDetectorOptionsPtr m_options; |
| 64 }; | 65 }; |
| 65 | 66 |
| 66 } // namespace blink | 67 } // namespace blink |
| 67 | 68 |
| 68 #endif // ShapeDetector_h | 69 #endif // ShapeDetector_h |
| OLD | NEW |