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