| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef TextDetector_h |
| 6 #define TextDetector_h |
| 7 |
| 8 #include "bindings/core/v8/ScriptPromise.h" |
| 9 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 10 #include "bindings/core/v8/ScriptWrappable.h" |
| 11 #include "modules/ModulesExport.h" |
| 12 #include "modules/canvas2d/CanvasRenderingContext2D.h" |
| 13 #include "modules/shapedetection/ShapeDetector.h" |
| 14 #include "public/platform/modules/shapedetection/textdetection.mojom-blink.h" |
| 15 |
| 16 namespace blink { |
| 17 |
| 18 class LocalFrame; |
| 19 |
| 20 class MODULES_EXPORT TextDetector final : public ShapeDetector, |
| 21 public ScriptWrappable { |
| 22 DEFINE_WRAPPERTYPEINFO(); |
| 23 |
| 24 public: |
| 25 static TextDetector* create(Document&); |
| 26 |
| 27 DECLARE_VIRTUAL_TRACE(); |
| 28 |
| 29 private: |
| 30 explicit TextDetector(LocalFrame&); |
| 31 ~TextDetector() override = default; |
| 32 |
| 33 ScriptPromise doDetect(ScriptPromiseResolver*, |
| 34 mojo::ScopedSharedBufferHandle, |
| 35 int imageWidth, |
| 36 int imageHeight) override; |
| 37 void onDetectText(ScriptPromiseResolver*, |
| 38 Vector<mojom::blink::TextDetectionResultPtr>); |
| 39 void onTextServiceConnectionError(); |
| 40 |
| 41 mojom::blink::TextDetectionPtr m_textService; |
| 42 |
| 43 HeapHashSet<Member<ScriptPromiseResolver>> m_textServiceRequests; |
| 44 }; |
| 45 |
| 46 } // namespace blink |
| 47 |
| 48 #endif // TextDetector_h |
| OLD | NEW |