• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 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 ARK_WEB_NWEB_H_
17 #define ARK_WEB_NWEB_H_
18 #pragma once
19 
20 #include "ohos_nweb/include/ark_web_accessibility_event_callback.h"
21 #include "ohos_nweb/include/ark_web_accessibility_node_info.h"
22 #include "ohos_nweb/include/ark_web_array_buffer_value_callback.h"
23 #include "ohos_nweb/include/ark_web_bool_value_callback.h"
24 #include "ohos_nweb/include/ark_web_cache_options.h"
25 #include "ohos_nweb/include/ark_web_create_native_media_player_callback.h"
26 #include "ohos_nweb/include/ark_web_download_callback.h"
27 #include "ohos_nweb/include/ark_web_drag_data.h"
28 #include "ohos_nweb/include/ark_web_drag_event.h"
29 #include "ohos_nweb/include/ark_web_find_callback.h"
30 #include "ohos_nweb/include/ark_web_history_list.h"
31 #include "ohos_nweb/include/ark_web_hit_test_result.h"
32 #include "ohos_nweb/include/ark_web_js_proxy_callback_vector.h"
33 #include "ohos_nweb/include/ark_web_js_proxy_method.h"
34 #include "ohos_nweb/include/ark_web_js_result_callback.h"
35 #include "ohos_nweb/include/ark_web_keyboard_event.h"
36 #include "ohos_nweb/include/ark_web_message_value_callback.h"
37 #include "ohos_nweb/include/ark_web_mouse_event.h"
38 #include "ohos_nweb/include/ark_web_pdfconfig_args.h"
39 #include "ohos_nweb/include/ark_web_preference.h"
40 #include "ohos_nweb/include/ark_web_release_surface_callback.h"
41 #include "ohos_nweb/include/ark_web_rom_value.h"
42 #include "ohos_nweb/include/ark_web_rom_value_vector.h"
43 #include "ohos_nweb/include/ark_web_screen_lock_callback.h"
44 #include "ohos_nweb/include/ark_web_spanstring_convert_html_callback.h"
45 #include "ohos_nweb/include/ark_web_string_value_callback.h"
46 #include "ohos_nweb/include/ark_web_system_configuration.h"
47 #include "ohos_nweb/include/ark_web_touch_point_info_vector.h"
48 #include "ohos_nweb/include/ark_web_print_document_adapter_adapter.h"
49 
50 namespace OHOS::ArkWeb {
51 
52 class ArkWebHandler;
53 
54 /*--ark web(source=webcore)--*/
55 class ArkWebNWeb : public virtual ArkWebBaseRefCounted {
56 public:
57     /*--ark web()--*/
58     virtual void Resize(uint32_t width, uint32_t height, bool is_keyboard) = 0;
59 
60     /*--ark web()--*/
61     virtual void OnPause() = 0;
62 
63     /*--ark web()--*/
64     virtual void OnContinue() = 0;
65 
66     /*--ark web()--*/
67     virtual void OnDestroy() = 0;
68 
69     /*--ark web()--*/
70     virtual void OnFocus(const int32_t& focus_reason) = 0;
71 
72     /*--ark web()--*/
73     virtual void OnBlur(const int32_t& blur_reason) = 0;
74 
75     /*--ark web()--*/
76     virtual void OnTouchPress(int32_t id, double x, double y, bool from_overlay) = 0;
77 
78     /*--ark web()--*/
79     virtual void OnTouchRelease(int32_t id, double x, double y, bool from_overlay) = 0;
80 
81     /*--ark web()--*/
82     virtual void OnTouchMove(int32_t id, double x, double y, bool from_overlay) = 0;
83 
84     /*--ark web()--*/
85     virtual void OnTouchMove(const ArkWebTouchPointInfoVector& touch_point_infos, bool from_overlay) = 0;
86 
87     /*--ark web()--*/
88     virtual void OnTouchCancel() = 0;
89 
90     /*--ark web()--*/
91     virtual void OnNavigateBack() = 0;
92 
93     /*--ark web()--*/
94     virtual bool SendKeyEvent(int32_t key_code, int32_t key_action) = 0;
95 
96     /*--ark web()--*/
97     virtual void SendMouseWheelEvent(double x, double y, double delta_x, double delta_y) = 0;
98 
99     /*--ark web()--*/
100     virtual void SendMouseEvent(int x, int y, int button, int action, int count) = 0;
101 
102     /**
103      * @brief Loads the given URL.
104      *
105      * @param url: the URL of the resource to load This value cannot be null.
106      *
107      * @return title string for the current page.
108      */
109     /*--ark web()--*/
110     virtual int Load(const ArkWebString& url) = 0;
111 
112     /**
113      * @brief Gets whether this NWeb has a back history item.
114      *
115      * @return true if this NWeb has a back history item
116      */
117     /*--ark web()--*/
118     virtual bool IsNavigatebackwardAllowed() = 0;
119 
120     /**
121      * @brief Gets whether this NWeb has a forward history item.
122      *
123      * @return true if this NWeb has a forward history item
124      */
125     /*--ark web()--*/
126     virtual bool IsNavigateForwardAllowed() = 0;
127 
128     /**
129      * @brief Gets whether this NWeb has a back or forward history item for number
130      *        of steps.
131      *
132      * @param num_steps: the negative or positive number of steps to move the
133      *        history
134      *
135      * @return true if this NWeb has a forward history item
136      */
137     /*--ark web()--*/
138     virtual bool CanNavigateBackOrForward(int num_steps) = 0;
139 
140     /**
141      * @brief Goes back in the history of this NWeb.
142      */
143     /*--ark web()--*/
144     virtual void NavigateBack() = 0;
145 
146     /**
147      * @brief Goes forward in the history of this NWeb.
148      */
149     /*--ark web()--*/
150     virtual void NavigateForward() = 0;
151 
152     /**
153      * @brief Goes to the history item that is the number of steps away from the
154      *        current item.
155      */
156     /*--ark web()--*/
157     virtual void NavigateBackOrForward(int step) = 0;
158 
159     /**
160      * @brief Delete back and forward history list.
161      */
162     /*--ark web()--*/
163     virtual void DeleteNavigateHistory() = 0;
164 
165     /**
166      * @brief Reloads the current URL.
167      */
168     /*--ark web()--*/
169     virtual void Reload() = 0;
170 
171     /**
172      * @brief Performs a zoom operation in this NWeb.
173      *
174      * @param zoom_factor: the zoom factor to apply. The zoom factor will be
175      *        clamped to the NWeb's zoom limits. This value must be in the range
176      *        0.01 to 100.0 inclusive.
177      *
178      * @return the error id.
179      */
180     /*--ark web()--*/
181     virtual int Zoom(float zoom_factor) = 0;
182 
183     /**
184      * @brief Performs a zooming in operation in this NWeb.
185      *
186      * @return the error id.
187      */
188     /*--ark web()--*/
189     virtual int ZoomIn() = 0;
190 
191     /**
192      * @brief Performs a zooming out operation in this NWeb.
193      *
194      * @return the error id.
195      */
196     /*--ark web()--*/
197     virtual int ZoomOut() = 0;
198 
199     /**
200      * @brief Stops the current load.
201      *
202      * @param code string: javascript code
203      */
204     /*--ark web()--*/
205     virtual void Stop() = 0;
206 
207     /**
208      * @brief ExecuteJavaScript
209      */
210     /*--ark web()--*/
211     virtual void ExecuteJavaScript(const ArkWebString& code) = 0;
212 
213     /**
214      * @brief ExecuteJavaScript plus
215      *
216      * @param code: javascript code
217      * @param callback: javascript running result
218      */
219     /*--ark web()--*/
220     virtual void ExecuteJavaScript(
221         const ArkWebString& code, ArkWebRefPtr<ArkWebMessageValueCallback> callback, bool extention) = 0;
222 
223     /**
224      * @brief Gets the NWebPreference object used to control the settings for this
225      *        NWeb.
226      *
227      * @return a NWebPreference object that can be used to control this NWeb's
228      *         settings This value cannot be null.
229      */
230     /*--ark web()--*/
231     virtual ArkWebRefPtr<ArkWebPreference> GetPreference() = 0;
232 
233     /**
234      * @brief Gets the web id.
235      *
236      * @return the web id
237      */
238     /*--ark web()--*/
239     virtual unsigned int GetWebId() = 0;
240 
241     /**
242      * @brief Gets the last hit test result.
243      *
244      * @return the last HitTestResult
245      */
246     /*--ark web()--*/
247     virtual ArkWebRefPtr<ArkWebHitTestResult> GetHitTestResult() = 0;
248 
249     /**
250      * @brief Sets the background color for this view.
251      *
252      * @param color: the color of the background
253      */
254     /*--ark web()--*/
255     virtual void PutBackgroundColor(int color) = 0;
256 
257     /**
258      * @brief Sets the initla scale for the page.
259      *
260      * @param scale: the initla scale of the page.
261      */
262     /*--ark web()--*/
263     virtual void InitialScale(float scale) = 0;
264 
265     /**
266      * @brief Sets the NWebDownloadCallback that will receive download event. This
267      *        will replace the current handler.
268      *
269      * @param download_listener: download listener
270      */
271     /*--ark web()--*/
272     virtual void PutDownloadCallback(ArkWebRefPtr<ArkWebDownloadCallback> download_listener) = 0;
273 
274     /**
275      * @brief Set the NWebAccessibilityEventCallback that will receive
276      *        accessibility event. This will replace the current handler.
277      *
278      * @param accessibility_event_listener: accessibility event listener
279      */
280     /*--ark web()--*/
281     virtual void PutAccessibilityEventCallback(
282         ArkWebRefPtr<ArkWebAccessibilityEventCallback> accessibility_event_listener) = 0;
283 
284     /**
285      * @brief Set the accessibility id generator that will generate accessibility
286      *        id for accessibility nodes in the web. This will replace the current
287      *        handler.
288      *
289      * @param accessibility_id_generator: Accessibility id generator.
290      */
291     /*--ark web()--*/
292     virtual void PutAccessibilityIdGenerator(const AccessibilityIdGenerateFunc accessibility_id_generator) = 0;
293 
294     /**
295      * @brief Set the NWebHandler that will receive various notifications and
296      *        requests. This will replace the current handler.
297      *
298      * @param handler: an implementation of NWebHandler This value cannot be null.
299      */
300     /*--ark web()--*/
301     virtual void SetNWebHandler(ArkWebRefPtr<ArkWebHandler> handler) = 0;
302 
303     /**
304      * @brief Gets the title for the current page.
305      *
306      * @return title string for the current page.
307      */
308     /*--ark web()--*/
309     virtual ArkWebString Title() = 0;
310 
311     /**
312      * @brief Gets the progress for the current page.
313      *
314      * @return progress for the current page.
315      */
316     /*--ark web()--*/
317     virtual int PageLoadProgress() = 0;
318 
319     /**
320      * @brief Gets the height of the HTML content.
321      *
322      * @return the height of the HTML content.
323      */
324     /*--ark web()--*/
325     virtual int ContentHeight() = 0;
326 
327     /**
328      * @brief Gets the current scale of this NWeb.
329      *
330      * @return the current scale
331      */
332     /*--ark web()--*/
333     virtual float Scale() = 0;
334 
335     /**
336      * @brief Loads the given URL with additional HTTP headers, specified as a map
337      *        from name to value. Note that if this map contains any of the
338      *        headers that are set by default by this NWeb, such as those
339      *        controlling caching, accept types or the User-Agent, their values
340      *        may be overridden by this NWeb's defaults.
341      *
342      * @param url: the URL of the resource to load This value cannot be null.
343      * @param additional_http_headers: additional http headers
344      */
345     /*--ark web()--*/
346     virtual int Load(const ArkWebString& url, const ArkWebStringMap& additional_http_headers) = 0;
347 
348     /**
349      * @brief Loads the given data into this NWeb, using baseUrl as the base URL
350      *        for the content. The base URL is used both to resolve relative URLs
351      *        and when applying JavaScript's same origin policy. The historyUrl is
352      *        used for the history entry.
353      *
354      * @param base_url: the URL to use as the page's base URL. If null defaults to
355      *        'about:blank'. This value may be null.
356      * @param data: the URL to use as the page's base URL. If null defaults to
357      *        'about:blank'. This value may be null.
358      * @param mime_type: the MIME type of the data, e.g. 'text/html'. This value
359      *        may be null.
360      * @param encoding: the encoding of the data This value may be null.
361      * @param history_url: the URL to use as the history entry. If null defaults
362      *        to 'about:blank'. If non-null, this must be a valid URL. This value
363      *        may be null.
364      */
365     /*--ark web()--*/
366     virtual int LoadWithDataAndBaseUrl(const ArkWebString& base_url, const ArkWebString& data,
367         const ArkWebString& mime_type, const ArkWebString& encoding, const ArkWebString& history_url) = 0;
368 
369     /**
370      * @brief Loads the given data into this NWeb.
371      *
372      * @param data: the URL to use as the page's base URL. If null defaults to
373      *        'about:blank'. This value may be null.
374      * @param mime_type: the MIME type of the data, e.g. 'text/html'. This value
375      *        may be null.
376      * @param encoding: the encoding of the data This value may be null.
377      */
378     /*--ark web()--*/
379     virtual int LoadWithData(const ArkWebString& data, const ArkWebString& mime_type, const ArkWebString& encoding) = 0;
380 
381     /**
382      * @brief RegisterArkJSfunction
383      *
384      * @param object_name  String: objector name
385      * @param method_list vector<String>: vector list ,method list
386      * @param object_id int32_t: object id
387      */
388     /*--ark web()--*/
389     virtual void RegisterArkJSfunction(
390         const ArkWebString& object_name, const ArkWebStringVector& method_list, const int32_t object_id) = 0;
391 
392     /**
393      * @brief UnregisterArkJSfunction
394      *
395      * @param object_name: objector name
396      * @param method_list: vector list ,method list
397      */
398     /*--ark web()--*/
399     virtual void UnregisterArkJSfunction(const ArkWebString& object_name, const ArkWebStringVector& method_list) = 0;
400 
401     /**
402      * @brief SetNWebJavaScriptResultCallBack
403      *
404      * @param callback: callback client
405      */
406     /*--ark web()--*/
407     virtual void SetNWebJavaScriptResultCallBack(ArkWebRefPtr<ArkWebJsResultCallback> callback) = 0;
408 
409     /**
410      * @brief Set the NWebFindCallback that will receive find event. This will
411      *        replace the current handler.
412      *
413      * @param find_listener: find callback
414      */
415     /*--ark web()--*/
416     virtual void PutFindCallback(ArkWebRefPtr<ArkWebFindCallback> find_listener) = 0;
417 
418     /**
419      * @brief Finds all instances of find on the page and highlights them,
420      *        asynchronously.
421      *
422      * @param search_str: target string to find.
423      */
424     /*--ark web()--*/
425     virtual void FindAllAsync(const ArkWebString& search_str) = 0;
426 
427     /**
428      * @brief Clears the highlighting surrounding text matches created by
429      *        findAllAsync
430      */
431     /*--ark web()--*/
432     virtual void ClearMatches() = 0;
433 
434     /**
435      * @brief Highlights and scrolls to the next match found by
436      *        findAllAsync(String), wrapping around page boundaries as necessary.
437      *
438      * @param forward: find back or forward:
439      */
440     /*--ark web()--*/
441     virtual void FindNext(const bool forward) = 0;
442 
443     /**
444      * @brief Saves the current view as a web archive.
445      *
446      * @param base_name: the filename where the archive should be placed This
447      *        value cannot be null.
448      * @param auto_name: if false, takes basename to be a file. If true, basename
449      *        is assumed to be a directory in which a filename will be chosen
450      *        according to the URL of the current page.
451      */
452     /*--ark web()--*/
453     virtual void StoreWebArchive(
454         const ArkWebString& base_name, bool auto_name, ArkWebRefPtr<ArkWebStringValueCallback> callback) = 0;
455 
456     /**
457      * @brief creating two ends of a message channel.
458      *
459      * @return the web message ports get from nweb.
460      */
461     /*--ark web()--*/
462     virtual ArkWebStringVector CreateWebMessagePorts() = 0;
463 
464     /**
465      * @brief Posts MessageEvent to the main frame.
466      *
467      * @param message: message send to mmain frame.
468      * @param ports: the web message ports send to main frame.
469      * @param target_uri: the uri which can received the ports.
470      */
471     /*--ark web()--*/
472     virtual void PostWebMessage(
473         const ArkWebString& message, const ArkWebStringVector& ports, const ArkWebString& target_uri) = 0;
474 
475     /**
476      * @brief close the message port.
477      *
478      * @param port_handle: the port to close.
479      */
480     /*--ark web()--*/
481     virtual void ClosePort(const ArkWebString& port_handle) = 0;
482 
483     /**
484      * @brief use the port to send message.
485      *
486      * @param port_handle: the port to send message.
487      * @param data: the message to send.
488      */
489     /*--ark web()--*/
490     virtual void PostPortMessage(const ArkWebString& port_handle, const ArkWebMessage& data) = 0;
491 
492     /**
493      * @brief set the callback of the message port.
494      *
495      * @param port_handle: the port to set callback.
496      * @param callback: to reveive the result when the other port post message.
497      */
498     /*--ark web()--*/
499     virtual void SetPortMessageCallback(
500         const ArkWebString& port_handle, ArkWebRefPtr<ArkWebMessageValueCallback> callback) = 0;
501 
502     /*--ark web()--*/
503     virtual void SendDragEvent(ArkWebRefPtr<ArkWebDragEvent> drag_event) = 0;
504 
505     /**
506      * @brief Clear ssl cache.
507      */
508     /*--ark web()--*/
509     virtual void ClearSslCache() = 0;
510 
511     /**
512      * @brief get web page url.
513      *
514      * @return web page url.
515      */
516     /*--ark web()--*/
517     virtual ArkWebString GetUrl() = 0;
518 
519     /**
520      * @brief Clears the client authentication certificate Cache in the Web.
521      */
522     /*--ark web()--*/
523     virtual void ClearClientAuthenticationCache() = 0;
524 
525     /**
526      * @brief set the locale name of current system setting..
527      *
528      * @param region: the locale name of current system setting.
529      */
530     /*--ark web()--*/
531     virtual void UpdateLocale(const ArkWebString& language, const ArkWebString& region) = 0;
532 
533     /**
534      * @brief get original url of the request.
535      *
536      * @return original url.
537      */
538     /*--ark web()--*/
539     virtual const ArkWebString GetOriginalUrl() = 0;
540 
541     /**
542      * @brief get original url of the request.
543      *
544      * @param data: raw image data of the icon.
545      * @param width: width of the icon.
546      * @param height: height of the icon.
547      * @param color_type: the color type of the icon.
548      * @param alpha_type: the alpha type of the icon.
549      *
550      * @return the result of get favicon.
551      */
552     /*--ark web()--*/
553     virtual bool GetFavicon(const void** data, size_t& width, size_t& height, int& color_type, int& alpha_type) = 0;
554 
555     /**
556      * @brief set the network status, just notify the webview to change the JS
557      *        navigatoer.online.
558      *
559      * @param available: width of the icon.
560      */
561     /*--ark web()--*/
562     virtual void PutNetworkAvailable(bool available) = 0;
563 
564     /**
565      * @brief web has image or not.
566      *
567      * @param callback: has image or not
568      */
569     /*--ark web()--*/
570     virtual void HasImages(ArkWebRefPtr<ArkWebBoolValueCallback> callback) = 0;
571 
572     /**
573      * @brief web remove cache.
574      *
575      * @param include_disk_files: if false, only the RAM cache is removed
576      */
577     /*--ark web()--*/
578     virtual void RemoveCache(bool include_disk_files) = 0;
579 
580     /**
581      * @brief web has image or not.
582      */
583     /*--ark web()--*/
584     virtual ArkWebRefPtr<ArkWebHistoryList> GetHistoryList() = 0;
585 
586     /**
587      * @brief Set the NWebReleaseSurfaceCallback that will receive release surface
588      *        event. This will replace the current handler.
589      *
590      * @param release_surface_listener: release surface listener
591      */
592     /*--ark web()--*/
593     virtual void PutReleaseSurfaceCallback(ArkWebRefPtr<ArkWebReleaseSurfaceCallback> release_surface_listener) = 0;
594 
595     /**
596      * @brief Get web back forward state.
597      *
598      * @return web back forward state.
599      */
600     /*--ark web()--*/
601     virtual ArkWebUint8Vector SerializeWebState() = 0;
602 
603     /**
604      * @brief Restore web back forward state.
605      *
606      * @param state: web back forward state.
607      */
608     /*--ark web()--*/
609     virtual bool RestoreWebState(const ArkWebUint8Vector& state) = 0;
610 
611     /**
612      * @brief Move page up.
613      *
614      * @param top: whether move to the top.
615      */
616     /*--ark web()--*/
617     virtual void PageUp(bool top) = 0;
618 
619     /**
620      * @brief Move page down.
621      *
622      * @param bottom: whether move to the bottom.
623      */
624     /*--ark web()--*/
625     virtual void PageDown(bool bottom) = 0;
626 
627     /**
628      * @brief Scroll to the position.
629      *
630      * @param x: horizontal coordinate.
631      * @param y: vertical coordinate.
632      */
633     /*--ark web()--*/
634     virtual void ScrollTo(float x, float y) = 0;
635 
636     /**
637      * @brief Scroll by the delta distance.
638      *
639      * @param delta_x: horizontal offset.
640      * @param delta_y: vertical offset.
641      */
642     /*--ark web()--*/
643     virtual void ScrollBy(float delta_x, float delta_y) = 0;
644 
645     /**
646      * @brief Slide scroll by the speed.
647      *
648      * @param vx: horizontal slide speed.
649      * @param vy: vertical slide speed.
650      */
651     /*--ark web()--*/
652     virtual void SlideScroll(float vx, float vy) = 0;
653 
654     /**
655      * @brief Get current website certificate.
656      *
657      * @param cert_chain_data: current website certificate array.
658      * @param is_single_cert: true if only get one certificate of current website,
659      *        false if get certificate chain of the website.
660      *
661      * @return true if get certificate successfully, otherwise false.
662      */
663     /*--ark web()--*/
664     virtual bool GetCertChainDerData(ArkWebStringVector& cert_chain_data, bool is_single_cert) = 0;
665 
666     /**
667      * @brief Set screen offset.
668      *
669      * @param x: the offset in x direction.
670      * @param y: the offset in y direction.
671      */
672     /*--ark web()--*/
673     virtual void SetScreenOffSet(double x, double y) = 0;
674 
675     /**
676      * @brief Set audio muted.
677      *
678      * @param muted: Aduio mute state.
679      */
680     /*--ark web()--*/
681     virtual void SetAudioMuted(bool muted) = 0;
682 
683     /**
684      * @brief Set should frame submission before draw.
685      *
686      * @param should: whether wait render frame submission.
687      */
688     /*--ark web()--*/
689     virtual void SetShouldFrameSubmissionBeforeDraw(bool should) = 0;
690 
691     /**
692      * @brief Notify whether the popup window is initialized successfully.
693      *
694      * @param result: whether success.
695      */
696     /*--ark web()--*/
697     virtual void NotifyPopupWindowResult(bool result) = 0;
698 
699     /**
700      * @brief Set audio resume interval.
701      *
702      * @param resume_interval: Aduio resume interval.
703      */
704     /*--ark web()--*/
705     virtual void SetAudioResumeInterval(int32_t resume_interval) = 0;
706 
707     /**
708      * @brief Set audio exclusive state.
709      *
710      * @param audio_exclusive: Aduio exclusive state.
711      */
712     /*--ark web()--*/
713     virtual void SetAudioExclusive(bool audio_exclusive) = 0;
714 
715     /**
716      * @brief Rigest the keep srceen on interface.
717      *
718      * @param window_id: the window id.
719      * @param callback the screenon handle callback.
720      */
721     /*--ark web()--*/
722     virtual void RegisterScreenLockFunction(int32_t window_id, ArkWebRefPtr<ArkWebScreenLockCallback> callback) = 0;
723 
724     /**
725      * @brief UnRigest the keep srceen on interface.
726      *
727      * @param window_id: the window id.
728      */
729     /*--ark web()--*/
730     virtual void UnRegisterScreenLockFunction(int32_t window_id) = 0;
731 
732     /**
733      * @brief Notify memory level.
734      *
735      * @param level: the memory level.
736      */
737     /*--ark web()--*/
738     virtual void NotifyMemoryLevel(int32_t level) = 0;
739 
740     /**
741      * @brief Notify webview window status.
742      */
743     /*--ark web()--*/
744     virtual void OnWebviewHide() = 0;
745 
746     /*--ark web()--*/
747     virtual void OnWebviewShow() = 0;
748 
749     /**
750      * @brief Get drag data.
751      *
752      * @return the drag data.
753      */
754     /*--ark web()--*/
755     virtual ArkWebRefPtr<ArkWebDragData> GetOrCreateDragData() = 0;
756 
757     /**
758      * @brief Prefetch the resources required by the page, but will not execute js
759      *        or render the page.
760      *
761      * @param url: Which url to preresolve/preconnect.
762      * @param additional_http_headers: Additional HTTP request header of the URL.
763      */
764     /*--ark web()--*/
765     virtual void PrefetchPage(const ArkWebString& url, const ArkWebStringMap& additional_http_headers) = 0;
766 
767     /**
768      * @brief Set the window id.
769      */
770     /*--ark web()--*/
771     virtual void SetWindowId(uint32_t window_id) = 0;
772 
773     /**
774      * @brief Notify that browser was occluded by other windows.
775      */
776     /*--ark web()--*/
777     virtual void OnOccluded() = 0;
778 
779     /**
780      * @brief Notify that browser was unoccluded by other windows.
781      */
782     /*--ark web()--*/
783     virtual void OnUnoccluded() = 0;
784 
785     /**
786      * @brief Set the token.
787      */
788     /*--ark web()--*/
789     virtual void SetToken(void* token) = 0;
790 
791     /**
792      * @brief Set the nested scroll mode.
793      */
794     /*--ark web()--*/
795     virtual void SetNestedScrollMode(const int32_t& nested_scroll_mode) = 0;
796 
797     /**
798      * @brief Set enable lower the frame rate.
799      */
800     /*--ark web()--*/
801     virtual void SetEnableLowerFrameRate(bool enabled) = 0;
802 
803     /**
804      * @brief Set the property values for width, height, and keyboard height.
805      */
806     /*--ark web()--*/
807     virtual void SetVirtualKeyBoardArg(int32_t width, int32_t height, double keyboard) = 0;
808 
809     /**
810      * @brief Set the virtual keyboard to override the web status.
811      */
812     /*--ark web()--*/
813     virtual bool ShouldVirtualKeyboardOverlay() = 0;
814 
815     /**
816      * @brief Set draw rect.
817      */
818     /*--ark web()--*/
819     virtual void SetDrawRect(int32_t x, int32_t y, int32_t width, int32_t height) = 0;
820 
821     /**
822      * @brief Set draw mode.
823      */
824     /*--ark web()--*/
825     virtual void SetDrawMode(int32_t mode) = 0;
826 
827     /**
828      * @brief Create web print document adapter.
829      */
830     /*--ark web()--*/
831     virtual void* CreateWebPrintDocumentAdapter(const ArkWebString& job_name) = 0;
832 
833     /**
834      * @brief Loads the URL with postData using "POST" method into this WebView.
835      *        If url is not a network URL, it will be loaded with loadUrl(String)
836      * instead.
837      *
838      * @param url: the URL of the resource to load This value cannot be null.
839      * @param post_data: the data will be passed to "POST" request, whilch must be
840      *        "application/x-www-form-urlencoded" encoded.
841      *
842      * @return title string for the current page.
843      */
844     /*--ark web()--*/
845     virtual int PostUrl(const ArkWebString& url, const ArkWebCharVector& post_data) = 0;
846 
847     /**
848      * @brief Inject the JavaScript before WebView load the DOM tree.
849      */
850     /*--ark web()--*/
851     virtual void JavaScriptOnDocumentStart(const ArkWebStringVectorMap& script_items) = 0;
852 
853     /**
854      * @brief Execute an accessibility action on an accessibility node in the
855      *        browser.
856      *
857      * @param accessibility_id: The id of the accessibility node.
858      * @param action: The action to be performed on the accessibility node.
859      */
860     /*--ark web()--*/
861     virtual void ExecuteAction(int64_t accessibility_id, uint32_t action) = 0;
862 
863     /**
864      * @brief Get the information of the focused accessibility node on the given
865      *        accessibility node in the browser.
866      *
867      * @param accessibility_id: Indicate the accessibility id of the parent node
868      *        of the focused accessibility node.
869      * @param is_accessibility_focus: Indicate whether the focused accessibility
870      *        node is accessibility focused or input focused.
871      *
872      * @return The obtained information of the accessibility node.
873      */
874     /*--ark web()--*/
875     virtual ArkWebRefPtr<ArkWebAccessibilityNodeInfo> GetFocusedAccessibilityNodeInfo(
876         int64_t accessibility_id, bool is_accessibility_focus) = 0;
877 
878     /**
879      * @brief Get the information of the accessibility node by its accessibility
880      *        id in the browser.
881      *
882      * @param accessibility_id: The accessibility id of the accessibility node.
883      *
884      * @return The obtained information of the accessibility node.
885      */
886     /*--ark web()--*/
887     virtual ArkWebRefPtr<ArkWebAccessibilityNodeInfo> GetAccessibilityNodeInfoById(int64_t accessibility_id) = 0;
888 
889     /**
890      * @brief Get the information of the accessibility node by focus move in the
891      *        browser.
892      *
893      * @param accessibility_id: The accessibility id of the original accessibility
894      *        node.
895      * @param direction: The focus move direction of the original accessibility
896      *        node.
897      *
898      * @return The obtained information of the accessibility node.
899      */
900     /*--ark web()--*/
901     virtual ArkWebRefPtr<ArkWebAccessibilityNodeInfo> GetAccessibilityNodeInfoByFocusMove(
902         int64_t accessibility_id, int32_t direction) = 0;
903 
904     /**
905      * @brief Set the accessibility state in the browser.
906      *
907      * @param state: Indicate whether the accessibility state is enabled or
908      *        disabled.
909      */
910     /*--ark web()--*/
911     virtual void SetAccessibilityState(bool state) = 0;
912 
913     /**
914      * @brief Get whether need soft keyboard.
915      *
916      * @return true if need soft keyboard, otherwise false.
917      */
918     /*--ark web()--*/
919     virtual bool NeedSoftKeyboard() = 0;
920 
921     /**
922      * @brief Discard the webview window.
923      *
924      * @return true if the discarding success, otherwise false.
925      */
926     /*--ark web()--*/
927     virtual bool Discard() = 0;
928 
929     /**
930      * @brief Reload the webview window that has been discarded before.
931      *
932      * @return true if the discarded window reload success, otherwise false.
933      */
934     /*--ark web()--*/
935     virtual bool Restore() = 0;
936 
937     /**
938      * @brief Get the security level of current page.
939      *
940      * @return security level for current page.
941      */
942     /*--ark web()--*/
943     virtual int GetSecurityLevel() = 0;
944 
945     /**
946      * @brief CallH5Function
947      *
948      * @param routingId         int32_t: the h5 frame routing id
949      * @param h5ObjectId        int32_t: the h5 side object id
950      * @param h5MethodName      string: the h5 side object method name
951      * @param args              vector<shared_ptr<NWebValue>>: the call args
952      */
953     /*--ark web()--*/
954     virtual void CallH5Function(
955         int32_t routingId, int32_t h5ObjectId, const ArkWebString& h5MethodName, const ArkWebValueVector& args) = 0;
956 
957     /**
958      * @brief Get web weather has been set incognito mode.
959      *
960      * @return true if web is in incognito mode; otherwise fase.
961      */
962     /*--ark web()--*/
963     virtual bool IsIncognitoMode() = 0;
964 
965     /**
966      * @brief Register native function.
967      */
968     /*--ark web()--*/
969     virtual void RegisterNativeArkJSFunction(const char* objName, const ArkWebJsProxyCallbackVector& callbacks) = 0;
970 
971     /**
972      * @brief Unregister native function.
973      */
974     /*--ark web()--*/
975     virtual void UnRegisterNativeArkJSFunction(const char* objName) = 0;
976 
977     /**
978      * @brief Register native valide callback function.
979      */
980     /*--ark web()--*/
981     virtual void RegisterNativeValideCallback(const char* webName, const NativeArkWebOnValidCallback callback) = 0;
982 
983     /**
984      * @brief Register native destroy callback function.
985      */
986     /*--ark web()--*/
987     virtual void RegisterNativeDestroyCallback(const char* webName, const NativeArkWebOnValidCallback callback) = 0;
988 
989     /**
990      * @brief Inject the JavaScript after WebView loads the DOM tree and run
991      *        JavaScripts.
992      */
993     /*--ark web()--*/
994     virtual void JavaScriptOnDocumentEnd(const ArkWebStringVectorMap& script_items) = 0;
995 
996     /**
997      * @brief Enable the ability to check website security risks.Illegal and
998      *        fraudulent websites are mandatory enabled and cann't be disabled by
999      *        this function.
1000      */
1001     /*--ark web()--*/
1002     virtual void EnableSafeBrowsing(bool enable) = 0;
1003 
1004     /**
1005      * @brief Get whether checking website security risks is enabled.
1006      *
1007      * @return true if enable the ability to check website security risks else
1008      *         false.
1009      */
1010     /*--ark web()--*/
1011     virtual bool IsSafeBrowsingEnabled() = 0;
1012 
1013     /**
1014      * @brief Set the ability to print web page background.
1015      *
1016      * @param enable Indicate whether the ability is enabled or disabled.
1017      */
1018     /*--ark web()--*/
1019     virtual void SetPrintBackground(bool enable) = 0;
1020 
1021     /**
1022      * @brief Obtains whether to print the background of a web page.
1023      *
1024      * @return true if enable print web page background, otherwise false.
1025      */
1026     /*--ark web()--*/
1027     virtual bool GetPrintBackground() = 0;
1028 
1029     /**
1030      * @brief Close fullScreen video.
1031      */
1032     /*--ark web()--*/
1033     virtual void CloseAllMediaPresentations() = 0;
1034 
1035     /**
1036      * @brief Stop all audio and video playback on the web page.
1037      */
1038     /*--ark web()--*/
1039     virtual void StopAllMedia() = 0;
1040 
1041     /**
1042      * @brief Restart playback of all audio and video on the web page.
1043      */
1044     /*--ark web()--*/
1045     virtual void ResumeAllMedia() = 0;
1046 
1047     /**
1048      * @brief Pause all audio and video playback on the web page.
1049      */
1050     /*--ark web()--*/
1051     virtual void PauseAllMedia() = 0;
1052 
1053     /**
1054      * @brief View the playback status of all audio and video on the web page.
1055      *
1056      * @return The playback status of all audio and video.
1057      */
1058     /*--ark web()--*/
1059     virtual int GetMediaPlaybackState() = 0;
1060 
1061     /**
1062      * @brief Enable the ability to intelligent tracking prevention, default
1063      * disabled.
1064      *
1065      * @param enable Indicate whether the abilitiy is enabled or disabled.
1066      */
1067     /*--ark web()--*/
1068     virtual void EnableIntelligentTrackingPrevention(bool enable) = 0;
1069 
1070     /**
1071      * @brief Get whether intelligent tracking prevention is enabled.
1072      * @return true if enable the ability intelligent tracking prevention; else
1073      * false.
1074      */
1075     /*--ark web()--*/
1076     virtual bool IsIntelligentTrackingPreventionEnabled() = 0;
1077 
1078     /**
1079      * @brief Start current camera.
1080      */
1081     /*--ark web()--*/
1082     virtual void StartCamera() = 0;
1083 
1084     /**
1085      * @brief Stop current camera.
1086      */
1087     /*--ark web()--*/
1088     virtual void StopCamera() = 0;
1089 
1090     /**
1091      * @brief Close current camera.
1092      */
1093     /*--ark web()--*/
1094     virtual void CloseCamera() = 0;
1095 
1096     /**
1097      * @brief Obtains the last javascript proxy calling frame url.
1098      *
1099      * @return the url of last calling frame url.
1100      */
1101     /*--ark web()--*/
1102     virtual ArkWebString GetLastJavascriptProxyCallingFrameUrl() = 0;
1103 
1104     /**
1105      * @brief Get pendingsize status.
1106      *
1107      * @return result of last pendingsize status.
1108      */
1109     /*--ark web()--*/
1110     virtual bool GetPendingSizeStatus() = 0;
1111 
1112     /**
1113      * @brief Scroll by the delta distance or velocity takes the screen as a
1114      * reference.
1115      *
1116      * @param delta_x horizontal offset in physical pixel.
1117      * @param delta_y vertical offset in physical pixel.
1118      * @param vx      horizontal velocity in physical pixel.
1119      * @param vx      vertical velocity in physical pixel.
1120      */
1121     /*--ark web()--*/
1122     virtual void ScrollByRefScreen(float delta_x, float delta_y, float vx, float vy) = 0;
1123 
1124     /**
1125      * @brief ExecuteJavaScript with ashmem
1126      *
1127      * @param fd fd of the ashmem
1128      * @param scriptLength javascript code length
1129      * @param callback javascript running result
1130      * @param extention true if is extension
1131      */
1132     /*--ark web()--*/
1133     virtual void ExecuteJavaScriptExt(
1134         const int fd, const size_t scriptLength, ArkWebRefPtr<ArkWebMessageValueCallback> callback, bool extention) = 0;
1135 
1136     /**
1137      * @brief Render process switch to background.
1138      */
1139     /*--ark web()--*/
1140     virtual void OnRenderToBackground() = 0;
1141 
1142     /**
1143      * @brief Render process switch to foreground.
1144      */
1145     /*--ark web()--*/
1146     virtual void OnRenderToForeground() = 0;
1147 
1148     /**
1149      * @brief Compile javascript and generate code cache.
1150      *
1151      * @param url url of javascript.
1152      * @param script javascript text content.
1153      * @param cacheOptions compile options and info.
1154      * @param callback callback will be called on getting the result of compiling
1155      * javascript.
1156      */
1157     /*--ark web()--*/
1158     virtual void PrecompileJavaScript(const ArkWebString& url, const ArkWebString& script,
1159         ArkWebRefPtr<ArkWebCacheOptions>& cacheOptions, ArkWebRefPtr<ArkWebMessageValueCallback> callback) = 0;
1160 
1161     /*--ark web()--*/
1162     virtual void OnCreateNativeMediaPlayer(ArkWebRefPtr<ArkWebCreateNativeMediaPlayerCallback> callback) = 0;
1163 
1164     /**
1165      * @brief Web drag resize optimize.
1166      */
1167     /*--ark web()--*/
1168     virtual void DragResize(uint32_t width, uint32_t height, uint32_t pre_height, uint32_t pre_width) = 0;
1169 
1170     /*--ark web()--*/
1171     virtual void OnTouchCancelById(int32_t id, double x, double y, bool from_overlay) = 0;
1172 
1173     /**
1174      * @brief Set the params when the scale of WebView changed by pinch gestrue.
1175      *
1176      * @param scale: the scale factor to apply. The scale will be
1177      *        clamped to the pinch limits. This value must be in the range
1178      *        0.01 to 8.0 inclusive.
1179      * @param centerX: X-coordinate of the pinch center
1180      * @param centerX: Y-coordinate of the pinch center
1181      *
1182      * @return the error id.
1183      */
1184     /*--ark web()--*/
1185     virtual int ScaleGestureChange(double scale, double centerX, double centerY) = 0;
1186 
1187     /**
1188      * @brief Inject offline resource into MemoryCache.
1189      *
1190      * @param url url of resource.
1191      * @param origin origin of resource.
1192      * @param resource data of resource.
1193      * @param response_headers response headers of resource.
1194      * @param type resource type.
1195      */
1196     /*--ark web()--*/
1197     virtual void InjectOfflineResource(const ArkWebString& url, const ArkWebString& origin,
1198         const ArkWebUint8Vector& resource, const ArkWebStringMap& responseHeaders, const int type) = 0;
1199 
1200     /*
1201      * @brief Terminate render process
1202      *
1203      * @return true if it was possible to terminate this render process, false
1204      * otherwise.
1205      */
1206     /*--ark web()--*/
1207     virtual bool TerminateRenderProcess() = 0;
1208 
1209     /**
1210      * Get value of Autofill index.
1211      * @param index index value.
1212      */
1213     /*--ark web()--*/
1214     virtual void SuggestionSelected(int32_t index) = 0;
1215 
1216     /**
1217      * @brief RegisterArkJSfunction
1218      *
1219      * @param object_name  String: objector name
1220      * @param method_list vector<String>: vector list, sync method list
1221      * @param async_method_list vector<String>: vector list, async method list
1222      * @param object_id int32_t: object id
1223      */
1224     /*--ark web()--*/
1225     virtual void RegisterArkJSfunction(const ArkWebString& object_name, const ArkWebStringVector& method_list,
1226         const ArkWebStringVector& async_method_list, const int32_t object_id) = 0;
1227 
1228     /**
1229      * @brief Send touchpad fling event.
1230      *
1231      * @param x location of x.
1232      * @param y location of y.
1233      * @param vx velocity of x.
1234      * @param vy velocity of y.
1235      */
1236     /*--ark web()--*/
1237     virtual void SendTouchpadFlingEvent(double x, double y, double vx, double vy) = 0;
1238 
1239     /**
1240      * @brief Set fit content mode.
1241      */
1242     /*--ark web()--*/
1243     virtual void SetFitContentMode(int32_t mode) = 0;
1244 
1245     /**
1246      * @brief Get select info.
1247      *
1248      * @return the info of selection.
1249      */
1250     /*--ark web()--*/
1251     virtual ArkWebString GetSelectInfo() = 0;
1252 
1253     /**
1254      * @brief None offline Render process switch to foreground.
1255      */
1256     /*--ark web()--*/
1257     virtual void OnOnlineRenderToForeground() = 0;
1258 
1259     /**
1260      * @brief Notify that safe insets change.
1261      *
1262      */
1263     /*--ark web()--*/
1264     virtual void OnSafeInsetsChange(int left, int top, int right, int bottom) = 0;
1265 
1266     /**
1267      * @brief Called when text is selected in image.
1268      */
1269     /*--ark web()--*/
1270     virtual void OnTextSelected() = 0;
1271 
1272     /**
1273      * @brief web send key event.
1274      */
1275     /*--ark web()--*/
1276     virtual bool WebSendKeyEvent(int32_t keyCode, int32_t keyAction,
1277                                  const ArkWebInt32Vector& pressedCodes) = 0;
1278 
1279     /**
1280      * @brief Notify that system configuration changed.
1281      *
1282      * @param configuration system configuration.
1283      */
1284     /*--ark web()--*/
1285     virtual void OnConfigurationUpdated(
1286         ArkWebRefPtr<ArkWebSystemConfiguration> configuration) = 0;
1287 
1288     /**
1289      * @brief Enable the ability to block Ads, default disabled.
1290      */
1291     /*--ark web()--*/
1292     virtual void EnableAdsBlock(bool enable) = 0;
1293 
1294     /**
1295      * @brief Get whether Ads block is enabled.
1296      */
1297     /*--ark web()--*/
1298     virtual bool IsAdsBlockEnabled() = 0;
1299 
1300     /**
1301      * @brief Get whether Ads block is enabled for current Webpage.
1302      */
1303     /*--ark web()--*/
1304     virtual bool IsAdsBlockEnabledForCurPage() = 0;
1305 
1306     /**
1307      * @brief Notify for next touch move event.
1308      */
1309     /*--ark web()--*/
1310     virtual void NotifyForNextTouchEvent() = 0;
1311 
1312     /**
1313      * @brief Set url trust list.
1314      *
1315      */
1316     /*--ark web()--*/
1317     virtual int SetUrlTrustList(const ArkWebString& urlTrustList) = 0;
1318 
1319     /**
1320      * @brief Put the callback, convert sapnstring to html.
1321      *
1322      * @param callback will convert spanstring to html.
1323      */
1324     /*--ark web()--*/
1325     virtual void PutSpanstringConvertHtmlCallback(
1326         ArkWebRefPtr<ArkWebSpanstringConvertHtmlCallback> callback) = 0;
1327 
1328     /**
1329      * @brief Get Web page snapshot
1330      *
1331      * @param id Request id.
1332      * @param type Request snapshot pixel unit.
1333      * @param width Request SnapShot width.
1334      * @param height Request SnapShot height.
1335      * @param callback SnapShot result callback.
1336      * @return ture if succuess request snapshot to renderer.
1337      */
1338     /*--ark web()--*/
1339     virtual bool WebPageSnapshot(const char* id,
1340                                  int type,
1341                                  int width,
1342                                  int height,
1343                                  const WebSnapshotCallback callback) = 0;
1344 
1345     /**
1346      * @brief Set grant file access dirs.
1347      */
1348     /*--ark web()--*/
1349     virtual void SetPathAllowingUniversalAccess(const ArkWebStringVector& dirs,
1350                                                 const ArkWebStringVector& moduleName,
1351                                                 ArkWebString& errorPath) = 0;
1352 
1353     /**
1354      * Execute an accessibility action on an accessibility node in the browser.
1355      * @param accessibilityId The id of the accessibility node.
1356      * @param action The action to be performed on the accessibility node.
1357      * @param actionArguments Data related to the current action.
1358      */
1359     /*--ark web()--*/
1360     virtual void PerformAction(int64_t accessibilityId, uint32_t action,
1361         const ArkWebStringMap& actionArguments) = 0;
1362 
1363     /**
1364      * Scroll to the position.
1365      *
1366      * @param x horizontal coordinate.
1367      * @param y vertical coordinate.
1368      * @param duration: anime duration.
1369      */
1370     /*--ark web()--*/
1371     virtual void ScrollToWithAnime(float x, float y, int32_t duration) = 0;
1372 
1373     /**
1374      * Scroll by the delta distance.
1375      *
1376      * @param delta_x: horizontal offset.
1377      * @param delta_y: vertical offset.
1378      * @param duration: anime duration.
1379      */
1380     /*--ark web()--*/
1381     virtual void ScrollByWithAnime(float delta_x, float delta_y, int32_t duration) = 0;
1382 
1383     /**
1384      * @brief Send mouse wheel event.
1385      */
1386     /*--ark web()--*/
1387     virtual void WebSendMouseWheelEvent(double x,
1388                                         double y,
1389                                         double delta_x,
1390                                         double delta_y,
1391                                         const ArkWebInt32Vector& pressedCodes) = 0;
1392 
1393     /**
1394      * @brief Send touchpad fling event.
1395      *
1396      * @param x location of x.
1397      * @param y location of y.
1398      * @param vx velocity of x.
1399      * @param vy velocity of y.
1400      * @param pressedCodes pressed codes.
1401      */
1402     /*--ark web()--*/
1403     virtual void WebSendTouchpadFlingEvent(double x,
1404                                            double y,
1405                                            double vx,
1406                                            double vy,
1407                                            const ArkWebInt32Vector& pressedCodes) = 0;
1408 
1409     /**
1410      * @brief Set url trust list with error message.
1411      *
1412      */
1413     /*--ark web()--*/
1414     virtual int SetUrlTrustListWithErrMsg(const ArkWebString& urlTrustList, ArkWebString& detailErrMsg) = 0;
1415 
1416     /**
1417      * @brief Send the accessibility hover event coordinate.
1418      *
1419      * @param x horizontal location of coordinate.
1420      * @param y vertical location of coordinate.
1421      */
1422     /*--ark web()--*/
1423     virtual void SendAccessibilityHoverEvent(int32_t x, int32_t y) = 0;
1424 
1425     /**
1426      * @brief RegisterArkJSfunction
1427      *
1428      * @param object_name  String: objector name
1429      * @param method_list vector<String>: vector list, sync method list
1430      * @param async_method_list vector<String>: vector list, async method list
1431      * @param object_id int32_t: object id
1432      * @param permission String: allow list
1433      */
1434     /*--ark web()--*/
1435     virtual void RegisterArkJSfunction(const ArkWebString& object_name, const ArkWebStringVector& method_list,
1436         const ArkWebStringVector& async_method_list, const int32_t object_id, const ArkWebString& permission) = 0;
1437 
1438     /**
1439      * @brief resize visual viewport.
1440      *
1441      * @param width width.
1442      * @param height height.
1443      * @param iskeyboard from keybord.
1444      */
1445     /*--ark web()--*/
1446     virtual void ResizeVisibleViewport(uint32_t width, uint32_t height, bool isKeyboard) = 0;
1447 
1448     /**
1449      * @brief set backforward cache options.
1450      * @param size The size of the back forward cache could saved.
1451      * @param timeToLive The time of the back forward cache page could stay.
1452      */
1453     /*--ark web()--*/
1454     virtual void SetBackForwardCacheOptions(int32_t size, int32_t timeToLive) = 0;
1455 
1456     /**
1457      * @brief set the callback of the autofill event.
1458      * @param callback callback.
1459      */
1460     /*--ark web()--*/
1461     virtual void SetAutofillCallback(ArkWebRefPtr<ArkWebMessageValueCallback> callback) = 0;
1462 
1463     /**
1464      * @brief fill autofill data.
1465      * @param data data.
1466      */
1467     /*--ark web()--*/
1468     virtual void FillAutofillData(const ArkWebMessage& data) = 0;
1469 
1470     /**
1471      * @brief on autofill cancel.
1472      * @param fillContent fillContent
1473      */
1474     /*--ark web()--*/
1475     virtual void OnAutofillCancel(const ArkWebString& fillContent) = 0;
1476 
1477     /**
1478      * @brief Get the current scroll offset of the webpage.
1479      * @param offset_x The current horizontal scroll offset of the webpage.
1480      * @param offset_y The current vertical scroll offset of the webpage.
1481      */
1482     /*--ark web()--*/
1483     virtual void GetScrollOffset(float* offset_x, float* offset_y) = 0;
1484 
1485     /**
1486      * @brief ExecuteCreatePDFExt
1487      *
1488      * @param pdfConfig The current configuration when creating pdf.
1489      * @param callback NWebArrayBufferValueCallback: CreatePDF running result.
1490      */
1491     /*--ark web()--*/
1492     virtual void ExecuteCreatePDFExt(ArkWebRefPtr<ArkWebPDFConfigArgs> pdfConfig,
1493         ArkWebRefPtr<ArkWebArrayBufferValueCallback> callback) = 0;
1494 
1495     /**
1496      * Scroll by the delta distance if web is not foucsed.
1497      *
1498      * @param delta_x horizontal offset.
1499      * @param delta_y vertical offset.
1500      * @return false if web is touched down.
1501      */
1502     /*--ark web()--*/
1503     virtual bool ScrollByWithResult(float delta_x, float delta_y) = 0;
1504 
1505     /**
1506      * @brief set a popupSurface to draw popup content
1507      * @param popupSurface popupSurface.
1508      */
1509     /*--ark web()--*/
1510     virtual void SetPopupSurface(void* popupSurface) = 0;
1511 
1512     /**
1513      * @brief Called when image analyzer is destory.
1514      */
1515     /*--ark web()--*/
1516     virtual void OnDestroyImageAnalyzerOverlay() = 0;
1517 
1518     /**
1519      * @Description: Sends mouse events to the web kernel.
1520      * @Input mouseEvent: Basic information about mouse events.
1521      * @Since: 12005
1522      */
1523     /*--ark web()--*/
1524     virtual void WebSendMouseEvent(ArkWebRefPtr<ArkWebMouseEvent> mouseEvent) = 0;
1525 
1526     /**
1527      * @Description: Get the accessibility visibility of the accessibility node by its accessibility id in the browser.
1528      * @Input accessibility_id: The accessibility id of the accessibility node.
1529      * @Return: The accessibility visibility of the accessibility node.
1530      * @Since: 12005
1531      */
1532     /*--ark web()--*/
1533     virtual bool GetAccessibilityVisible(int64_t accessibility_id) = 0;
1534 
1535     /**
1536      * @Description: Set the rotation to psurface.
1537      * @Input rotation: The rotation of buffer.
1538      * @Since: 12005
1539      */
1540     /*--ark web()--*/
1541     virtual void SetTransformHint(uint32_t rotation) = 0;
1542 
1543     /**
1544      * @brief Web components blur when the keyboard is hidden by gesture back.
1545      */
1546     /*--ark web()--*/
1547     virtual void WebComponentsBlur() = 0;
1548 
1549     /**
1550      * @Description: Get the GPU memory size used by web.
1551      * @Return: Total size of web GPU.
1552      */
1553     /*--ark web()--*/
1554     virtual float DumpGpuInfo() = 0;
1555 
1556     /**
1557      * @Description: Set the params when the scale of WebView changed by pinch gestrue.
1558      *
1559      * @Input type: gesture status
1560      * @Input scale: the scale factor to apply. The scale will be
1561      *        clamped to the pinch limits. This value must be in the range
1562      *        0.01 to 8.0 inclusive.
1563      * @Input originScale: the origin scale factor to apply. The scale will be
1564      *        clamped to the pinch limits. This value must be in the range
1565      *        0.01 to 8.0 inclusive.
1566      * @Input centerX: X-coordinate of the pinch center
1567      * @Input centerY: Y-coordinate of the pinch center
1568      *
1569      * @Return: the error id.
1570      */
1571     /*--ark web()--*/
1572     virtual int ScaleGestureChangeV2(int type, double scale, double originScale, double centerX, double centerY) = 0;
1573 
1574     /**
1575      * @Description: Sends key events to the web kernel.
1576      * @Input mouseEvent: Basic information about key events.
1577      */
1578     /*--ark web()--*/
1579     virtual bool SendKeyboardEvent(ArkWebRefPtr<ArkWebKeyboardEvent> keyboardEvent) = 0;
1580 
1581     /**
1582      * @Description: Execute an accessibility action on an accessibility node in the browser.
1583      * @Input accessibilityId: The id of the accessibility node.
1584      * @Input action: The action to be performed on the accessibility node.
1585      * @Input actionArguments: Data related to the current action.
1586      * @Return: Whether the action is performed successfully.
1587      */
1588     /*--ark web()--*/
1589     virtual bool PerformActionV2(int64_t accessibilityId, uint32_t action,
1590         const ArkWebStringMap& actionArguments) = 0;
1591 
1592     /**
1593      * @brief Inject the JavaScript before WebView load the DOM tree.
1594      */
1595     /*--ark web()--*/
1596     virtual void JavaScriptOnDocumentStartByOrder(const ArkWebStringVectorMap& script_items,
1597         const ArkWebStringVector& script_items_by_order) = 0;
1598 
1599     /**
1600      * @brief Inject the JavaScript after WebView loads the DOM tree and run
1601      *        JavaScripts.
1602      */
1603     /*--ark web()--*/
1604     virtual void JavaScriptOnDocumentEndByOrder(const ArkWebStringVectorMap& script_items,
1605         const ArkWebStringVector& script_items_by_order) = 0;
1606 
1607     /**
1608      * @Description: Check web component active policy disable, default: false
1609      * @Return: Whether the policy is disable.
1610      */
1611     /*--ark web()--*/
1612     virtual bool IsActivePolicyDisable() = 0;
1613 
1614     /**
1615      * @Description: Inject the JavaScript when the head element has been created.
1616      * @Input scriptItems: The injected JavaScript code is stored in lexicographical order.
1617      * @Input scriptItemsByOrder: The injected JavaScript code is stored in the order of the injection array.
1618      */
1619     /*--ark web()--*/
1620     virtual void JavaScriptOnHeadReadyByOrder(const ArkWebStringVectorMap& script_items,
1621         const ArkWebStringVector& script_items_by_order) = 0;
1622 
1623     /**
1624      * @Description: Optimize HTML parser budget to reduce FCP time.
1625      * @Input enable: Set whether to use optimized parser budget.
1626      */
1627     /*--ark web()--*/
1628     virtual void PutOptimizeParserBudgetEnabled(bool enable) = 0;
1629 
1630     /**
1631      * @Description: Get the bounding rectangle of the accessibility node of the given id.
1632      * @Input accessibilityId: The id of the accessibility node.
1633      * @Output width: The width of the rectangle.
1634      * @Output height: The height of the rectangle.
1635      * @Output offsetX: The X-coordinate offset of the rectangle.
1636      * @Output offsetY: The Y-coordinate offset of the rectangle.
1637      * @Return: Whether the bounding rectangle is obtained successfully.
1638      */
1639     /*--ark web()--*/
1640     virtual bool GetAccessibilityNodeRectById(
1641         int64_t accessibilityId, int32_t* width, int32_t* height, int32_t* offsetX, int32_t* offsetY) = 0;
1642 
1643     /**
1644      * @brief Gets the last hit test result.
1645      *
1646      * @return the last HitTestResult
1647      */
1648     /*--ark web()--*/
1649     virtual ArkWebRefPtr<ArkWebHitTestResult> GetLastHitTestResult() = 0;
1650 
1651     /**
1652      * @Description: Get the current language in the webview.
1653      * @Return: The current language in the webview.
1654      */
1655     /*--ark web()--*/
1656     virtual ArkWebString GetCurrentLanguage() = 0;
1657 
1658     /**
1659      * @brief Send mouse wheel event with sourceTool info.
1660      */
1661     /*--ark web()--*/
1662     virtual bool WebSendMouseWheelEventV2(
1663         double x, double y, double delta_x, double delta_y, const ArkWebInt32Vector &pressedCodes, int32_t source) = 0;
1664 
1665     /**
1666      * @brief judge if browser use drag resize.
1667      */
1668     /*--ark web()--*/
1669     virtual bool IsNWebEx() = 0;
1670 
1671     /**
1672      * @brief Set enable half the frame rate.
1673      */
1674     /*--ark web()--*/
1675     virtual void SetEnableHalfFrameRate(bool enabled) = 0;
1676 
1677     /**
1678      * @brief Web maximize resize optimize.
1679      */
1680     /*--ark web()--*/
1681     virtual void MaximizeResize() = 0;
1682 
1683     /*
1684      * @brief Try to attach web inputmethod after drag.
1685      */
1686     /*--ark web()--*/
1687     virtual void OnDragAttach()  = 0;
1688 
1689     /**
1690      * Set focus by position
1691      *
1692      * @Return: if hit node editable.
1693      */
1694     /*--ark web()--*/
1695     virtual bool SetFocusByPosition(float x, float y) = 0;
1696 
1697     /**
1698      * @brief set DPI when DPI changes.
1699      * @param density The new density value.
1700      */
1701     /*--ark web()--*/
1702     virtual void SetSurfaceDensity(const double& density) = 0;
1703 
1704     /**
1705      * @brief When the user sets the webpage's border radius,
1706      *        update Chromium with this radius value for repaint the scrollbar.
1707      * @param borderRadiusTopLeft: Radius value of the rounded corner in the top-left of the webpage.
1708      * @param borderRadiusTopRight: Radius value of the rounded corner in the top-right of the webpage.
1709      * @param borderRadiusBottomLeft: Radius value of the rounded corner in the bottom-left of the webpage.
1710      * @param borderRadiusBottomRight: Radius value of the rounded corner in the bottom-right of the webpage.
1711      */
1712     /*--ark web()--*/
1713     virtual void SetBorderRadiusFromWeb(double borderRadiusTopLeft, double borderRadiusTopRight,
1714         double borderRadiusBottomLeft, double borderRadiusBottomRight) = 0;
1715 
1716     /**
1717      * @brief Set the native inner web
1718      */
1719     /*--ark web()--*/
1720     virtual void SetNativeInnerWeb(bool isInnerWeb) = 0;
1721 
1722     /**
1723      * @brief Send the accessibility hover event coordinate.
1724      *
1725      * @param x horizontal location of coordinate.
1726      * @param y vertical location of coordinate.
1727      * @param isHoverEnter whether the accessibility hover event is a hover enter event.
1728      */
1729     /*--ark web()--*/
1730     virtual void SendAccessibilityHoverEventV2(int32_t x, int32_t y, bool isHoverEnter) = 0;
1731 
1732     /**
1733      * @brief Notify browser is foreground.
1734      */
1735     /*--ark web()--*/
1736     virtual void OnBrowserForeground() = 0;
1737 
1738     /**
1739      * @brief Notify browser is background.
1740      */
1741     /*--ark web()--*/
1742     virtual void OnBrowserBackground() = 0;
1743 
1744     /**
1745      * @brief: register native javaScriptProxy.
1746      *
1747      * @param objName object name.
1748      * @param methodName methodName list
1749      * @param data The ptr of NWebJsProxyMethod.
1750      * @param isAsync True mean.
1751      * @param permission permission.
1752      */
1753     /*--ark web()--*/
1754     virtual void RegisterNativeJavaScriptProxy(const ArkWebString& objName,
1755         const ArkWebStringVector& methodName,
1756         ArkWebRefPtr<ArkWebJsProxyMethod> data,
1757         bool isAsync,
1758         const ArkWebString& permission) = 0;
1759 
1760     /**
1761      * @brief Set the window id.
1762      */
1763     /*--ark web()--*/
1764     virtual void SetFocusWindowId(uint32_t focus_window_id) = 0;
1765 
1766     /**
1767      * @brief Run data detector JS
1768      */
1769     /*--ark web()--*/
1770     virtual void RunDataDetectorJS() = 0;
1771 
1772     /**
1773      * @brief Set data detector enable.
1774      */
1775     /*--ark web()--*/
1776     virtual void SetDataDetectorEnable(bool enable) = 0;
1777 
1778     /**
1779      * @brief On data detector select text.
1780      */
1781     /*--ark web()--*/
1782     virtual void OnDataDetectorSelectText() = 0;
1783 
1784     /**
1785      * @brief On data detector copy.
1786      */
1787     /*--ark web()--*/
1788     virtual void OnDataDetectorCopy(const ArkWebStringVector& recordMix) = 0;
1789 
1790     /**
1791      * @brief Set the native window of picture in picture.
1792      */
1793     /*--ark web()--*/
1794     virtual void SetPipNativeWindow(int delegate_id,
1795                                     int child_id,
1796                                     int frame_routing_id,
1797                                     void* window) = 0;
1798 
1799     /**
1800      * @brief Send event of picture in picture.
1801      */
1802     /*--ark web()--*/
1803     virtual void SendPipEvent(int delegate_id,
1804                               int child_id,
1805                               int frame_routing_id,
1806                               int event) = 0;
1807 
1808     /*
1809      * @brief Set unique key of current page for insert frame.
1810      *
1811      * @param key The unique key of current page.
1812      */
1813     /*--ark web()--*/
1814     virtual void SetBlanklessLoadingKey(const ArkWebString& key) = 0;
1815 
1816     /**
1817      * @brief Set privacy status.
1818      *
1819      * @param isPrivate bool: privacy status page.
1820      */
1821     /*--ark web()--*/
1822     virtual void SetPrivacyStatus(bool isPrivate) = 0;
1823 
1824     /**
1825      * @brief Get select startIndex.
1826      *
1827      * @return the select startIndex.
1828      */
1829     /*--ark web()--*/
1830     virtual int GetSelectStartIndex() = 0;
1831 
1832     /**
1833      * @brief Get select endIndex.
1834      *
1835      * @return the select endIndex.
1836      */
1837     /*--ark web()--*/
1838     virtual int GetSelectEndIndex() = 0;
1839 
1840     /**
1841      * @brief Get all text info.
1842      *
1843      * @return the info of all text.
1844      */
1845     /*--ark web()--*/
1846     virtual ArkWebString GetAllTextInfo() = 0;
1847 
1848     /**
1849      * @brief Set audio session type.
1850      *
1851      * @param audio_session_type: Aduio session type.
1852      */
1853     /*--ark web()--*/
1854     virtual void SetAudioSessionType(int32_t audio_session_type) = 0;
1855 
1856     /**
1857      * @brief Get accessibility id by its html element id in the browser.
1858      * @param htmlElementId The html element id of the Same-layer rendering.
1859      * @return The accessibility id of the accessibility node with Same-layer rendering.
1860      */
1861     /*--ark web()--*/
1862     virtual int64_t GetWebAccessibilityIdByHtmlElementId(const ArkWebString& htmlElementId) = 0;
1863 
1864     /**
1865      * @brief Get the prediction info of blankless loading on the current page.
1866      *
1867      * @param key The unique key of current page.
1868      * @param similarity The historical snapshot similarity.
1869      * @param loadingTime The historical loading time.
1870      * @return The error code.
1871      */
1872     /*--ark web()--*/
1873     virtual int32_t GetBlanklessInfoWithKey(const ArkWebString& key, double* similarity, int32_t* loadingTime) = 0;
1874 
1875     /**
1876      * @brief Set whether to enable blankless loading on the current page.
1877      *
1878      * @param key The unique key of current page.
1879      * @param isStart Whether to enable blankless loading.
1880      * @return The error code.
1881      */
1882     /*--ark web()--*/
1883     virtual int32_t SetBlanklessLoadingWithKey(const ArkWebString& key, bool isStart) = 0;
1884 
1885     /**
1886      * @brief Update the single handle visible.
1887      * @param isVisible The single handle visible.
1888      */
1889     /*--ark web()--*/
1890     virtual void UpdateSingleHandleVisible(bool isVisible) = 0;
1891 
1892     /**
1893      * @brief Set the state of touch handle when it exists.
1894      * @param touchHandleExist The state of the touch handle, Which is true if the touch handle exists.
1895      */
1896     /*--ark web()--*/
1897     virtual void SetTouchHandleExistState(bool touchHandleExist) = 0;
1898 
1899     /**
1900      * @brief Sets the bottom avoidance height of the web visible viewport.
1901      * @param avoidHeight The height value of the visible viewport avoidance. Unit: px.
1902      */
1903     /*--ark web()--*/
1904     virtual void AvoidVisibleViewportBottom(int32_t avoidHeight) = 0;
1905 
1906     /**
1907      * @brief Get the bottom avoidance height of the web visible viewport.
1908      * @return The bottom avoidance height of the visible viewport.
1909      */
1910     /*--ark web()--*/
1911     virtual int32_t GetVisibleViewportAvoidHeight() = 0;
1912 
1913     /**
1914      * @brief Try to trigger blankless for url.
1915      * @param url The url to use for blankless.
1916      * @return Blankless is triggered for this url.
1917      */
1918     /*--ark web()--*/
1919     virtual bool TriggerBlanklessForUrl(const ArkWebString& url) = 0;
1920 
1921     /**
1922      * @brief Set visibility of the web.
1923      * @param isVisible The visibility to be set.
1924      */
1925     /*--ark web()--*/
1926     virtual void SetVisibility(bool isVisible) = 0;
1927 
1928     /**
1929      * @brief Current viewport is being scaled.
1930      */
1931     /*--ark web()--*/
1932     virtual void SetViewportScaleState() = 0;
1933 
1934     /**
1935     * @brief Get the current scroll offset of the webpage.
1936     * @param offset_x The current horizontal scroll offset of the webpage.
1937     * @param offset_y The current vertical scroll offset of the webpage.
1938     */
1939    /*--ark web()--*/
1940    virtual void GetPageOffset(float* offset_x, float* offset_y) = 0;
1941 
1942     /**
1943      * @brief Set whether enable the error page. onOverrideErrorPage will be triggered when the page error.
1944      *
1945      * @param enable bool: Whether enable the error page.
1946      */
1947     /*--ark web()--*/
1948     virtual void SetErrorPageEnabled(bool enable) = 0;
1949 
1950     /**
1951      * @brief Get whether default error page feature is enabled.
1952      */
1953     /*--ark web()--*/
1954     virtual bool GetErrorPageEnabled() = 0;
1955 
1956     /**
1957      * @brief Get web component destroy mode.
1958      * @return the web destroy mode.
1959      */
1960     /*--ark web()--*/
1961     virtual int32_t GetWebDestroyMode() = 0;
1962 
1963     /**
1964      * @brief CallH5FunctionV2
1965      *
1966      * @param routing_id       int32_t: the h5 frame routing id
1967      * @param h5_object_id     int32_t: the h5 side object id
1968      * @param h5_method_name   string:  the h5 side object method name
1969      * @param args             vector<shared_ptr<NWebValue>>: the call args
1970      */
1971     /*--ark web()--*/
1972     virtual void CallH5FunctionV2(int32_t routing_id, int32_t h5_object_id, const ArkWebString& h5_method_name,
1973         const ArkWebRomValueVector& args) = 0;
1974 
1975     /**
1976      * @brief use the port to send message.
1977      *
1978      * @param portHandle the port to send message.
1979      * @param data the message to send.
1980      */
1981     /*--ark web()--*/
1982     virtual void PostPortMessageV2(const ArkWebString& portHandle, ArkWebRefPtr<ArkWebRomValue> data) = 0;
1983 
1984     /**
1985      * @brief fill autofill data.
1986      * @param data data.
1987      */
1988     /*--ark web()--*/
1989     virtual void FillAutofillDataV2(ArkWebRefPtr<ArkWebRomValue> data) = 0;
1990 
1991     /**
1992      * @brief Create web print document adapter.
1993      */
1994     /*--ark web()--*/
1995     virtual ArkWebRefPtr<ArkWebPrintDocumentAdapterAdapter> CreateWebPrintDocumentAdapterV2(
1996         const ArkWebString& job_name) = 0;
1997 };
1998 
1999 } // namespace OHOS::ArkWeb
2000 
2001 #endif // ARK_WEB_NWEB_H_
2002