Bug 1763869 [wpt PR 33577] - Fix adb command to find webview package, a=testonly
[gecko.git] / widget / TextRecognition.h
blob70e0260b12893ff8cb0f0b107103c0566d55d5e8
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #ifndef mozilla_widget_nsTextRecognition__
6 #define mozilla_widget_nsTextRecognition__
8 #include "mozilla/MozPromise.h"
9 #include "mozilla/gfx/Point.h"
10 #include "nsTArray.h"
12 class imgIContainer;
13 namespace mozilla {
15 namespace dom {
16 class ShadowRoot;
17 class TextRecognitionResultOrError;
18 class TextRecognitionResult;
19 } // namespace dom
21 namespace gfx {
22 class SourceSurface;
23 class DataSourceSurface;
24 } // namespace gfx
26 namespace widget {
28 class TextRecognition final {
29 public:
30 using NativePromise = MozPromise<dom::TextRecognitionResult, nsCString,
31 /* IsExclusive = */ true>;
33 TextRecognition() = default;
35 static void FillShadow(dom::ShadowRoot&, const dom::TextRecognitionResult&);
37 static RefPtr<NativePromise> FindText(imgIContainer&);
38 static RefPtr<NativePromise> FindText(gfx::DataSourceSurface&);
40 protected:
41 // This should be implemented in the OS specific file.
42 static RefPtr<NativePromise> DoFindText(gfx::DataSourceSurface&);
44 ~TextRecognition() = default;
47 } // namespace widget
48 } // namespace mozilla
50 #endif