Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(758)

Unified Diff: third_party/WebKit/Source/modules/shapedetection/TextDetector.h

Issue 2588293005: Shape Detection: Add Text Detection in Chrome Android (Closed)
Patch Set: jochen@ comments, rebase Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/shapedetection/TextDetector.h
diff --git a/third_party/WebKit/Source/modules/shapedetection/TextDetector.h b/third_party/WebKit/Source/modules/shapedetection/TextDetector.h
new file mode 100644
index 0000000000000000000000000000000000000000..ac71997353c1e96e0e0faa2aae2999be335b5181
--- /dev/null
+++ b/third_party/WebKit/Source/modules/shapedetection/TextDetector.h
@@ -0,0 +1,48 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef TextDetector_h
+#define TextDetector_h
+
+#include "bindings/core/v8/ScriptPromise.h"
+#include "bindings/core/v8/ScriptPromiseResolver.h"
+#include "bindings/core/v8/ScriptWrappable.h"
+#include "modules/ModulesExport.h"
+#include "modules/canvas2d/CanvasRenderingContext2D.h"
+#include "modules/shapedetection/ShapeDetector.h"
+#include "public/platform/modules/shapedetection/textdetection.mojom-blink.h"
+
+namespace blink {
+
+class LocalFrame;
+
+class MODULES_EXPORT TextDetector final : public ShapeDetector,
+ public ScriptWrappable {
+ DEFINE_WRAPPERTYPEINFO();
+
+ public:
+ static TextDetector* create(Document&);
+
+ DECLARE_VIRTUAL_TRACE();
+
+ private:
+ explicit TextDetector(LocalFrame&);
+ ~TextDetector() override = default;
+
+ ScriptPromise doDetect(ScriptPromiseResolver*,
+ mojo::ScopedSharedBufferHandle,
+ int imageWidth,
+ int imageHeight) override;
+ void onDetectText(ScriptPromiseResolver*,
+ Vector<mojom::blink::TextDetectionResultPtr>);
+ void onTextServiceConnectionError();
+
+ mojom::blink::TextDetectionPtr m_textService;
+
+ HeapHashSet<Member<ScriptPromiseResolver>> m_textServiceRequests;
+};
+
+} // namespace blink
+
+#endif // TextDetector_h

Powered by Google App Engine
This is Rietveld 408576698