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 "core/imagebitmap/ImageBitmapFactories.h" | 10 #include "core/imagebitmap/ImageBitmapFactories.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 "services/shape_detection/public/interfaces/facedetection.mojom-blink.h " | |
|
xianglu
2017/01/18 21:08:38
nit: I might use "#include "skia/public/interfaces
| |
| 13 | 14 |
| 14 namespace blink { | 15 namespace blink { |
| 15 | 16 |
| 16 class LocalFrame; | 17 class LocalFrame; |
| 17 | 18 |
| 18 class MODULES_EXPORT ShapeDetector | 19 class MODULES_EXPORT ShapeDetector |
| 19 : public GarbageCollectedFinalized<ShapeDetector> { | 20 : public GarbageCollectedFinalized<ShapeDetector> { |
| 20 public: | 21 public: |
| 21 // TODO(mcasas): Implement TextDetector after | 22 // TODO(mcasas): Implement TextDetector after |
| 22 // https://github.com/WICG/shape-detection-api/issues/6 | 23 // https://github.com/WICG/shape-detection-api/issues/6 |
| 23 explicit ShapeDetector(LocalFrame&); | 24 explicit ShapeDetector(LocalFrame&); |
| 24 virtual ~ShapeDetector() = default; | 25 virtual ~ShapeDetector() = default; |
| 25 | 26 |
| 26 ScriptPromise detect(ScriptState*, const ImageBitmapSourceUnion&); | 27 ScriptPromise detect(ScriptState*, const ImageBitmapSourceUnion&); |
| 27 DEFINE_INLINE_VIRTUAL_TRACE() {} | 28 DEFINE_INLINE_VIRTUAL_TRACE() {} |
| 28 | 29 |
| 29 private: | 30 private: |
| 30 ScriptPromise detectShapesOnImageData(ScriptPromiseResolver*, ImageData*); | 31 ScriptPromise detectShapesOnImageData(ScriptPromiseResolver*, ImageData*); |
| 31 ScriptPromise detectShapesOnImageElement(ScriptPromiseResolver*, | 32 ScriptPromise detectShapesOnImageElement(ScriptPromiseResolver*, |
| 32 const HTMLImageElement*); | 33 const HTMLImageElement*); |
| 33 | 34 |
| 34 virtual ScriptPromise doDetect(ScriptPromiseResolver*, | 35 virtual ScriptPromise doDetect(ScriptPromiseResolver*, |
| 35 mojo::ScopedSharedBufferHandle, | 36 skia::mojom::blink::BitmapPtr) = 0; |
| 36 int imageWidth, | |
| 37 int imageHeight) = 0; | |
| 38 }; | 37 }; |
| 39 | 38 |
| 40 } // namespace blink | 39 } // namespace blink |
| 41 | 40 |
| 42 #endif // ShapeDetector_h | 41 #endif // ShapeDetector_h |
| OLD | NEW |