• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022-2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef NWEB_H
17 #define NWEB_H
18 
19 #include <list>
20 #include <map>
21 #include <memory>
22 #include <string>
23 
24 #include "nweb_accessibility_event_callback.h"
25 #include "nweb_accessibility_node_info.h"
26 #include "nweb_download_callback.h"
27 #include "nweb_drag_data.h"
28 #include "nweb_export.h"
29 #include "nweb_find_callback.h"
30 #include "nweb_history_list.h"
31 #include "nweb_hit_testresult.h"
32 #include "nweb_javascript_result_callback.h"
33 #include "nweb_native_media_player.h"
34 #include "nweb_preference.h"
35 #include "nweb_release_surface_callback.h"
36 #include "nweb_spanstring_convert_html_callback.h"
37 #include "nweb_value_callback.h"
38 #include "nweb_web_message.h"
39 
40 namespace OHOS::NWeb {
41 
42 class NWebHandler;
43 class NWebValue;
44 
45 /**
46  * @brief Describes how pixel bits encoder color data.
47  */
48 enum class ImageColorType {
49     // Unknown color type.
50     COLOR_TYPE_UNKNOWN = -1,
51 
52     // RGBA with 8 bits per pixel (32bits total).
53     COLOR_TYPE_RGBA_8888 = 0,
54 
55     // BGRA with 8 bits per pixel (32bits total).
56     COLOR_TYPE_BGRA_8888 = 1,
57 };
58 
59 /**
60  * @brief Describes how to interpret the alpha value of a pixel.
61  */
62 enum class ImageAlphaType {
63     // Unknown alpha type.
64     ALPHA_TYPE_UNKNOWN = -1,
65 
66     // No transparency. The alpha component is ignored.
67     ALPHA_TYPE_OPAQUE = 0,
68 
69     // Transparency with pre-multiplied alpha component.
70     ALPHA_TYPE_PREMULTIPLIED = 1,
71 
72     // Transparency with post-multiplied alpha component.
73     ALPHA_TYPE_POSTMULTIPLIED = 2,
74 };
75 
76 class OHOS_NWEB_EXPORT NWebEngineInitArgs {
77 public:
78     virtual ~NWebEngineInitArgs() = default;
79 
80     virtual std::string GetDumpPath() = 0;
81     virtual bool GetIsFrameInfoDump() = 0;
82     virtual std::list<std::string> GetArgsToAdd() = 0;
83     virtual std::list<std::string> GetArgsToDelete() = 0;
84     virtual bool GetIsMultiRendererProcess() = 0;
85     virtual bool GetIsEnhanceSurface() = 0;
86     virtual bool GetIsPopup() = 0;
GetSharedRenderProcessToken()87     virtual std::string GetSharedRenderProcessToken() {return "";}
88 };
89 
90 class OHOS_NWEB_EXPORT NWebOutputFrameCallback {
91 public:
92     virtual ~NWebOutputFrameCallback() = default;
93 
94     virtual bool Handle(const char* buffer, uint32_t width, uint32_t height) = 0;
95 };
96 
97 class OHOS_NWEB_EXPORT NWebCreateInfo {
98 public:
99     virtual ~NWebCreateInfo() = default;
100 
101     /* size info */
102     virtual uint32_t GetWidth() = 0;
103     virtual uint32_t GetHeight() = 0;
104 
105     /* output frame cb */
106     virtual std::shared_ptr<NWebOutputFrameCallback> GetOutputFrameCallback() = 0;
107 
108     /* init args */
109     virtual std::shared_ptr<NWebEngineInitArgs> GetEngineInitArgs() = 0;
110 
111     /* rs producer surface, for acquiring elgsurface from ohos */
112     virtual void* GetProducerSurface() = 0;
113     virtual void* GetEnhanceSurfaceInfo() = 0;
114 
115     virtual bool GetIsIncognitoMode() = 0;
116 };
117 
118 enum class OHOS_NWEB_EXPORT DragAction {
119     DRAG_START = 0,
120     DRAG_ENTER,
121     DRAG_LEAVE,
122     DRAG_OVER,
123     DRAG_DROP,
124     DRAG_END,
125     DRAG_CANCEL,
126 };
127 
128 class NWebDragEvent {
129 public:
130     virtual ~NWebDragEvent() = default;
131 
132     virtual double GetX() = 0;
133     virtual double GetY() = 0;
134     virtual DragAction GetAction() = 0;
135 };
136 
137 enum class BlurReason : int32_t {
138     FOCUS_SWITCH = 0,
139     WINDOW_BLUR = 1,
140     FRAME_DESTROY = 2, // frame node detached from main tree
141     VIEW_SWITCH = 3,
142     CLEAR_FOCUS = 4, // User api clearFocus triggered
143 };
144 
145 enum class FocusReason : int32_t {
146     FOCUS_DEFAULT = 0,
147     EVENT_REQUEST = 1,
148 };
149 
150 enum class RenderProcessMode : int32_t {
151     SINGLE_MODE = 0,
152     MULTIPLE_MODE = 1,
153 };
154 
155 class NWebTouchPointInfo {
156 public:
157     virtual ~NWebTouchPointInfo() = default;
158 
159     virtual int GetId() = 0;
160     virtual double GetX() = 0;
161     virtual double GetY() = 0;
162 };
163 
164 enum class NestedScrollMode : int32_t {
165     SELF_ONLY = 0,
166     SELF_FIRST = 1,
167     PARENT_FIRST = 2,
168     PARALLEL = 3,
169 };
170 
171 class NWebScreenLockCallback {
172 public:
173     virtual ~NWebScreenLockCallback() = default;
174 
175     virtual void Handle(bool key) = 0;
176 };
177 
178 typedef char* (*NativeArkWebOnJavaScriptProxyCallback)(const char**, int32_t);
179 class NWebJsProxyCallback {
180 public:
181     virtual ~NWebJsProxyCallback() = default;
182 
183     virtual std::string GetMethodName() = 0;
184 
185     virtual NativeArkWebOnJavaScriptProxyCallback GetMethodCallback() = 0;
186 };
187 
188 class OHOS_NWEB_EXPORT NWebEnginePrefetchArgs {
189 public:
190     virtual ~NWebEnginePrefetchArgs() = default;
191 
192     virtual std::string GetUrl() = 0;
193     virtual std::string GetMethod() = 0;
194     virtual std::string GetFormData() = 0;
195 };
196 
197 enum class PrecompileError : int32_t { OK = 0, INTERNAL_ERROR = -1 };
198 
199 class OHOS_NWEB_EXPORT CacheOptions {
200 public:
201     virtual ~CacheOptions() = default;
202 
203     virtual std::map<std::string, std::string> GetResponseHeaders() = 0;
204 };
205 
206 enum class PixelUnit {
207     PX = 0,
208     VP = 1,
209     PERCENTAGE = 2,
210     NONE = 3,
211 };
212 
213 typedef int64_t (*AccessibilityIdGenerateFunc)();
214 typedef void (*NativeArkWebOnValidCallback)(const char*);
215 typedef void (*NativeArkWebOnDestroyCallback)(const char*);
216 using ScriptItems = std::map<std::string, std::vector<std::string>>;
217 using WebSnapshotCallback = std::function<void(const char*, bool, float, void*, int, int)>;
218 
219 enum class SystemThemeFlags : uint8_t {
220     NONE = 0,
221     THEME_FONT = 1 << 0,
222 };
223 
224 class NWebSystemConfiguration {
225     public:
226     virtual ~NWebSystemConfiguration() = default;
227 
228     virtual uint8_t GetThemeFlags() = 0;
229 };
230 
231 class OHOS_NWEB_EXPORT NWeb : public std::enable_shared_from_this<NWeb> {
232 public:
233     NWeb() = default;
234     virtual ~NWeb() = default;
235 
236     virtual void Resize(uint32_t width, uint32_t height, bool isKeyboard = false) = 0;
237 
238     /* lifecycle interface */
239     virtual void OnPause() = 0;
240     virtual void OnContinue() = 0;
241     virtual void OnDestroy() = 0;
242 
243     /* focus event */
244     virtual void OnFocus(const FocusReason& focusReason = FocusReason::FOCUS_DEFAULT) = 0;
245     virtual void OnBlur(const BlurReason& blurReason) = 0;
246 
247     /* event interface */
248     virtual void OnTouchPress(int32_t id, double x, double y, bool fromOverlay = false) = 0;
249     virtual void OnTouchRelease(int32_t id, double x = 0, double y = 0, bool fromOverlay = false) = 0;
250     virtual void OnTouchMove(int32_t id, double x, double y, bool fromOverlay = false) = 0;
251     virtual void OnTouchMove(
252         const std::vector<std::shared_ptr<NWebTouchPointInfo>>& touch_point_infos, bool fromOverlay = false) = 0;
253     virtual void OnTouchCancel() = 0;
254     virtual void OnNavigateBack() = 0;
255     virtual bool SendKeyEvent(int32_t keyCode, int32_t keyAction) = 0;
256     virtual void SendMouseWheelEvent(double x, double y, double deltaX, double deltaY) = 0;
257     virtual void SendMouseEvent(int x, int y, int button, int action, int count) = 0;
258 
259     /**
260      * Loads the given URL.
261      *
262      * @param url String: the URL of the resource to load This value cannot be
263      * null.
264      *
265      * @return title string for the current page.
266      */
267     virtual int Load(const std::string& url) = 0;
268     /**
269      * Gets whether this NWeb has a back history item.
270      *
271      * @return true if this NWeb has a back history item
272      */
273     virtual bool IsNavigatebackwardAllowed() = 0;
274     /**
275      * Gets whether this NWeb has a forward history item.
276      *
277      * @return true if this NWeb has a forward history item
278      */
279     virtual bool IsNavigateForwardAllowed() = 0;
280     /**
281      * Gets whether this NWeb has a back or forward history item for number of
282      * steps.
283      *
284      * @param numSteps int: the negative or positive number of steps to move the
285      * history
286      * @return true if this NWeb has a forward history item
287      */
288     virtual bool CanNavigateBackOrForward(int numSteps) = 0;
289     /**
290      * Goes back in the history of this NWeb.
291      *
292      */
293     virtual void NavigateBack() = 0;
294     /**
295      * Goes forward in the history of this NWeb.
296      *
297      */
298     virtual void NavigateForward() = 0;
299     /**
300      * Goes to the history item that is the number of steps away from the current item.
301      *
302      */
303     virtual void NavigateBackOrForward(int step) = 0;
304     /**
305      * Delete back and forward history list.
306      */
307     virtual void DeleteNavigateHistory() = 0;
308 
309     /**
310      * Reloads the current URL.
311      *
312      */
313     virtual void Reload() = 0;
314     /**
315      * Performs a zoom operation in this NWeb.
316      *
317      * @param zoomFactor float: the zoom factor to apply. The zoom factor will be
318      * clamped to the NWeb's zoom limits. This value must be in the range 0.01
319      * to 100.0 inclusive.
320      *
321      * @return the error id.
322      *
323      */
324     virtual int Zoom(float zoomFactor) = 0;
325     /**
326      * Performs a zooming in operation in this NWeb.
327      *
328      * @return the error id.
329      *
330      */
331     virtual int ZoomIn() = 0;
332     /**
333      * Performs a zooming out operation in this NWeb.
334      *
335      * @return the error id.
336      *
337      */
338     virtual int ZoomOut() = 0;
339     /**
340      * Stops the current load.
341      *
342      * @param code string: javascript code
343      */
344     virtual void Stop() = 0;
345     /**
346      * ExecuteJavaScript
347      *
348      */
349     virtual void ExecuteJavaScript(const std::string& code) = 0;
350     /**
351      * ExecuteJavaScript plus
352      *
353      * @param code string: javascript code
354      *
355      * @param callback NWebValueCallback: javascript running result
356      *
357      */
358     virtual void ExecuteJavaScript(
359         const std::string& code, std::shared_ptr<NWebMessageValueCallback> callback, bool extention) = 0;
360     /**
361      * ExecuteJavaScript with ashmem
362      *
363      * @param fd fd of the ashmem
364      * @param scriptLength javascript code length
365      * @param callback NWebValueCallback: javascript running result
366      * @param extention true if is extention
367      */
368     virtual void ExecuteJavaScriptExt(const int fd, const size_t scriptLength,
369         std::shared_ptr<NWebMessageValueCallback> callback, bool extention) = 0;
370     /**
371      * Gets the NWebPreference object used to control the settings for this
372      * NWeb.
373      *
374      * @return a NWebPreference object that can be used to control this NWeb's
375      * settings This value cannot be null.
376      */
377     virtual std::shared_ptr<NWebPreference> GetPreference() = 0;
378     /**
379      * Gets the web id.
380      *
381      * @return the web id
382      */
383     virtual unsigned int GetWebId() = 0;
384     /**
385      * Gets the last hit test result.
386      *
387      * @return the last HitTestResult
388      */
389     virtual std::shared_ptr<HitTestResult> GetHitTestResult() = 0;
390 
391     /**
392      * Sets the background color for this view.
393      *
394      * @param color int: the color of the background
395      *
396      */
397     virtual void PutBackgroundColor(int color) = 0;
398 
399     /**
400      * Sets the initla scale for the page.
401      *
402      * @param scale float: the initla scale of the page.
403      *
404      */
405     virtual void InitialScale(float scale) = 0;
406     /**
407      * Sets the NWebDownloadCallback that will receive download event.
408      * This will replace the current handler.
409      *
410      * @param downloadListener NWebDownloadCallback:
411      *
412      */
413     virtual void PutDownloadCallback(std::shared_ptr<NWebDownloadCallback> downloadListener) = 0;
414 
415     /**
416      * Set the NWebAccessibilityEventCallback that will receive accessibility event.
417      * This will replace the current handler.
418      *
419      * @param accessibilityEventListener NWebDownloadCallback.
420      */
421     virtual void PutAccessibilityEventCallback(
422         std::shared_ptr<NWebAccessibilityEventCallback> accessibilityEventListener) = 0;
423 
424     /**
425      * Set the accessibility id generator that will generate accessibility id for accessibility nodes in the web.
426      * This will replace the current handler.
427      *
428      * @param accessibilityIdGenerator Accessibility id generator.
429      */
430     virtual void PutAccessibilityIdGenerator(const AccessibilityIdGenerateFunc accessibilityIdGenerator) = 0;
431 
432     /**
433      * Set the NWebHandler that will receive various notifications and
434      * requests. This will replace the current handler.
435      *
436      * @param client NWebHandler: an implementation of NWebHandler This value
437      * cannot be null.
438      *
439      */
440     virtual void SetNWebHandler(std::shared_ptr<NWebHandler> handler) = 0;
441 
442     /**
443      * Gets the title for the current page.
444      *
445      * @return title string for the current page.
446      */
447     virtual std::string Title() = 0;
448 
449     /**
450      * Gets the progress for the current page.
451      *
452      * @return progress for the current page.
453      */
454     virtual int PageLoadProgress() = 0;
455 
456     /**
457      * Gets the height of the HTML content.
458      *
459      * @return the height of the HTML content.
460      */
461     virtual int ContentHeight() = 0;
462 
463     /**
464      * Gets the current scale of this NWeb.
465      *
466      * @return the current scale
467      */
468     virtual float Scale() = 0;
469 
470     /**
471      * Loads the given URL with additional HTTP headers, specified as a map
472      * from name to value. Note that if this map contains any of the headers that
473      * are set by default by this NWeb, such as those controlling caching,
474      * accept types or the User-Agent, their values may be overridden by this
475      * NWeb's defaults.
476      *
477      * @param url  String: the URL of the resource to load This value cannot be
478      * null.
479      *
480      * @param additionalHttpHeaders additionalHttpHeaders
481      */
482     virtual int Load(const std::string& url, const std::map<std::string, std::string>& additionalHttpHeaders) = 0;
483 
484     /**
485      * Loads the given data into this NWeb, using baseUrl as the base URL for
486      * the content. The base URL is used both to resolve relative URLs and when
487      * applying JavaScript's same origin policy. The historyUrl is used for the
488      * history entry.
489      *
490      * @param baseUrl  String: the URL to use as the page's base URL. If null
491      * defaults to 'about:blank'. This value may be null.
492      * @param data String: the URL to use as the page's base URL. If null defaults
493      * to 'about:blank'. This value may be null.
494      * @param mimeType String: the MIME type of the data, e.g. 'text/html'. This
495      * value may be null.
496      * @param encoding String: the encoding of the data This value may be null.
497      * @param historyUrl String: the URL to use as the history entry. If null
498      * defaults to 'about:blank'. If non-null, this must be a valid URL. This
499      * value may be null.
500      */
501     virtual int LoadWithDataAndBaseUrl(const std::string& baseUrl, const std::string& data, const std::string& mimeType,
502         const std::string& encoding, const std::string& historyUrl) = 0;
503 
504     /**
505      * Loads the given data into this NWeb.
506      *
507      * @param data String: the URL to use as the page's base URL. If null defaults
508      * to 'about:blank'. This value may be null.
509      * @param mimeType String: the MIME type of the data, e.g. 'text/html'. This
510      * value may be null.
511      * @param encoding String: the encoding of the data This value may be null.
512      */
513     virtual int LoadWithData(const std::string& data, const std::string& mimeType, const std::string& encoding) = 0;
514 
515     /**
516      * RegisterArkJSfunction
517      *
518      * @param object_name  String: objector name
519      * @param method_list vector<String>: vector list ,method list
520      * @param object_id int32_t: object id
521      */
522     virtual void RegisterArkJSfunction(
523         const std::string& object_name, const std::vector<std::string>& method_list, const int32_t object_id) = 0;
524 
525     /**
526      * UnregisterArkJSfunction
527      *
528      * @param object_name  String: objector name
529      * @param method_list vector<String>: vector list ,method list
530      */
531     virtual void UnregisterArkJSfunction(
532         const std::string& object_name, const std::vector<std::string>& method_list) = 0;
533 
534     /**
535      * SetNWebJavaScriptResultCallBack
536      *
537      * @param callback  NWebJavaScriptResultCallBack: callback client
538      */
539     virtual void SetNWebJavaScriptResultCallBack(std::shared_ptr<NWebJavaScriptResultCallBack> callback) = 0;
540 
541     /**
542      * Set the NWebFindCallback that will receive find event.
543      * This will replace the current handler.
544      *
545      * @param findListener NWebFindCallback : find callback
546      */
547     virtual void PutFindCallback(std::shared_ptr<NWebFindCallback> findListener) = 0;
548 
549     /**
550      * Finds all instances of find on the page and highlights them,
551      * asynchronously.
552      *
553      * @param searchStr String: target string to find.
554      */
555     virtual void FindAllAsync(const std::string& searchStr) = 0;
556 
557     /**
558      * Clears the highlighting surrounding text matches created by findAllAsync
559      *
560      */
561     virtual void ClearMatches() = 0;
562 
563     /**
564      * Highlights and scrolls to the next match found by findAllAsync(String),
565      * wrapping around page boundaries as necessary.
566      *
567      * @param forward bool: find back or forward:
568      */
569     virtual void FindNext(const bool forward) = 0;
570 
571     /**
572      * Saves the current view as a web archive.
573      *
574      * @param baseName the filename where the archive should be placed This
575      * value cannot be null.
576      * @param autoName if false, takes basename to be a file. If true, basename
577      * is assumed to be a directory in which a filename will be chosen according
578      * to the URL of the current page.
579      */
580     virtual void StoreWebArchive(
581         const std::string& baseName, bool autoName, std::shared_ptr<NWebStringValueCallback> callback) = 0;
582 
583     /**
584      * creating two ends of a message channel.
585      *
586      * @return the web message ports get from nweb.
587      */
588     virtual std::vector<std::string> CreateWebMessagePorts() = 0;
589 
590     /**
591      * Posts MessageEvent to the main frame.
592      *
593      * @param message message send to mmain frame.
594      * @param ports the web message ports send to main frame.
595      * @param targetUri the uri which can received the ports.
596      */
597     virtual void PostWebMessage(
598         const std::string& message, const std::vector<std::string>& ports, const std::string& targetUri) = 0;
599 
600     /**
601      * close the message port.
602      *
603      * @param portHandle the port to close.
604      */
605     virtual void ClosePort(const std::string& portHandle) = 0;
606 
607     /**
608      * use the port to send message.
609      *
610      * @param portHandle the port to send message.
611      * @param data the message to send.
612      */
613     virtual void PostPortMessage(const std::string& portHandle, std::shared_ptr<NWebMessage> data) = 0;
614 
615     /**
616      * set the callback of the message port.
617      *
618      * @param portHandle the port to set callback.
619      * @param callback to reveive the result when the other port post message.
620      */
621     virtual void SetPortMessageCallback(
622         const std::string& portHandle, std::shared_ptr<NWebMessageValueCallback> callback) = 0;
623 
624     /**
625      * send drag event to nweb.
626      * @param dragEvent the drag event information.
627      */
628     virtual void SendDragEvent(std::shared_ptr<NWebDragEvent> dragEvent) = 0;
629 
630     /**
631      * Clear ssl cache.
632      */
633     virtual void ClearSslCache() = 0;
634 
635     /**
636      * get web page url.
637      *
638      * @return web page url.
639      */
640     virtual std::string GetUrl() = 0;
641 
642     /**
643      * Clears the client authentication certificate Cache in the Web.
644      *
645      */
646     virtual void ClearClientAuthenticationCache() = 0;
647 
648     /**
649      * set the locale name of current system setting..
650      *
651      * @param locale the locale name of current system setting.
652      */
653     virtual void UpdateLocale(const std::string& language, const std::string& region) = 0;
654 
655     /**
656      * get original url of the request.
657      *
658      * @return original url.
659      */
660     virtual const std::string GetOriginalUrl() = 0;
661 
662     /**
663      * get original url of the request.
664      *
665      * @param data raw image data of the icon.
666      * @param width width of the icon.
667      * @param height height of the icon.
668      * @param colorType the color type of the icon.
669      * @param alphaType the alpha type of the icon.
670      * @return the result of get favicon.
671      */
672     virtual bool GetFavicon(
673         const void** data, size_t& width, size_t& height, ImageColorType& c, ImageAlphaType& alphaType) = 0;
674 
675     /**
676      * set the network status, just notify the webview to change the JS navigatoer.online.
677      *
678      * @param available width of the icon.
679      */
680     virtual void PutNetworkAvailable(bool available) = 0;
681 
682     /**
683      * web has image or not.
684      *
685      * @param callback has image or not
686      */
687     virtual void HasImages(std::shared_ptr<NWebBoolValueCallback> callback) = 0;
688 
689     /**
690      * web remove cache.
691      *
692      * @param include_disk_files bool: if false, only the RAM cache is removed
693      */
694     virtual void RemoveCache(bool include_disk_files) = 0;
695 
696     /**
697      * web has image or not.
698      *
699      * @param web has image or not
700      */
701     virtual std::shared_ptr<NWebHistoryList> GetHistoryList() = 0;
702 
703     /**
704      * Set the NWebReleaseSurfaceCallback that will receive release surface event.
705      * This will replace the current handler.
706      *
707      * @param releaseSurfaceListener NWebReleaseSurfaceCallback.
708      */
709     virtual void PutReleaseSurfaceCallback(std::shared_ptr<NWebReleaseSurfaceCallback> releaseSurfaceListener) = 0;
710 
711     /**
712      * Get web back forward state.
713      *
714      * @return web back forward state.
715      */
716     virtual std::vector<uint8_t> SerializeWebState() = 0;
717 
718     /**
719      * Restore web back forward state.
720      *
721      * @param web back forward state.
722      */
723     virtual bool RestoreWebState(const std::vector<uint8_t>& state) = 0;
724 
725     /**
726      * Move page up.
727      *
728      * @param top whether move to the top.
729      */
730     virtual void PageUp(bool top) = 0;
731 
732     /**
733      * Move page down.
734      *
735      * @param bottom whether move to the bottom.
736      */
737     virtual void PageDown(bool bottom) = 0;
738 
739     /**
740      * Scroll to the position.
741      *
742      * @param x horizontal coordinate.
743      * @param y vertical coordinate.
744      */
745     virtual void ScrollTo(float x, float y) = 0;
746 
747     /**
748      * Scroll by the delta distance.
749      *
750      * @param delta_x horizontal offset.
751      * @param delta_y vertical offset.
752      */
753     virtual void ScrollBy(float delta_x, float delta_y) = 0;
754 
755     /**
756      * Slide scroll by the speed.
757      *
758      * @param vx horizontal slide speed.
759      * @param vy vertical slide speed.
760      */
761     virtual void SlideScroll(float vx, float vy) = 0;
762 
763     /**
764      * Get current website certificate.
765      *
766      * @param certChainData current website certificate array.
767      * @param isSingleCert true if only get one certificate of current website,
768      *                     false if get certificate chain of the website.
769      * @return true if get certificate successfully, otherwise false.
770      */
771     virtual bool GetCertChainDerData(std::vector<std::string>& certChainData, bool isSingleCert) = 0;
772 
773     /**
774      * Set screen offset.
775      *
776      * @param x the offset in x direction.
777      * @param y the offset in y direction.
778      */
779     virtual void SetScreenOffSet(double x, double y) = 0;
780 
781     /**
782      * Set audio muted.
783      *
784      * @param muted Aduio mute state.
785      */
786     virtual void SetAudioMuted(bool muted) = 0;
787 
788     /**
789      * Set should frame submission before draw.
790      *
791      * @param should whether wait render frame submission.
792      */
793     virtual void SetShouldFrameSubmissionBeforeDraw(bool should) = 0;
794 
795     /**
796      * Notify whether the popup window is initialized successfully.
797      *
798      * @param result whether success.
799      */
800     virtual void NotifyPopupWindowResult(bool result) = 0;
801 
802     /**
803      * Set audio resume interval.
804      *
805      * @param resumeInterval Aduio resume interval.
806      */
807     virtual void SetAudioResumeInterval(int32_t resumeInterval) = 0;
808 
809     /**
810      * Set audio exclusive state.
811      *
812      * @param audioExclusive Aduio exclusive state.
813      */
814     virtual void SetAudioExclusive(bool audioExclusive) = 0;
815 
816     /**
817      * Rigest the keep srceen on interface.
818      *
819      * @param windowId the window id.
820      * @param callback the screenon handle callback.
821      */
822     virtual void RegisterScreenLockFunction(int32_t windowId, std::shared_ptr<NWebScreenLockCallback> callback) = 0;
823 
824     /**
825      * UnRigest the keep srceen on interface.
826      *
827      * @param windowId the window id.
828      */
829     virtual void UnRegisterScreenLockFunction(int32_t windowId) = 0;
830 
831     /**
832      * Notify memory level.
833      *
834      * @param level the memory level.
835      */
836     virtual void NotifyMemoryLevel(int32_t level) = 0;
837 
838     /**
839      * Notify webview window status.
840      */
841     virtual void OnWebviewHide() = 0;
842     virtual void OnWebviewShow() = 0;
843 
844     /**
845      * Get drag data.
846      *
847      * @return the drag data.
848      */
849     virtual std::shared_ptr<NWebDragData> GetOrCreateDragData() = 0;
850 
851     /**
852      * Prefetch the resources required by the page, but will not execute js or
853      * render the page.
854      *
855      * @param url  String: Which url to preresolve/preconnect.
856      * @param additionalHttpHeaders Additional HTTP request header of the URL.
857      */
858     virtual void PrefetchPage(
859         const std::string& url, const std::map<std::string, std::string>& additionalHttpHeaders) = 0;
860 
861     /**
862      * Set the window id.
863      */
864     virtual void SetWindowId(uint32_t window_id) = 0;
865 
866     /**
867      * Notify that browser was occluded by other windows.
868      */
869     virtual void OnOccluded() = 0;
870 
871     /**
872      *Notify that browser was unoccluded by other windows.
873      */
874     virtual void OnUnoccluded() = 0;
875 
876     /**
877      * Set the token.
878      */
879     virtual void SetToken(void* token) = 0;
880 
881     /**
882      * Set the nested scroll mode.
883      */
884     virtual void SetNestedScrollMode(const NestedScrollMode& nestedScrollMode) = 0;
885 
886     /**
887      * Set draw rect.
888      *
889      */
890     virtual void SetDrawRect(int32_t x, int32_t y, int32_t width, int32_t height) = 0;
891 
892     /**
893      * Set draw mode.
894      *
895      */
896     virtual void SetDrawMode(int32_t mode) = 0;
897 
898     /**
899      * Create web print document adapter.
900      *
901      */
902     virtual void* CreateWebPrintDocumentAdapter(const std::string& jobName) = 0;
903 
904     /**
905      * Loads the URL with postData using "POST" method into this WebView.
906      * If url is not a network URL, it will be loaded with loadUrl(String) instead.
907      *
908      * @param url String: the URL of the resource to load This value cannot be null.
909      * @param postData the data will be passed to "POST" request,
910      * whilch must be "application/x-www-form-urlencoded" encoded.
911      *
912      * @return title string for the current page.
913      */
914     virtual int PostUrl(const std::string& url, const std::vector<char>& postData) = 0;
915 
916     /**
917      * Set the property values for width, height, and keyboard height.
918      */
919     virtual void SetVirtualKeyBoardArg(int32_t width, int32_t height, double keyboard) = 0;
920 
921     /**
922      * Set the virtual keyboard to override the web status.
923      */
924     virtual bool ShouldVirtualKeyboardOverlay() = 0;
925 
926     /**
927      * Inject the JavaScript before WebView load the DOM tree.
928      */
929     virtual void JavaScriptOnDocumentStart(const ScriptItems& scriptItems) = 0;
930 
931     /**
932      * Set enable lower the frame rate.
933      */
934     virtual void SetEnableLowerFrameRate(bool enabled) = 0;
935 
936     /**
937      * Execute an accessibility action on an accessibility node in the browser.
938      * @param accessibilityId The id of the accessibility node.
939      * @param action The action to be performed on the accessibility node.
940      */
941     virtual void ExecuteAction(int64_t accessibilityId, uint32_t action) = 0;
942 
943     /**
944      * Get the information of the focused accessibility node on the given accessibility node in the browser.
945      * @param accessibilityId Indicate the accessibility id of the parent node of the focused accessibility node.
946      * @param isAccessibilityFocus Indicate whether the focused accessibility node is accessibility focused or input
947      * focused.
948      * @return The obtained information of the accessibility node.
949      */
950     virtual std::shared_ptr<NWebAccessibilityNodeInfo> GetFocusedAccessibilityNodeInfo(
951         int64_t accessibilityId, bool isAccessibilityFocus) = 0;
952 
953     /**
954      * Get the information of the accessibility node by its accessibility id in the browser.
955      * @param accessibilityId The accessibility id of the accessibility node.
956      * @return The obtained information of the accessibility node.
957      */
958     virtual std::shared_ptr<NWebAccessibilityNodeInfo> GetAccessibilityNodeInfoById(int64_t accessibilityId) = 0;
959 
960     /**
961      * Get the information of the accessibility node by focus move in the browser.
962      * @param accessibilityId The accessibility id of the original accessibility node.
963      * @param direction The focus move direction of the original accessibility node.
964      * @return The obtained information of the accessibility node.
965      */
966     virtual std::shared_ptr<NWebAccessibilityNodeInfo> GetAccessibilityNodeInfoByFocusMove(
967         int64_t accessibilityId, int32_t direction) = 0;
968 
969     /**
970      * Set the accessibility state in the browser.
971      * @param state Indicate whether the accessibility state is enabled or disabled.
972      */
973     virtual void SetAccessibilityState(bool state) = 0;
974 
975     /**
976      * Get whether need soft keyboard.
977      *
978      * @return true if need soft keyboard, otherwise false.
979      */
980     virtual bool NeedSoftKeyboard() = 0;
981 
982     /**
983      * CallH5Function
984      *
985      * @param routing_id       int32_t: the h5 frmae routing id
986      * @param h5_object_id     int32_t: the h5 side object id
987      * @param h5_method_name   string:  the h5 side object method name
988      * @param args             vector<shared_ptr<NWebValue>>: the call args
989      */
990     virtual void CallH5Function(int32_t routing_id, int32_t h5_object_id, const std::string& h5_method_name,
991         const std::vector<std::shared_ptr<NWebValue>>& args) = 0;
992 
993     /**
994      * Get web whether has been set incognito mode.
995      *
996      * @return true if web is in incognito mode; otherwise fase.
997      */
998     virtual bool IsIncognitoMode() = 0;
999 
1000     /**
1001      * Register native function.
1002      */
1003     virtual void RegisterNativeArkJSFunction(
1004         const char* objName, const std::vector<std::shared_ptr<NWebJsProxyCallback>>& callbacks) = 0;
1005 
1006     /**
1007      * Unregister native function.
1008      */
1009     virtual void UnRegisterNativeArkJSFunction(const char* objName) = 0;
1010 
1011     /**
1012      * Register native valide callback function.
1013      */
1014     virtual void RegisterNativeValideCallback(const char* webName, const NativeArkWebOnValidCallback callback) = 0;
1015 
1016     /**
1017      * Register native destroy callback function.
1018      */
1019     virtual void RegisterNativeDestroyCallback(const char* webName, const NativeArkWebOnDestroyCallback callback) = 0;
1020 
1021     /**
1022      * Inject the JavaScript after WebView load the DOM tree.
1023      */
1024     virtual void JavaScriptOnDocumentEnd(const ScriptItems& scriptItems) = 0;
1025 
1026     /**
1027      * Discard the webview window.
1028      * @return true if the discarding success, otherwise false.
1029      */
1030     virtual bool Discard() = 0;
1031 
1032     /**
1033      * Reload the webview window that has been discarded before.
1034      * @return true if the discarded window reload success, otherwise false.
1035      */
1036     virtual bool Restore() = 0;
1037 
1038     /**
1039      * Enable the ability to check website security risks.
1040      * Illegal and fraudulent websites are mandatory enabled and cann't be disabled by this function.
1041      */
1042     virtual void EnableSafeBrowsing(bool enable) = 0;
1043 
1044     /**
1045      * Get whether checking website security risks is enabled.
1046      * @return true if enable the ability to check website security risks else false.
1047      */
1048     virtual bool IsSafeBrowsingEnabled() = 0;
1049 
1050     /**
1051      * Get the security level of current page.
1052      * @return security level for current page.
1053      */
1054     virtual int GetSecurityLevel() = 0;
1055 
1056     /**
1057      * Set the ability to print web page background.
1058      * @param enable Indicate whether the ability is enabled or disabled.
1059      */
1060     virtual void SetPrintBackground(bool enable) = 0;
1061 
1062     /**
1063      * Obtains whether to print the background of a web page.
1064      * @return true if enable print web page background, otherwise false.
1065      */
1066     virtual bool GetPrintBackground() = 0;
1067 
1068     /**
1069      * Close picture-in-picture video and fullScreen video.
1070      */
1071     virtual void CloseAllMediaPresentations() = 0;
1072 
1073     /**
1074      * Stop all audio and video playback on the web page.
1075      */
1076     virtual void StopAllMedia() = 0;
1077 
1078     /**
1079      * Restart playback of all audio and video on the web page.
1080      */
1081     virtual void ResumeAllMedia() = 0;
1082 
1083     /**
1084      * Pause all audio and video playback on the web page.
1085      */
1086     virtual void PauseAllMedia() = 0;
1087 
1088     /**
1089      * View the playback status of all audio and video on the web page.
1090      * @return The playback status of all audio and video.
1091      */
1092     virtual int GetMediaPlaybackState() = 0;
1093 
1094     /**
1095      * Start current camera.
1096      */
1097     virtual void StartCamera() = 0;
1098 
1099     /**
1100      * Stop current camera.
1101      */
1102     virtual void StopCamera() = 0;
1103 
1104     /**
1105      * Close current camera.
1106      */
1107     virtual void CloseCamera() = 0;
1108 
1109     /**
1110      * Enable the ability to intelligent tracking prevention, default disabled.
1111      */
1112     virtual void EnableIntelligentTrackingPrevention(bool enable) = 0;
1113 
1114     /**
1115      * Get whether intelligent tracking prevention is enabled.
1116      * @return true if enable the ability intelligent tracking prevention; else false.
1117      */
1118     virtual bool IsIntelligentTrackingPreventionEnabled() const = 0;
1119 
1120     /**
1121      * @brief Obtains the last javascript proxy calling frame url.
1122      *
1123      * @return the url of last calling frame url.
1124      */
1125     /*--ark web()--*/
1126     virtual std::string GetLastJavascriptProxyCallingFrameUrl() = 0;
1127 
1128     /**
1129      * @brief get pendingsize status.
1130      *
1131      * @return the result of last pendingsize status.
1132      */
1133     /*--ark web()--*/
1134     virtual bool GetPendingSizeStatus() = 0;
1135 
1136     /**
1137      * Scroll by the delta distance or velocity takes the screen as a reference.
1138      *
1139      * @param delta_x horizontal offset in physical pixel.
1140      * @param delta_y vertical offset in physical pixel.
1141      * @param vx      horizontal velocity in physical pixel.
1142      * @param vx      vertical velocity in physical pixel.
1143      */
1144     virtual void ScrollByRefScreen(float delta_x, float delta_y, float vx, float vy) = 0;
1145 
1146     /**
1147      * @brief Render process switch to background.
1148      */
1149     /*--ark web()--*/
1150     virtual void OnRenderToBackground() = 0;
1151 
1152     /**
1153      * @brief Render process switch to foreground.
1154      */
1155     /*--ark web()--*/
1156     virtual void OnRenderToForeground() = 0;
1157 
1158     /**
1159      * @brief Compile javascript and generate code cache.
1160      *
1161      * @param url url of javascript.
1162      * @param script javascript text content.
1163      * @param cacheOptions compile options and info.
1164      * @param callback callback will be called on getting the result of compiling javascript.
1165      */
1166     virtual void PrecompileJavaScript(const std::string& url, const std::string& script,
1167         std::shared_ptr<CacheOptions>& cacheOptions, std::shared_ptr<NWebMessageValueCallback> callback) = 0;
1168 
1169     virtual void OnCreateNativeMediaPlayer(std::shared_ptr<NWebCreateNativeMediaPlayerCallback> callback) = 0;
1170 
1171     /**
1172      * Inject Offline Resource into Memory Cache.
1173      *
1174      * @param url url of resource.
1175      * @param origin origin of resource.
1176      * @param resource data of resource.
1177      * @param response_headers response headers of resource.
1178      * @param type resource type.
1179      */
1180     virtual void InjectOfflineResource(const std::string& url, const std::string& origin,
1181         const std::vector<uint8_t>& resource, const std::map<std::string, std::string>& responseHeaders,
1182         const int type) = 0;
1183 
1184     /**
1185      * @brief Terminate render process
1186      *
1187      * @return true if it was possible to terminate this render process, false
1188      *         otherwise.
1189      */
1190     /*--ark web()--*/
1191     virtual bool TerminateRenderProcess() = 0;
1192 
1193     /**
1194      * @brief Set the params when the scale of WebView changed by pinch gestrue.
1195      *
1196      * @param scale: the scale factor to apply. The scale will be
1197      *        clamped to the pinch limits. This value must be in the range
1198      *        0.01 to 8.0 inclusive.
1199      * @param centerX: X-coordinate of the pinch center
1200      * @param centerX: Y-coordinate of the pinch center
1201      *
1202      * @return the error id.
1203      */
1204     /*--ark web()--*/
1205     virtual int ScaleGestureChange(double scale, double centerX, double centerY) = 0;
1206 
1207     /**
1208      * RegisterArkJSfunction
1209      *
1210      * @param object_name  String: object name
1211      * @param method_list vector<String>: vector list, async method list
1212      * @param method_list vector<String>: vector list, sync method list
1213      * @param object_id int32_t: object id
1214      */
1215     virtual void RegisterArkJSfunction(const std::string& object_name, const std::vector<std::string>& method_list,
1216         const std::vector<std::string>& async_method_list, const int32_t object_id) = 0;
1217 
1218     /**
1219      * Get value of Autofill index.
1220      * @param index index value.
1221      */
1222     virtual void SuggestionSelected(int32_t index) = 0;
1223 
1224     /**
1225      * @brief Send touchpad fling event.
1226      *
1227      * @param x location of x.
1228      * @param y location of y.
1229      * @param vx velocity of x.
1230      * @param vy velocity of x.
1231      */
1232     virtual void SendTouchpadFlingEvent(double x, double y, double vx, double vy) = 0;
1233 
1234     /**
1235      * Set fit content mode.
1236      *
1237      */
1238     virtual void SetFitContentMode(int32_t mode) = 0;
1239 
1240     /**
1241      * Get select info.
1242      *
1243      */
1244     virtual std::string GetSelectInfo() = 0;
1245 
1246     /**
1247      * @brief Notify that safe insets change.
1248      *
1249      */
1250     virtual void OnSafeInsetsChange(int left, int top, int right, int bottom) = 0;
1251 
1252     /**
1253      * @brief Render process switch to foreground.
1254      */
1255     /*--ark web()--*/
1256     virtual void OnOnlineRenderToForeground() = 0;
1257 
1258     /**
1259      * @brief Called when text is selected in image.
1260      */
1261     /*--ark web()--*/
1262     virtual void OnTextSelected() = 0;
1263 
1264     /**
1265      * @brief Notify for next touch move event.
1266      *
1267      */
1268     /*--ark web()--*/
NotifyForNextTouchEvent()1269     virtual void NotifyForNextTouchEvent() {}
1270 
1271     /**
1272      * @brief Enable the ability to block Ads, default disabled.
1273      */
EnableAdsBlock(bool enable)1274     virtual void EnableAdsBlock(bool enable) {}
1275 
1276     /**
1277      * @brief Get whether Ads block is enabled.
1278      */
IsAdsBlockEnabled()1279     virtual bool IsAdsBlockEnabled()
1280     {
1281         return false;
1282     }
1283 
1284     /**
1285      * @brief Get whether Ads block is enabled for current Webpage.
1286      */
IsAdsBlockEnabledForCurPage()1287     virtual bool IsAdsBlockEnabledForCurPage()
1288     {
1289         return false;
1290     }
1291 
1292     /**
1293      * @brief Get Web page snapshot
1294      *
1295      * @param id Request id.
1296      * @param width Request SnapShot width.
1297      * @param height Request SnapShot height.
1298      * @param callback SnapShot result callback.
1299      * @return ture if succuess request snapshot to renderer.
1300      */
1301     /*--ark web()--*/
WebPageSnapshot(const char * id,PixelUnit type,int width,int height,const WebSnapshotCallback callback)1302     virtual bool WebPageSnapshot(const char* id,
1303                                  PixelUnit type,
1304                                  int width,
1305                                  int height,
1306                                  const WebSnapshotCallback callback) {
1307         return false;
1308     }
1309 
1310     /**
1311      * @brief Notify that system configuration change.
1312      *
1313      * @param configuration system configuration.
1314     */
1315     /*--ark web()--*/
OnConfigurationUpdated(std::shared_ptr<NWebSystemConfiguration> configuration)1316     virtual void OnConfigurationUpdated(std::shared_ptr<NWebSystemConfiguration> configuration) {}
1317 
1318     /**
1319      * @brief Set url trust list.
1320      *
1321      * @param urlTrustList The url Trust list.
1322      */
SetUrlTrustList(const std::string & urlTrustList)1323     virtual int SetUrlTrustList(const std::string& urlTrustList) {
1324         return 0;
1325     }
1326 
1327     /**
1328      * @brief Put the callback, convert sapnstring to html.
1329      *
1330      * @param callback will convert spanstring to html.
1331      */
PutSpanstringConvertHtmlCallback(std::shared_ptr<NWebSpanstringConvertHtmlCallback> callback)1332     virtual void PutSpanstringConvertHtmlCallback(
1333         std::shared_ptr<NWebSpanstringConvertHtmlCallback> callback) {}
1334 
1335     /**
1336      * Web send key event.
1337      * @param key_code code value.
1338      * @param key_action action value.
1339      * @param pressedCodes pressedCodes value.
1340      */
1341     /*--ark web()--*/
WebSendKeyEvent(int32_t keyCode,int32_t keyAction,const std::vector<int32_t> & pressedCodes)1342     virtual bool WebSendKeyEvent(int32_t keyCode, int32_t keyAction, const std::vector<int32_t>& pressedCodes) {
1343         return false;
1344     }
1345 
1346     /**
1347      * Set grant file access dirs.
1348      */
SetPathAllowingUniversalAccess(const std::vector<std::string> & dirList,const std::vector<std::string> & moduleName,std::string & errorPath)1349     virtual void SetPathAllowingUniversalAccess(const std::vector<std::string>& dirList,
1350                                                 const std::vector<std::string>& moduleName,
1351                                                 std::string& errorPath) {}
1352 
1353     /**
1354      * @brief Send mouse wheel event.
1355      */
WebSendMouseWheelEvent(double x,double y,double delta_x,double delta_y,const std::vector<int32_t> & pressedCodes)1356     virtual void WebSendMouseWheelEvent(double x,
1357                                         double y,
1358                                         double delta_x,
1359                                         double delta_y,
1360                                         const std::vector<int32_t>& pressedCodes) {}
1361 
1362     /**
1363      * @brief Send touchpad fling event.
1364      *
1365      * @param x location of x.
1366      * @param y location of y.
1367      * @param vx velocity of x.
1368      * @param vy velocity of y.
1369      * @param pressedCodes pressed codes.
1370      */
WebSendTouchpadFlingEvent(double x,double y,double vx,double vy,const std::vector<int32_t> & pressedCodes)1371     virtual void WebSendTouchpadFlingEvent(double x,
1372                                            double y,
1373                                            double vx,
1374                                            double vy,
1375                                            const std::vector<int32_t>& pressedCodes) {}
1376 
1377     /**
1378      * @brief Set url trust list with error message.
1379      *
1380      * @param urlTrustList The url Trust list.
1381      * @param detailErrMsg The url trust list detail message.
1382      */
SetUrlTrustListWithErrMsg(const std::string & urlTrustList,std::string & detailErrMsg)1383     virtual int SetUrlTrustListWithErrMsg(const std::string& urlTrustList, std::string& detailErrMsg) {
1384         return 0;
1385     }
1386 
1387     /**
1388      * RegisterArkJSfunction
1389      *
1390      * @param object_name  String: object name
1391      * @param method_list vector<String>: vector list, async method list
1392      * @param method_list vector<String>: vector list, sync method list
1393      * @param object_id int32_t: object id
1394      * @param permission String: allow list
1395      */
RegisterArkJSfunction(const std::string & object_name,const std::vector<std::string> & method_list,const std::vector<std::string> & async_method_list,const int32_t object_id,const std::string & permission)1396     virtual void RegisterArkJSfunction(const std::string& object_name, const std::vector<std::string>& method_list,
1397         const std::vector<std::string>& async_method_list, const int32_t object_id, const std::string& permission) {}
1398 
1399     /**
1400      * @brief resize visual viewport.
1401      *
1402      * @param width width.
1403      * @param height height.
1404      * @param iskeyboard from keybord.
1405      */
ResizeVisibleViewport(uint32_t width,uint32_t height,bool isKeyboard)1406     virtual void ResizeVisibleViewport(uint32_t width, uint32_t height, bool isKeyboard) {}
1407 
1408     /**
1409      * @brief Set backforward cache options.
1410      *
1411      * @param size The size of the back forward cache could saved.
1412      * @param timeToLive The time of the back forward cache page could stay.
1413      */
SetBackForwardCacheOptions(int32_t size,int32_t timeToLive)1414     virtual void SetBackForwardCacheOptions(int32_t size, int32_t timeToLive) { return; }
1415 
1416     /**
1417      * RegisterArkJSfunctionV2
1418      *
1419      * @param object_name  String: object name
1420      * @param method_list vector<String>: vector list, async method list
1421      * @param method_list vector<String>: vector list, sync method list
1422      * @param object_id int32_t: object id
1423      * @param permission String: allow list
1424      */
RegisterArkJSfunctionV2(const std::string & object_name,const std::vector<std::string> & method_list,const std::vector<std::string> & async_method_list,const int32_t object_id,const std::string & permission)1425     virtual void RegisterArkJSfunctionV2(const std::string& object_name, const std::vector<std::string>& method_list,
1426         const std::vector<std::string>& async_method_list, const int32_t object_id, const std::string& permission) {}
1427 
1428     /**
1429      * @brief set the callback of the autofill event.
1430      * @param callback callback.
1431      */
SetAutofillCallback(std::shared_ptr<NWebMessageValueCallback> callback)1432     virtual void SetAutofillCallback(std::shared_ptr<NWebMessageValueCallback> callback) {}
1433 
1434     /**
1435      * @brief fill autofill data.
1436      * @param data data.
1437      */
FillAutofillData(std::shared_ptr<NWebMessage> data)1438     virtual void FillAutofillData(std::shared_ptr<NWebMessage> data) {}
1439 
1440     /**
1441      * @brief on autofill cancel.
1442      * @param fillContent fillContent
1443      */
OnAutofillCancel(const std::string & fillContent)1444     virtual void OnAutofillCancel(const std::string& fillContent) {}
1445 
1446     /**
1447      * Execute an accessibility action on an accessibility node in the browser.
1448      * @param accessibilityId The id of the accessibility node.
1449      * @param action The action to be performed on the accessibility node.
1450      * @param actionArguments Data related to the current action.
1451      */
PerformAction(int64_t accessibilityId,uint32_t action,const std::map<std::string,std::string> & actionArguments)1452     virtual void PerformAction(int64_t accessibilityId, uint32_t action,
1453         const std::map<std::string, std::string>& actionArguments) {}
1454 
1455     /**
1456      * @brief Send the accessibility hover event coordinate.
1457      *
1458      * @param x horizontal location of coordinate.
1459      * @param y vertical location of coordinate.
1460      */
SendAccessibilityHoverEvent(int32_t x,int32_t y)1461     virtual void SendAccessibilityHoverEvent(int32_t x, int32_t y) {}
1462 
1463     /**
1464      * Scroll by the delta distance if web is not foucsed.
1465      *
1466      * @param delta_x horizontal offset.
1467      * @param delta_y vertical offset.
1468      * @return false if web is focused.
1469     */
ScrollByWithResult(float delta_x,float delta_y)1470     virtual bool ScrollByWithResult(float delta_x, float delta_y) {
1471         return false;
1472     }
1473 
1474     /**
1475      * @brief Called when image analyzer is destory.
1476      */
OnDestroyImageAnalyzerOverlay()1477     virtual void OnDestroyImageAnalyzerOverlay() {}
1478 
1479     /**
1480      * @brief Get the current scroll offset of the webpage.
1481      * @param offset_x The current horizontal scroll offset of the webpage.
1482      * @param offset_y The current vertical scroll offset of the webpage.
1483      */
GetScrollOffset(float * offset_x,float * offset_y)1484     virtual void GetScrollOffset(float* offset_x, float* offset_y) {}
1485 
1486     /**
1487      * @brief set DPI when DPI changes.
1488      * @param density The new density value.
1489      */
SetSurfaceDensity(const double & density)1490     virtual void SetSurfaceDensity(const double& density) {}
1491 
1492     /**
1493      * @Description: Get the accessibility visibility of the accessibility node by its accessibility id in the browser.
1494      * @Input accessibility_id: The accessibility id of the accessibility node.
1495      * @Return: The accessibility visibility of the accessibility node.
1496      */
1497     /*--ark web()--*/
GetAccessibilityVisible(int64_t accessibility_id)1498     virtual bool GetAccessibilityVisible(int64_t accessibility_id) {
1499         return true;
1500     }
1501 };
1502 
1503 } // namespace OHOS::NWeb
1504 
1505 #endif
1506