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