1 /* 2 * Copyright (c) 2022 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 FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_WEB_WEB_EVENT_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_WEB_WEB_EVENT_H 18 19 #include <map> 20 21 #include "base/memory/ace_type.h" 22 #include "core/event/ace_events.h" 23 24 namespace OHOS::Ace { 25 26 enum DialogEventType { 27 DIALOG_EVENT_ALERT = 0, 28 DIALOG_EVENT_BEFORE_UNLOAD = 1, 29 DIALOG_EVENT_CONFIRM = 2, 30 DIALOG_EVENT_PROMPT = 3 31 }; 32 33 enum class NativeEmbedStatus { 34 CREATE = 0, 35 UPDATE = 1, 36 DESTROY = 2, 37 ENTER_BFCACHE = 3, 38 LEAVE_BFCACHE = 4 39 }; 40 41 enum class NavigationType { 42 NAVIGATION_TYPE_UNKNOWN = 0, 43 NAVIGATION_TYPE_MAIN_FRAME_NEW_ENTRY = 1, 44 NAVIGATION_TYPE_MAIN_FRAME_EXISTING_ENTRY = 2, 45 NAVIGATION_TYPE_NEW_SUBFRAME = 4, 46 NAVIGATION_TYPE_AUTO_SUBFRAME = 5, 47 }; 48 49 enum class RenderProcessNotRespondingReason { 50 INPUT_TIMEOUT, 51 NAVIGATION_COMMIT_TIMEOUT, 52 }; 53 54 enum class ViewportFit { 55 AUTO, 56 CONTAINS, 57 COVER, 58 }; 59 60 class WebConsoleLog : public AceType { 61 DECLARE_ACE_TYPE(WebConsoleLog, AceType) 62 public: 63 WebConsoleLog() = default; 64 ~WebConsoleLog() = default; 65 66 virtual int GetLineNumber() = 0; 67 virtual std::string GetLog() = 0; 68 virtual int GetLogLevel() = 0; 69 virtual std::string GetSourceId() = 0; 70 }; 71 72 class WebConsoleMessageParam : public WebConsoleLog { DECLARE_ACE_TYPE(WebConsoleMessageParam,AceType)73 DECLARE_ACE_TYPE(WebConsoleMessageParam, AceType) 74 public: 75 WebConsoleMessageParam(std::string message, std::string sourceId, int lineNumber, int messageLevel) : 76 message_(message), sourceId_(sourceId), lineNumber_(lineNumber), messageLevel_(messageLevel) {} 77 ~WebConsoleMessageParam() = default; 78 GetLog()79 std::string GetLog() override 80 { 81 return message_; 82 } 83 GetLineNumber()84 int GetLineNumber() override 85 { 86 return lineNumber_; 87 } 88 GetSourceId()89 std::string GetSourceId() override 90 { 91 return sourceId_; 92 } 93 GetLogLevel()94 int GetLogLevel() override 95 { 96 return messageLevel_; 97 } 98 99 private: 100 std::string message_; 101 std::string sourceId_; 102 int lineNumber_; 103 int messageLevel_; 104 }; 105 106 class WebFileSelectorParam : public AceType { 107 DECLARE_ACE_TYPE(WebFileSelectorParam, AceType) 108 public: 109 WebFileSelectorParam() = default; 110 ~WebFileSelectorParam() = default; 111 112 virtual std::string GetTitle() = 0; 113 virtual int GetMode() = 0; 114 virtual std::string GetDefaultFileName() = 0; 115 virtual std::vector<std::string> GetAcceptType() = 0; 116 virtual bool IsCapture() = 0; 117 }; 118 119 class ACE_EXPORT WebError : public AceType { DECLARE_ACE_TYPE(WebError,AceType)120 DECLARE_ACE_TYPE(WebError, AceType) 121 122 public: 123 WebError(const std::string& info, int32_t code) : info_(info), code_(code) {} 124 ~WebError() = default; 125 GetInfo()126 const std::string& GetInfo() const 127 { 128 return info_; 129 } 130 GetCode()131 int32_t GetCode() const 132 { 133 return code_; 134 } 135 136 private: 137 std::string info_; 138 int32_t code_; 139 }; 140 141 enum class WebResponseDataType : int32_t { 142 STRING_TYPE, 143 FILE_TYPE, 144 RESOURCE_URL_TYPE, 145 BUFFER_TYPE, 146 }; 147 148 class WebResponseAsyncHandle : public AceType { 149 DECLARE_ACE_TYPE(WebResponseAsyncHandle, AceType) 150 public: 151 WebResponseAsyncHandle() = default; 152 virtual ~WebResponseAsyncHandle() = default; 153 154 virtual void HandleData(std::string& data) = 0; 155 virtual void HandleFileFd(int32_t fd) = 0; 156 virtual void HandleResourceUrl(std::string& url) = 0; 157 virtual void HandleHeadersVal(const std::map<std::string, std::string>& response_headers) = 0; 158 virtual void HandleEncoding(std::string& encoding) = 0; 159 virtual void HandleMimeType(std::string& mimeType) = 0; 160 virtual void HandleStatusCodeAndReason(int32_t statusCode, std::string& reason) = 0; 161 virtual void HandleResponseStatus(bool isReady) = 0; 162 }; 163 164 struct WebKeyboardOption { 165 bool isSystemKeyboard_ = true; 166 int32_t enterKeyTpye_ = -1; 167 std::function<void()> customKeyboardBuilder_ = nullptr; 168 }; 169 170 class ACE_EXPORT WebResponse : public AceType { DECLARE_ACE_TYPE(WebResponse,AceType)171 DECLARE_ACE_TYPE(WebResponse, AceType) 172 173 public: 174 WebResponse(const std::map<std::string, std::string>& headers, const std::string& data, const std::string& encoding, 175 const std::string& mimeType, const std::string& reason, int32_t statusCode) 176 : headers_(headers), data_(data), encoding_(encoding), mimeType_(mimeType), reason_(reason), 177 statusCode_(statusCode) 178 {} 179 WebResponse() = default; 180 ~WebResponse() = default; 181 GetHeaders()182 const std::map<std::string, std::string>& GetHeaders() const 183 { 184 return headers_; 185 } 186 GetData()187 const std::string& GetData() const 188 { 189 return data_; 190 } 191 GetEncoding()192 const std::string& GetEncoding() const 193 { 194 return encoding_; 195 } 196 GetMimeType()197 const std::string& GetMimeType() const 198 { 199 return mimeType_; 200 } 201 GetReason()202 const std::string& GetReason() const 203 { 204 return reason_; 205 } 206 GetStatusCode()207 int32_t GetStatusCode() const 208 { 209 return statusCode_; 210 } 211 GetResponseStatus()212 bool GetResponseStatus() const 213 { 214 return isReady_; 215 } 216 GetFileHandle()217 int32_t GetFileHandle() const 218 { 219 return fd_; 220 } 221 GetResourceUrl()222 const std::string& GetResourceUrl() const 223 { 224 return resourceUrl_; 225 } 226 GetDataType()227 WebResponseDataType GetDataType() const 228 { 229 return dataType_; 230 } 231 SetHeadersVal(std::string & key,std::string & val)232 void SetHeadersVal(std::string& key, std::string& val) 233 { 234 headers_[key] = val; 235 } 236 SetData(std::string & data)237 void SetData(std::string& data) 238 { 239 data_ = data; 240 dataType_ = WebResponseDataType::STRING_TYPE; 241 fd_ = 0; 242 } 243 SetBuffer(char * buffer,size_t size)244 void SetBuffer(char* buffer, size_t size) 245 { 246 buffer_ = buffer; 247 dataType_ = WebResponseDataType::BUFFER_TYPE; 248 bufferSize_ = size; 249 } 250 GetBuffer()251 char* GetBuffer() const 252 { 253 return buffer_; 254 } 255 GetBufferSize()256 size_t GetBufferSize() const 257 { 258 return bufferSize_; 259 } 260 SetFileHandle(int32_t fd)261 void SetFileHandle(int32_t fd) 262 { 263 fd_ = fd; 264 data_.clear(); 265 dataType_ = WebResponseDataType::FILE_TYPE; 266 } 267 SetResourceUrl(const std::string & url)268 void SetResourceUrl(const std::string& url) 269 { 270 resourceUrl_ = url; 271 dataType_ = WebResponseDataType::RESOURCE_URL_TYPE; 272 } 273 SetEncoding(std::string & encoding)274 void SetEncoding(std::string& encoding) 275 { 276 encoding_ = encoding; 277 } 278 SetMimeType(std::string & mimeType)279 void SetMimeType(std::string& mimeType) 280 { 281 mimeType_ = mimeType; 282 } 283 SetReason(std::string & reason)284 void SetReason(std::string& reason) 285 { 286 reason_ = reason; 287 } 288 SetStatusCode(int32_t statusCode)289 void SetStatusCode(int32_t statusCode) 290 { 291 statusCode_ = statusCode; 292 } 293 SetResponseStatus(bool isReady)294 void SetResponseStatus(bool isReady) 295 { 296 isReady_ = isReady; 297 if (handle_ == nullptr) { 298 return; 299 } 300 if (isReady_ == true) { 301 if (dataType_ == WebResponseDataType::FILE_TYPE) { 302 handle_->HandleFileFd(fd_); 303 } else if (dataType_ == WebResponseDataType::RESOURCE_URL_TYPE) { 304 handle_->HandleResourceUrl(resourceUrl_); 305 } else { 306 handle_->HandleData(data_); 307 } 308 handle_->HandleHeadersVal(headers_); 309 handle_->HandleEncoding(encoding_); 310 handle_->HandleMimeType(mimeType_); 311 handle_->HandleStatusCodeAndReason(statusCode_, reason_); 312 } 313 handle_->HandleResponseStatus(isReady_); 314 } 315 SetAsyncHandle(std::shared_ptr<WebResponseAsyncHandle> handle)316 void SetAsyncHandle(std::shared_ptr<WebResponseAsyncHandle> handle) 317 { 318 handle_ = handle; 319 } 320 IsFileHandle()321 bool IsFileHandle() 322 { 323 if (dataType_ == WebResponseDataType::FILE_TYPE) { 324 return true; 325 } 326 return false; 327 } 328 329 private: 330 std::map<std::string, std::string> headers_; 331 std::string data_; 332 int32_t fd_ = 0; 333 std::string resourceUrl_; 334 WebResponseDataType dataType_ = WebResponseDataType::STRING_TYPE; 335 std::string encoding_; 336 std::string mimeType_; 337 std::string reason_; 338 int32_t statusCode_ = 0; 339 bool isReady_ = true; 340 std::shared_ptr<WebResponseAsyncHandle> handle_; 341 char* buffer_ = nullptr; 342 uint64_t bufferSize_ = 0; 343 }; 344 345 class ACE_EXPORT WebRequest : public AceType { DECLARE_ACE_TYPE(WebRequest,AceType)346 DECLARE_ACE_TYPE(WebRequest, AceType) 347 348 public: 349 WebRequest(const std::map<std::string, std::string>& headers, const std::string& method, const std::string& url, 350 bool hasGesture, bool isMainFrame, bool isRedirect) 351 : headers_(headers), method_(method), url_(url), hasGesture_(hasGesture), isMainFrame_(isMainFrame), 352 isRedirect_(isRedirect) 353 {} 354 ~WebRequest() = default; 355 GetHeaders()356 const std::map<std::string, std::string>& GetHeaders() const 357 { 358 return headers_; 359 } 360 GetMethod()361 const std::string& GetMethod() const 362 { 363 return method_; 364 } 365 GetUrl()366 const std::string& GetUrl() const 367 { 368 return url_; 369 } 370 HasGesture()371 bool HasGesture() const 372 { 373 return hasGesture_; 374 } 375 IsMainFrame()376 bool IsMainFrame() const 377 { 378 return isMainFrame_; 379 } 380 IsRedirect()381 bool IsRedirect() const 382 { 383 return isRedirect_; 384 } 385 386 private: 387 std::map<std::string, std::string> headers_; 388 std::string method_; 389 std::string url_; 390 bool hasGesture_; 391 bool isMainFrame_; 392 bool isRedirect_; 393 }; 394 395 class ACE_EXPORT Result : public AceType { 396 DECLARE_ACE_TYPE(Result, AceType) 397 398 public: 399 Result() = default; 400 ~Result() = default; 401 402 virtual void Confirm() = 0; 403 virtual void Confirm(const std::string& message) = 0; 404 virtual void Cancel() = 0; 405 }; 406 407 class ACE_EXPORT FileSelectorResult : public AceType { 408 DECLARE_ACE_TYPE(FileSelectorResult, AceType) 409 410 public: 411 FileSelectorResult() = default; 412 ~FileSelectorResult() = default; 413 414 virtual void HandleFileList(std::vector<std::string>& fileList) = 0; 415 }; 416 417 class ACE_EXPORT WebDialogEvent : public BaseEventInfo { 418 DECLARE_RELATIONSHIP_OF_CLASSES(WebDialogEvent, BaseEventInfo); 419 420 public: WebDialogEvent(const std::string & url,const std::string & message,const std::string & value,const DialogEventType & type,const RefPtr<Result> & result)421 WebDialogEvent(const std::string& url, const std::string& message, const std::string& value, 422 const DialogEventType& type, const RefPtr<Result>& result) 423 : BaseEventInfo("WebDialogEvent"), url_(url), message_(message), value_(value), type_(type), result_(result) 424 {} 425 ~WebDialogEvent() = default; 426 GetUrl()427 const std::string& GetUrl() const 428 { 429 return url_; 430 } 431 GetMessage()432 const std::string& GetMessage() const 433 { 434 return message_; 435 } 436 GetValue()437 const std::string& GetValue() const 438 { 439 return value_; 440 } 441 GetResult()442 const RefPtr<Result>& GetResult() const 443 { 444 return result_; 445 } 446 GetType()447 const DialogEventType& GetType() const 448 { 449 return type_; 450 } 451 452 private: 453 std::string url_; 454 std::string message_; 455 std::string value_; 456 DialogEventType type_; 457 RefPtr<Result> result_; 458 }; 459 460 class ACE_EXPORT AuthResult : public AceType { 461 DECLARE_ACE_TYPE(AuthResult, AceType) 462 463 public: 464 AuthResult() = default; 465 ~AuthResult() = default; 466 467 virtual bool Confirm(std::string& userName, std::string& pwd) = 0; 468 virtual bool IsHttpAuthInfoSaved() = 0; 469 virtual void Cancel() = 0; 470 }; 471 472 class ACE_EXPORT WebHttpAuthEvent : public BaseEventInfo { 473 DECLARE_RELATIONSHIP_OF_CLASSES(WebHttpAuthEvent, BaseEventInfo); 474 475 public: WebHttpAuthEvent(const RefPtr<AuthResult> & result,const std::string & host,const std::string & realm)476 WebHttpAuthEvent(const RefPtr<AuthResult>& result, const std::string& host, const std::string& realm) 477 : BaseEventInfo("WebHttpAuthEvent"), result_(result), host_(host), realm_(realm) 478 {} 479 ~WebHttpAuthEvent() = default; 480 GetResult()481 const RefPtr<AuthResult>& GetResult() const 482 { 483 return result_; 484 } 485 GetHost()486 const std::string& GetHost() const 487 { 488 return host_; 489 } 490 GetRealm()491 const std::string& GetRealm() const 492 { 493 return realm_; 494 } 495 496 private: 497 RefPtr<AuthResult> result_; 498 std::string host_; 499 std::string realm_; 500 }; 501 502 class ACE_EXPORT SslErrorResult : public AceType { 503 DECLARE_ACE_TYPE(SslErrorResult, AceType) 504 505 public: 506 SslErrorResult() = default; 507 ~SslErrorResult() = default; 508 virtual void HandleConfirm() = 0; 509 virtual void HandleCancel() = 0; 510 }; 511 512 class ACE_EXPORT WebSslErrorEvent : public BaseEventInfo { 513 DECLARE_RELATIONSHIP_OF_CLASSES(WebSslErrorEvent, BaseEventInfo); 514 515 public: WebSslErrorEvent(const RefPtr<SslErrorResult> & result,int32_t error)516 WebSslErrorEvent(const RefPtr<SslErrorResult>& result, int32_t error) 517 : BaseEventInfo("WebSslErrorEvent"), result_(result), error_(error) {} 518 ~WebSslErrorEvent() = default; 519 GetResult()520 const RefPtr<SslErrorResult>& GetResult() const 521 { 522 return result_; 523 } 524 GetError()525 int32_t GetError() const 526 { 527 return error_; 528 } 529 530 private: 531 RefPtr<SslErrorResult> result_; 532 int32_t error_; 533 }; 534 535 class ACE_EXPORT AllSslErrorResult : public AceType { 536 DECLARE_ACE_TYPE(AllSslErrorResult, AceType) 537 538 public: 539 AllSslErrorResult() = default; 540 ~AllSslErrorResult() = default; 541 virtual void HandleConfirm() = 0; 542 virtual void HandleCancel() = 0; 543 }; 544 545 class ACE_EXPORT WebAllSslErrorEvent : public BaseEventInfo { 546 DECLARE_RELATIONSHIP_OF_CLASSES(WebAllSslErrorEvent, BaseEventInfo); 547 548 public: WebAllSslErrorEvent(const RefPtr<AllSslErrorResult> & result,int32_t error,const std::string & url,const std::string & originalUrl,const std::string & referrer,bool isFatalError,bool isMainFrame)549 WebAllSslErrorEvent(const RefPtr<AllSslErrorResult>& result, 550 int32_t error, 551 const std::string& url, 552 const std::string& originalUrl, 553 const std::string& referrer, 554 bool isFatalError, 555 bool isMainFrame 556 ) 557 : BaseEventInfo("WebAllSslErrorEvent"), result_(result), 558 error_(error), 559 url_(url), 560 originalUrl_(originalUrl), 561 referrer_(referrer), 562 isFatalError_(isFatalError), 563 isMainFrame_(isMainFrame) {} 564 ~WebAllSslErrorEvent() = default; 565 GetResult()566 const RefPtr<AllSslErrorResult>& GetResult() const 567 { 568 return result_; 569 } 570 GetError()571 int32_t GetError() const 572 { 573 return error_; 574 } 575 GetUrl()576 std::string GetUrl() const 577 { 578 return url_; 579 } 580 GetOriginalUrl()581 std::string GetOriginalUrl() const 582 { 583 return originalUrl_; 584 } 585 GetReferrer()586 std::string GetReferrer() const 587 { 588 return referrer_; 589 } 590 GetIsFatalError()591 bool GetIsFatalError() const 592 { 593 return isFatalError_; 594 } 595 GetIsMainFrame()596 bool GetIsMainFrame() const 597 { 598 return isMainFrame_; 599 } 600 601 private: 602 RefPtr<AllSslErrorResult> result_; 603 int32_t error_; 604 const std::string& url_; 605 const std::string& originalUrl_; 606 const std::string& referrer_; 607 bool isFatalError_; 608 bool isMainFrame_; 609 }; 610 611 class ACE_EXPORT SslSelectCertResult : public AceType { 612 DECLARE_ACE_TYPE(SslSelectCertResult, AceType) 613 public: 614 SslSelectCertResult() = default; 615 ~SslSelectCertResult() = default; 616 617 virtual void HandleConfirm(const std::string& privateKeyFile, const std::string& certChainFile) = 0; 618 virtual void HandleCancel() = 0; 619 virtual void HandleIgnore() = 0; 620 }; 621 622 class ACE_EXPORT WebSslSelectCertEvent : public BaseEventInfo { 623 DECLARE_RELATIONSHIP_OF_CLASSES(WebSslSelectCertEvent, BaseEventInfo); 624 625 public: WebSslSelectCertEvent(const RefPtr<SslSelectCertResult> & result,const std::string & host,int port,const std::vector<std::string> & keyTypes,const std::vector<std::string> & issuers)626 WebSslSelectCertEvent(const RefPtr<SslSelectCertResult>& result, 627 const std::string& host, int port, 628 const std::vector<std::string>& keyTypes, 629 const std::vector<std::string>& issuers) 630 : BaseEventInfo("WebSslSelectCertEvent"), 631 result_(result), host_(host), port_(port), keyTypes_(keyTypes), issuers_(issuers) {} 632 633 ~WebSslSelectCertEvent() = default; 634 GetResult()635 const RefPtr<SslSelectCertResult>& GetResult() const 636 { 637 return result_; 638 } 639 GetHost()640 const std::string& GetHost() const 641 { 642 return host_; 643 } 644 GetPort()645 int32_t GetPort() const 646 { 647 return port_; 648 } 649 GetKeyTypes()650 const std::vector<std::string>& GetKeyTypes() const 651 { 652 return keyTypes_; 653 } 654 GetIssuers_()655 const std::vector<std::string>& GetIssuers_() const 656 { 657 return issuers_; 658 } 659 660 private: 661 RefPtr<SslSelectCertResult> result_; 662 std::string host_; 663 int32_t port_ = -1; 664 std::vector<std::string> keyTypes_; 665 std::vector<std::string> issuers_; 666 }; 667 668 class ACE_EXPORT WebGeolocation : public AceType { 669 DECLARE_ACE_TYPE(WebGeolocation, AceType) 670 671 public: 672 WebGeolocation() = default; 673 ~WebGeolocation() = default; 674 675 virtual void Invoke(const std::string& origin, const bool& allow, const bool& retain) = 0; 676 }; 677 678 class ACE_EXPORT WebPermissionRequest : public AceType { 679 DECLARE_ACE_TYPE(WebPermissionRequest, AceType) 680 681 public: 682 WebPermissionRequest() = default; 683 ~WebPermissionRequest() = default; 684 685 virtual void Deny() const = 0; 686 687 virtual std::string GetOrigin() const = 0; 688 689 virtual std::vector<std::string> GetResources() const = 0; 690 691 virtual void Grant(std::vector<std::string>& resources) const = 0; 692 }; 693 694 class ACE_EXPORT WebScreenCaptureRequest : public AceType { 695 DECLARE_ACE_TYPE(WebScreenCaptureRequest, AceType) 696 697 public: 698 WebScreenCaptureRequest() = default; 699 ~WebScreenCaptureRequest() = default; 700 701 virtual void Deny() const = 0; 702 703 virtual std::string GetOrigin() const = 0; 704 705 virtual void SetCaptureMode(int32_t mode) = 0; 706 707 virtual void SetSourceId(int32_t sourceId) = 0; 708 709 virtual void Grant() const = 0; 710 }; 711 712 class ACE_EXPORT WebWindowNewHandler : public AceType { 713 DECLARE_ACE_TYPE(WebWindowNewHandler, AceType) 714 715 public: 716 WebWindowNewHandler() = default; 717 ~WebWindowNewHandler() = default; 718 719 virtual void SetWebController(int32_t id) = 0; 720 721 virtual bool IsFrist() const = 0; 722 723 virtual int32_t GetId() const = 0; 724 725 virtual int32_t GetParentNWebId() const = 0; 726 }; 727 728 class ACE_EXPORT WebAppLinkCallback : public AceType { 729 DECLARE_ACE_TYPE(WebAppLinkCallback, AceType) 730 731 public: 732 WebAppLinkCallback() = default; 733 ~WebAppLinkCallback() = default; 734 735 virtual void ContinueLoad() = 0; 736 virtual void CancelLoad() = 0; 737 }; 738 739 class ACE_EXPORT WebCustomKeyboardHandler : public AceType { 740 DECLARE_ACE_TYPE(WebCustomKeyboardHandler, AceType) 741 742 public: 743 WebCustomKeyboardHandler() = default; 744 ~WebCustomKeyboardHandler() = default; 745 746 virtual void InsertText(const std::string &text) = 0; 747 virtual void DeleteForward(int32_t length) = 0; 748 virtual void DeleteBackward(int32_t length) = 0; 749 virtual void SendFunctionKey(int32_t key) = 0; 750 virtual void Close() = 0; 751 }; 752 753 class ACE_EXPORT LoadWebPageStartEvent : public BaseEventInfo { 754 DECLARE_RELATIONSHIP_OF_CLASSES(LoadWebPageStartEvent, BaseEventInfo); 755 756 public: LoadWebPageStartEvent(const std::string & url)757 explicit LoadWebPageStartEvent(const std::string& url) : BaseEventInfo("LoadWebPageStartEvent"), loadedUrl_(url) {} 758 ~LoadWebPageStartEvent() = default; 759 GetLoadedUrl()760 const std::string& GetLoadedUrl() const 761 { 762 return loadedUrl_; 763 } 764 765 private: 766 std::string loadedUrl_; 767 }; 768 769 class ACE_EXPORT LoadWebPageFinishEvent : public BaseEventInfo { 770 DECLARE_RELATIONSHIP_OF_CLASSES(LoadWebPageFinishEvent, BaseEventInfo); 771 772 public: LoadWebPageFinishEvent(const std::string & url)773 explicit LoadWebPageFinishEvent(const std::string& url) : BaseEventInfo("LoadWebPageFinishEvent"), loadedUrl_(url) 774 {} 775 ~LoadWebPageFinishEvent() = default; 776 GetLoadedUrl()777 const std::string& GetLoadedUrl() const 778 { 779 return loadedUrl_; 780 } 781 782 private: 783 std::string loadedUrl_; 784 }; 785 786 class ACE_EXPORT ContextMenuHideEvent : public BaseEventInfo { 787 DECLARE_RELATIONSHIP_OF_CLASSES(ContextMenuHideEvent, BaseEventInfo); 788 789 public: ContextMenuHideEvent(const std::string & info)790 explicit ContextMenuHideEvent(const std::string& info) : BaseEventInfo("ContextMenuHideEvent"), info_(info) 791 {} 792 ~ContextMenuHideEvent() = default; 793 GetInfo()794 const std::string& GetInfo() const 795 { 796 return info_; 797 } 798 799 private: 800 std::string info_; 801 }; 802 803 class ACE_EXPORT LoadWebProgressChangeEvent : public BaseEventInfo { 804 DECLARE_RELATIONSHIP_OF_CLASSES(LoadWebProgressChangeEvent, BaseEventInfo); 805 806 public: LoadWebProgressChangeEvent(const int & newProgress)807 explicit LoadWebProgressChangeEvent(const int& newProgress) 808 : BaseEventInfo("LoadWebProgressChangeEvent"), newProgress_(newProgress) 809 {} 810 ~LoadWebProgressChangeEvent() = default; 811 GetNewProgress()812 const int& GetNewProgress() const 813 { 814 return newProgress_; 815 } 816 817 private: 818 int newProgress_; 819 }; 820 821 class ACE_EXPORT LoadWebTitleReceiveEvent : public BaseEventInfo { 822 DECLARE_RELATIONSHIP_OF_CLASSES(LoadWebTitleReceiveEvent, BaseEventInfo); 823 824 public: LoadWebTitleReceiveEvent(const std::string & title)825 explicit LoadWebTitleReceiveEvent(const std::string& title) 826 : BaseEventInfo("LoadWebTitleReceiveEvent"), title_(title) 827 {} 828 ~LoadWebTitleReceiveEvent() = default; 829 GetTitle()830 const std::string& GetTitle() const 831 { 832 return title_; 833 } 834 835 private: 836 std::string title_; 837 }; 838 839 class ACE_EXPORT FullScreenExitHandler : public AceType { 840 DECLARE_ACE_TYPE(FullScreenExitHandler, AceType) 841 842 public: 843 FullScreenExitHandler() = default; 844 ~FullScreenExitHandler() = default; 845 846 virtual void ExitFullScreen() = 0; 847 }; 848 849 class ACE_EXPORT FullScreenEnterEvent : public BaseEventInfo { 850 DECLARE_RELATIONSHIP_OF_CLASSES(FullScreenEnterEvent, BaseEventInfo); 851 852 public: FullScreenEnterEvent(const RefPtr<FullScreenExitHandler> & handler,int videoNaturalWidth,int videoNaturalHeight)853 FullScreenEnterEvent( 854 const RefPtr<FullScreenExitHandler>& handler, int videoNaturalWidth, int videoNaturalHeight) 855 : BaseEventInfo("FullScreenEnterEvent"), handler_(handler), videoNaturalWidth_(videoNaturalWidth), 856 videoNaturalHeight_(videoNaturalHeight) 857 {} 858 ~FullScreenEnterEvent() = default; 859 GetHandler()860 const RefPtr<FullScreenExitHandler>& GetHandler() const 861 { 862 return handler_; 863 } 864 GetVideoNaturalWidth()865 int GetVideoNaturalWidth() const 866 { 867 return videoNaturalWidth_; 868 } 869 GetVideoNaturalHeight()870 int GetVideoNaturalHeight() const 871 { 872 return videoNaturalHeight_; 873 } 874 875 private: 876 RefPtr<FullScreenExitHandler> handler_; 877 int videoNaturalWidth_; 878 int videoNaturalHeight_; 879 }; 880 881 class ACE_EXPORT FullScreenExitEvent : public BaseEventInfo { 882 DECLARE_RELATIONSHIP_OF_CLASSES(FullScreenExitEvent, BaseEventInfo); 883 884 public: 885 explicit FullScreenExitEvent(bool fullscreen = false) 886 : BaseEventInfo("FullScreenExitEvent"), fullscreen_(fullscreen) {} 887 ~FullScreenExitEvent() = default; 888 IsFullScreen()889 bool IsFullScreen() const 890 { 891 return fullscreen_; 892 } 893 894 private: 895 bool fullscreen_ = false; 896 }; 897 898 class ACE_EXPORT UrlLoadInterceptEvent : public BaseEventInfo { 899 DECLARE_RELATIONSHIP_OF_CLASSES(UrlLoadInterceptEvent, BaseEventInfo); 900 901 public: UrlLoadInterceptEvent(const std::string & data)902 explicit UrlLoadInterceptEvent(const std::string& data) : BaseEventInfo("UrlLoadInterceptEvent"), data_(data) {} 903 ~UrlLoadInterceptEvent() = default; 904 GetData()905 const std::string& GetData() const 906 { 907 return data_; 908 } 909 910 private: 911 std::string data_; 912 }; 913 914 class ACE_EXPORT LoadInterceptEvent : public BaseEventInfo { 915 DECLARE_RELATIONSHIP_OF_CLASSES(LoadInterceptEvent, BaseEventInfo); 916 917 public: LoadInterceptEvent(const RefPtr<WebRequest> & request)918 explicit LoadInterceptEvent(const RefPtr<WebRequest>& request) : 919 BaseEventInfo("LoadInterceptEvent"), request_(request) {} 920 ~LoadInterceptEvent() = default; 921 GetRequest()922 const RefPtr<WebRequest>& GetRequest() const 923 { 924 return request_; 925 } 926 927 private: 928 RefPtr<WebRequest> request_; 929 }; 930 931 class ACE_EXPORT LoadOverrideEvent : public BaseEventInfo { 932 DECLARE_RELATIONSHIP_OF_CLASSES(LoadOverrideEvent, BaseEventInfo); 933 934 public: LoadOverrideEvent(const RefPtr<WebRequest> & request)935 explicit LoadOverrideEvent(const RefPtr<WebRequest>& request) : 936 BaseEventInfo("LoadOverrideEvent"), request_(request) {} 937 ~LoadOverrideEvent() = default; 938 GetRequest()939 const RefPtr<WebRequest>& GetRequest() const 940 { 941 return request_; 942 } 943 944 private: 945 RefPtr<WebRequest> request_; 946 }; 947 948 class ACE_EXPORT InterceptKeyboardEvent : public BaseEventInfo { 949 DECLARE_RELATIONSHIP_OF_CLASSES(InterceptKeyboardEvent, BaseEventInfo); 950 951 public: InterceptKeyboardEvent(const RefPtr<WebCustomKeyboardHandler> & customKeyboardHandler,const std::map<std::string,std::string> attributes)952 explicit InterceptKeyboardEvent(const RefPtr<WebCustomKeyboardHandler>& customKeyboardHandler, 953 const std::map<std::string, std::string> attributes) : 954 BaseEventInfo("InterceptKeyboardEvent"), 955 customKeyboardHandler_(customKeyboardHandler), 956 attributes_(attributes) {} 957 ~InterceptKeyboardEvent() = default; 958 GetCustomKeyboardHandler()959 const RefPtr<WebCustomKeyboardHandler>& GetCustomKeyboardHandler() const 960 { 961 return customKeyboardHandler_; 962 } 963 GetAttributesMap()964 const std::map<std::string, std::string>& GetAttributesMap() const 965 { 966 return attributes_; 967 } 968 969 private: 970 RefPtr<WebCustomKeyboardHandler> customKeyboardHandler_; 971 std::map<std::string, std::string> attributes_; 972 }; 973 974 class ACE_EXPORT WebAppLinkEvent : public BaseEventInfo { 975 DECLARE_RELATIONSHIP_OF_CLASSES(WebAppLinkEvent, BaseEventInfo); 976 977 public: WebAppLinkEvent(const std::string & url,const RefPtr<WebAppLinkCallback> & callback)978 explicit WebAppLinkEvent( 979 const std::string& url, 980 const RefPtr<WebAppLinkCallback>& callback) : 981 BaseEventInfo("WebAppLinkEvent"), url_(url), callback_(callback) {} 982 ~WebAppLinkEvent() = default; 983 GetCallback()984 const RefPtr<WebAppLinkCallback>& GetCallback() const 985 { 986 return callback_; 987 } 988 GetUrl()989 const std::string& GetUrl() const 990 { 991 return url_; 992 } 993 994 private: 995 std::string url_; 996 RefPtr<WebAppLinkCallback> callback_; 997 }; 998 999 class ACE_EXPORT LoadWebGeolocationHideEvent : public BaseEventInfo { 1000 DECLARE_RELATIONSHIP_OF_CLASSES(LoadWebGeolocationHideEvent, BaseEventInfo); 1001 1002 public: LoadWebGeolocationHideEvent(const std::string & origin)1003 explicit LoadWebGeolocationHideEvent(const std::string& origin) 1004 : BaseEventInfo("LoadWebGeolocationHideEvent"), origin_(origin) 1005 {} 1006 ~LoadWebGeolocationHideEvent() = default; 1007 GetOrigin()1008 const std::string& GetOrigin() const 1009 { 1010 return origin_; 1011 } 1012 1013 private: 1014 std::string origin_; 1015 }; 1016 1017 class ACE_EXPORT LoadWebGeolocationShowEvent : public BaseEventInfo { 1018 DECLARE_RELATIONSHIP_OF_CLASSES(LoadWebGeolocationShowEvent, BaseEventInfo); 1019 1020 public: LoadWebGeolocationShowEvent(const std::string & origin,const RefPtr<WebGeolocation> & webGeolocation)1021 LoadWebGeolocationShowEvent(const std::string& origin, const RefPtr<WebGeolocation>& webGeolocation) 1022 : BaseEventInfo("LoadWebGeolocationShowEvent"), origin_(origin), webGeolocation_(webGeolocation) 1023 {} 1024 ~LoadWebGeolocationShowEvent() = default; 1025 GetOrigin()1026 const std::string& GetOrigin() const 1027 { 1028 return origin_; 1029 } 1030 GetWebGeolocation()1031 const RefPtr<WebGeolocation>& GetWebGeolocation() const 1032 { 1033 return webGeolocation_; 1034 } 1035 1036 private: 1037 std::string origin_; 1038 RefPtr<WebGeolocation> webGeolocation_; 1039 }; 1040 1041 class ACE_EXPORT WebPermissionRequestEvent : public BaseEventInfo { 1042 DECLARE_RELATIONSHIP_OF_CLASSES(WebPermissionRequestEvent, BaseEventInfo); 1043 1044 public: WebPermissionRequestEvent(const RefPtr<WebPermissionRequest> & webPermissionRequest)1045 WebPermissionRequestEvent(const RefPtr<WebPermissionRequest>& webPermissionRequest) 1046 : BaseEventInfo("WebPermissionRequestEvent"), webPermissionRequest_(webPermissionRequest) 1047 {} 1048 ~WebPermissionRequestEvent() = default; 1049 GetWebPermissionRequest()1050 const RefPtr<WebPermissionRequest>& GetWebPermissionRequest() const 1051 { 1052 return webPermissionRequest_; 1053 } 1054 1055 private: 1056 RefPtr<WebPermissionRequest> webPermissionRequest_; 1057 }; 1058 1059 class ACE_EXPORT WebScreenCaptureRequestEvent : public BaseEventInfo { 1060 DECLARE_RELATIONSHIP_OF_CLASSES(WebScreenCaptureRequestEvent, BaseEventInfo); 1061 1062 public: WebScreenCaptureRequestEvent(const RefPtr<WebScreenCaptureRequest> & request)1063 WebScreenCaptureRequestEvent(const RefPtr<WebScreenCaptureRequest>& request) 1064 : BaseEventInfo("WebScreenCaptureRequestEvent"), request_(request) 1065 {} 1066 ~WebScreenCaptureRequestEvent() = default; 1067 GetWebScreenCaptureRequest()1068 const RefPtr<WebScreenCaptureRequest>& GetWebScreenCaptureRequest() const 1069 { 1070 return request_; 1071 } 1072 1073 private: 1074 RefPtr<WebScreenCaptureRequest> request_; 1075 }; 1076 1077 class ACE_EXPORT DownloadStartEvent : public BaseEventInfo { 1078 DECLARE_RELATIONSHIP_OF_CLASSES(DownloadStartEvent, BaseEventInfo); 1079 1080 public: DownloadStartEvent(const std::string & url,const std::string & userAgent,const std::string & contentDisposition,const std::string & mimetype,long contentLength)1081 DownloadStartEvent(const std::string& url, const std::string& userAgent, const std::string& contentDisposition, 1082 const std::string& mimetype, long contentLength) 1083 : BaseEventInfo("DownloadStartEvent"), url_(url), userAgent_(userAgent), 1084 contentDisposition_(contentDisposition), mimetype_(mimetype), contentLength_(contentLength) 1085 {} 1086 ~DownloadStartEvent() = default; 1087 GetUrl()1088 const std::string& GetUrl() const 1089 { 1090 return url_; 1091 } 1092 GetUserAgent()1093 const std::string& GetUserAgent() const 1094 { 1095 return userAgent_; 1096 } 1097 GetContentDisposition()1098 const std::string& GetContentDisposition() const 1099 { 1100 return contentDisposition_; 1101 } 1102 GetMimetype()1103 const std::string& GetMimetype() const 1104 { 1105 return mimetype_; 1106 } 1107 GetContentLength()1108 long GetContentLength() const 1109 { 1110 return contentLength_; 1111 } 1112 1113 private: 1114 std::string url_; 1115 std::string userAgent_; 1116 std::string contentDisposition_; 1117 std::string mimetype_; 1118 long contentLength_; 1119 }; 1120 1121 class ACE_EXPORT ReceivedErrorEvent : public BaseEventInfo { 1122 DECLARE_RELATIONSHIP_OF_CLASSES(ReceivedErrorEvent, BaseEventInfo); 1123 1124 public: ReceivedErrorEvent(const RefPtr<WebRequest> & request,const RefPtr<WebError> & error)1125 ReceivedErrorEvent(const RefPtr<WebRequest>& request, const RefPtr<WebError>& error) 1126 : BaseEventInfo("ReceivedErrorEvent"), request_(request), error_(error) {} 1127 ~ReceivedErrorEvent() = default; 1128 GetRequest()1129 const RefPtr<WebRequest>& GetRequest() const 1130 { 1131 return request_; 1132 } 1133 GetError()1134 const RefPtr<WebError>& GetError() const 1135 { 1136 return error_; 1137 } 1138 1139 private: 1140 RefPtr<WebRequest> request_; 1141 RefPtr<WebError> error_; 1142 }; 1143 1144 class ACE_EXPORT ReceivedHttpErrorEvent : public BaseEventInfo { 1145 DECLARE_RELATIONSHIP_OF_CLASSES(ReceivedHttpErrorEvent, BaseEventInfo); 1146 1147 public: ReceivedHttpErrorEvent(const RefPtr<WebRequest> & request,const RefPtr<WebResponse> & response)1148 ReceivedHttpErrorEvent(const RefPtr<WebRequest>& request, const RefPtr<WebResponse>& response) 1149 : BaseEventInfo("ReceivedHttpErrorEvent"), request_(request), response_(response) {} 1150 ~ReceivedHttpErrorEvent() = default; 1151 GetRequest()1152 const RefPtr<WebRequest>& GetRequest() const 1153 { 1154 return request_; 1155 } 1156 GetResponse()1157 const RefPtr<WebResponse>& GetResponse() const 1158 { 1159 return response_; 1160 } 1161 1162 private: 1163 RefPtr<WebRequest> request_; 1164 RefPtr<WebResponse> response_; 1165 }; 1166 1167 class ACE_EXPORT OnInterceptRequestEvent : public BaseEventInfo { 1168 DECLARE_RELATIONSHIP_OF_CLASSES(OnInterceptRequestEvent, BaseEventInfo); 1169 1170 public: OnInterceptRequestEvent(const RefPtr<WebRequest> & request)1171 OnInterceptRequestEvent(const RefPtr<WebRequest>& request) 1172 : BaseEventInfo("OnInterceptRequestEvent"), request_(request) {} 1173 ~OnInterceptRequestEvent() = default; 1174 GetRequest()1175 const RefPtr<WebRequest>& GetRequest() const 1176 { 1177 return request_; 1178 } 1179 1180 private: 1181 RefPtr<WebRequest> request_; 1182 }; 1183 1184 class ACE_EXPORT LoadWebRequestFocusEvent : public BaseEventInfo { 1185 DECLARE_RELATIONSHIP_OF_CLASSES(LoadWebRequestFocusEvent, BaseEventInfo); 1186 1187 public: LoadWebRequestFocusEvent(const std::string & url)1188 explicit LoadWebRequestFocusEvent(const std::string& url) 1189 : BaseEventInfo("LoadWebRequestFocusEvent"), focusUrl_(url) 1190 {} 1191 ~LoadWebRequestFocusEvent() = default; 1192 GetRequestFocus()1193 const std::string& GetRequestFocus() const 1194 { 1195 return focusUrl_; 1196 } 1197 1198 private: 1199 std::string focusUrl_; 1200 }; 1201 1202 class ACE_EXPORT LoadWebOnFocusEvent : public BaseEventInfo { 1203 DECLARE_RELATIONSHIP_OF_CLASSES(LoadWebOnFocusEvent, BaseEventInfo); 1204 1205 public: LoadWebOnFocusEvent(const std::string & url)1206 explicit LoadWebOnFocusEvent(const std::string& url) : BaseEventInfo("LoadWebOnFocusEvent"), focusUrl_(url) {} 1207 ~LoadWebOnFocusEvent() = default; 1208 GetOnFocus()1209 const std::string& GetOnFocus() const 1210 { 1211 return focusUrl_; 1212 } 1213 1214 private: 1215 std::string focusUrl_; 1216 }; 1217 1218 class ACE_EXPORT LoadWebConsoleLogEvent : public BaseEventInfo { 1219 DECLARE_RELATIONSHIP_OF_CLASSES(LoadWebConsoleLogEvent, BaseEventInfo); 1220 1221 public: LoadWebConsoleLogEvent(RefPtr<WebConsoleLog> message)1222 LoadWebConsoleLogEvent(RefPtr<WebConsoleLog> message) : BaseEventInfo("LoadWebConsoleLogEvent"), message_(message) 1223 {} 1224 ~LoadWebConsoleLogEvent() = default; 1225 GetMessage()1226 const RefPtr<WebConsoleLog> GetMessage() const 1227 { 1228 return message_; 1229 } 1230 1231 private: 1232 RefPtr<WebConsoleLog> message_; 1233 }; 1234 1235 class ACE_EXPORT RenderExitedEvent : public BaseEventInfo { 1236 DECLARE_RELATIONSHIP_OF_CLASSES(RenderExitedEvent, BaseEventInfo); 1237 1238 public: RenderExitedEvent(int32_t exitedReason)1239 RenderExitedEvent(int32_t exitedReason) : BaseEventInfo("RenderExitedEvent"), exitedReason_(exitedReason) {} 1240 ~RenderExitedEvent() = default; 1241 GetExitedReason()1242 int32_t GetExitedReason() const 1243 { 1244 return exitedReason_; 1245 } 1246 1247 private: 1248 int32_t exitedReason_; 1249 }; 1250 1251 class ACE_EXPORT RefreshAccessedHistoryEvent : public BaseEventInfo { 1252 DECLARE_RELATIONSHIP_OF_CLASSES(RefreshAccessedHistoryEvent, BaseEventInfo); 1253 1254 public: RefreshAccessedHistoryEvent(const std::string & url,bool isRefreshed)1255 RefreshAccessedHistoryEvent(const std::string& url, bool isRefreshed) 1256 : BaseEventInfo("RefreshAccessedHistoryEvent"), url_(url), isRefreshed_(isRefreshed) 1257 {} 1258 1259 ~RefreshAccessedHistoryEvent() = default; 1260 GetVisitedUrl()1261 const std::string& GetVisitedUrl() const 1262 { 1263 return url_; 1264 } 1265 IsRefreshed()1266 bool IsRefreshed() const 1267 { 1268 return isRefreshed_; 1269 } 1270 1271 private: 1272 std::string url_; 1273 bool isRefreshed_; 1274 }; 1275 1276 class ACE_EXPORT FileSelectorEvent : public BaseEventInfo { 1277 DECLARE_RELATIONSHIP_OF_CLASSES(FileSelectorEvent, BaseEventInfo); 1278 1279 public: FileSelectorEvent(const RefPtr<WebFileSelectorParam> & param,const RefPtr<FileSelectorResult> & result)1280 FileSelectorEvent(const RefPtr<WebFileSelectorParam>& param, const RefPtr<FileSelectorResult>& result) 1281 : BaseEventInfo("FileSelectorEvent"), param_(param), result_(result) {} 1282 ~FileSelectorEvent() = default; 1283 GetParam()1284 const RefPtr<WebFileSelectorParam>& GetParam() const 1285 { 1286 return param_; 1287 } 1288 GetFileSelectorResult()1289 const RefPtr<FileSelectorResult>& GetFileSelectorResult() const 1290 { 1291 return result_; 1292 } 1293 1294 private: 1295 RefPtr<WebFileSelectorParam> param_; 1296 RefPtr<FileSelectorResult> result_; 1297 }; 1298 1299 class ACE_EXPORT ResourceLoadEvent : public BaseEventInfo { 1300 DECLARE_RELATIONSHIP_OF_CLASSES(ResourceLoadEvent, BaseEventInfo); 1301 1302 public: ResourceLoadEvent(const std::string & url)1303 explicit ResourceLoadEvent(const std::string& url) : BaseEventInfo("ResourceLoadEvent"), loadUrl_(url) {} 1304 ~ResourceLoadEvent() = default; 1305 GetOnResourceLoadUrl()1306 const std::string& GetOnResourceLoadUrl() const 1307 { 1308 return loadUrl_; 1309 } 1310 1311 private: 1312 std::string loadUrl_; 1313 }; 1314 1315 class ACE_EXPORT ScaleChangeEvent : public BaseEventInfo { 1316 DECLARE_RELATIONSHIP_OF_CLASSES(ScaleChangeEvent, BaseEventInfo); 1317 1318 public: ScaleChangeEvent(float oldScale,float newScale)1319 ScaleChangeEvent(float oldScale, float newScale) 1320 : BaseEventInfo("ScaleChangeEvent"), oldScale_(oldScale), newScale_(newScale) 1321 {} 1322 ~ScaleChangeEvent() = default; 1323 GetOnScaleChangeOldScale()1324 float GetOnScaleChangeOldScale() const 1325 { 1326 return oldScale_; 1327 } 1328 GetOnScaleChangeNewScale()1329 float GetOnScaleChangeNewScale() const 1330 { 1331 return newScale_; 1332 } 1333 1334 private: 1335 float oldScale_ = 0.0f; 1336 float newScale_ = 0.0f; 1337 }; 1338 1339 class ACE_EXPORT WebOnScrollEvent : public BaseEventInfo { 1340 DECLARE_RELATIONSHIP_OF_CLASSES(WebOnScrollEvent, BaseEventInfo); 1341 1342 public: WebOnScrollEvent(double xOffset,double yOffset)1343 WebOnScrollEvent(double xOffset, double yOffset) 1344 : BaseEventInfo("OnScrollEvent"), xOffset_(xOffset), yOffset_(yOffset) 1345 {} 1346 ~WebOnScrollEvent() = default; 1347 GetX()1348 float GetX() const 1349 { 1350 return xOffset_; 1351 } 1352 GetY()1353 float GetY() const 1354 { 1355 return yOffset_; 1356 } 1357 1358 private: 1359 double xOffset_ = 0.0f; 1360 double yOffset_ = 0.0f; 1361 }; 1362 1363 class WebContextMenuParam : public AceType { 1364 DECLARE_ACE_TYPE(WebContextMenuParam, AceType) 1365 1366 public: 1367 WebContextMenuParam() = default; 1368 ~WebContextMenuParam() = default; 1369 1370 virtual int32_t GetXCoord() const = 0; 1371 virtual int32_t GetYCoord() const = 0; 1372 virtual std::string GetLinkUrl() const = 0; 1373 virtual std::string GetUnfilteredLinkUrl() const = 0; 1374 virtual std::string GetSourceUrl() const = 0; 1375 virtual bool HasImageContents() const = 0; 1376 virtual bool IsEditable() const = 0; 1377 virtual int GetEditStateFlags() const = 0; 1378 virtual int GetSourceType() const = 0; 1379 virtual int GetMediaType() const = 0; 1380 virtual int GetInputFieldType() const = 0; 1381 virtual std::string GetSelectionText() const = 0; GetImageRect(int32_t & x,int32_t & y,int32_t & width,int32_t & height)1382 virtual void GetImageRect(int32_t& x, int32_t& y, int32_t& width, int32_t& height) const {} 1383 }; 1384 1385 class ACE_EXPORT ContextMenuResult : public AceType { 1386 DECLARE_ACE_TYPE(ContextMenuResult, AceType) 1387 1388 public: 1389 ContextMenuResult() = default; 1390 ~ContextMenuResult() = default; 1391 1392 virtual void Cancel() const = 0; 1393 virtual void CopyImage() const = 0; 1394 virtual void Copy() const = 0; 1395 virtual void Paste() const = 0; 1396 virtual void Cut() const = 0; 1397 virtual void SelectAll() const = 0; 1398 }; 1399 1400 class ACE_EXPORT ContextMenuEvent : public BaseEventInfo { 1401 DECLARE_RELATIONSHIP_OF_CLASSES(ContextMenuEvent, BaseEventInfo); 1402 1403 public: ContextMenuEvent(const RefPtr<WebContextMenuParam> & param,const RefPtr<ContextMenuResult> & result)1404 ContextMenuEvent(const RefPtr<WebContextMenuParam>& param, const RefPtr<ContextMenuResult>& result) 1405 : BaseEventInfo("ContextShowEvent"), param_(param), result_(result) {} 1406 ~ContextMenuEvent() = default; 1407 GetParam()1408 const RefPtr<WebContextMenuParam>& GetParam() const 1409 { 1410 return param_; 1411 } 1412 GetContextMenuResult()1413 const RefPtr<ContextMenuResult>& GetContextMenuResult() const 1414 { 1415 return result_; 1416 } 1417 1418 private: 1419 RefPtr<WebContextMenuParam> param_; 1420 RefPtr<ContextMenuResult> result_; 1421 }; 1422 1423 class ACE_EXPORT SearchResultReceiveEvent : public BaseEventInfo { 1424 DECLARE_RELATIONSHIP_OF_CLASSES(SearchResultReceiveEvent, BaseEventInfo); 1425 1426 public: SearchResultReceiveEvent(int activeMatchOrdinal,int numberOfMatches,bool isDoneCounting)1427 SearchResultReceiveEvent(int activeMatchOrdinal, int numberOfMatches, bool isDoneCounting) 1428 : BaseEventInfo("SearchResultReceiveEvent"), activeMatchOrdinal_(activeMatchOrdinal), 1429 numberOfMatches_(numberOfMatches), isDoneCounting_(isDoneCounting) 1430 {} 1431 ~SearchResultReceiveEvent() = default; 1432 GetActiveMatchOrdinal()1433 int GetActiveMatchOrdinal() const 1434 { 1435 return activeMatchOrdinal_; 1436 } 1437 GetNumberOfMatches()1438 int GetNumberOfMatches() const 1439 { 1440 return numberOfMatches_; 1441 } 1442 GetIsDoneCounting()1443 bool GetIsDoneCounting() const 1444 { 1445 return isDoneCounting_; 1446 } 1447 1448 private: 1449 int activeMatchOrdinal_; 1450 int numberOfMatches_; 1451 bool isDoneCounting_; 1452 }; 1453 1454 class ACE_EXPORT WebWindowNewEvent : public BaseEventInfo { 1455 DECLARE_RELATIONSHIP_OF_CLASSES(WebWindowNewEvent, BaseEventInfo); 1456 1457 public: WebWindowNewEvent(const std::string & targetUrl,bool isAlert,bool isUserTrigger,const RefPtr<WebWindowNewHandler> & handler)1458 WebWindowNewEvent(const std::string& targetUrl, bool isAlert, bool isUserTrigger, 1459 const RefPtr<WebWindowNewHandler>& handler) 1460 : BaseEventInfo("WebWindowNewEvent"), targetUrl_(targetUrl), isAlert_(isAlert), 1461 isUserTrigger_(isUserTrigger), handler_(handler) {} 1462 ~WebWindowNewEvent() = default; 1463 GetTargetUrl()1464 const std::string& GetTargetUrl() const 1465 { 1466 return targetUrl_; 1467 } 1468 IsAlert()1469 bool IsAlert() const 1470 { 1471 return isAlert_; 1472 } 1473 IsUserTrigger()1474 bool IsUserTrigger() const 1475 { 1476 return isUserTrigger_; 1477 } 1478 GetWebWindowNewHandler()1479 const RefPtr<WebWindowNewHandler>& GetWebWindowNewHandler() const 1480 { 1481 return handler_; 1482 } 1483 private: 1484 std::string targetUrl_; 1485 bool isAlert_; 1486 bool isUserTrigger_; 1487 RefPtr<WebWindowNewHandler> handler_; 1488 }; 1489 1490 class ACE_EXPORT WebWindowExitEvent : public BaseEventInfo { 1491 DECLARE_RELATIONSHIP_OF_CLASSES(WebWindowExitEvent, BaseEventInfo); 1492 1493 public: WebWindowExitEvent()1494 WebWindowExitEvent() : BaseEventInfo("WebWindowExitEvent") {} 1495 ~WebWindowExitEvent() = default; 1496 }; 1497 1498 class ACE_EXPORT PageVisibleEvent : public BaseEventInfo { 1499 DECLARE_RELATIONSHIP_OF_CLASSES(PageVisibleEvent, BaseEventInfo); 1500 1501 public: PageVisibleEvent(const std::string & url)1502 PageVisibleEvent(const std::string& url) 1503 : BaseEventInfo("PageVisibleEvent"), url_(url) 1504 {} 1505 1506 ~PageVisibleEvent() = default; 1507 GetUrl()1508 const std::string& GetUrl() const 1509 { 1510 return url_; 1511 } 1512 1513 private: 1514 std::string url_; 1515 }; 1516 1517 class ACE_EXPORT DataResubmitted : public AceType { 1518 DECLARE_ACE_TYPE(DataResubmitted, AceType) 1519 1520 public: 1521 DataResubmitted() = default; 1522 ~DataResubmitted() = default; 1523 1524 virtual void Resend() = 0; 1525 virtual void Cancel() = 0; 1526 }; 1527 1528 class ACE_EXPORT DataResubmittedEvent : public BaseEventInfo { 1529 DECLARE_RELATIONSHIP_OF_CLASSES(DataResubmittedEvent, BaseEventInfo); 1530 1531 public: DataResubmittedEvent(const RefPtr<DataResubmitted> & handler)1532 DataResubmittedEvent(const RefPtr<DataResubmitted>& handler) 1533 : BaseEventInfo("DataResubmittedEvent"), handler_(handler) {} 1534 ~DataResubmittedEvent() = default; 1535 GetHandler()1536 const RefPtr<DataResubmitted>& GetHandler() const 1537 { 1538 return handler_; 1539 } 1540 1541 private: 1542 RefPtr<DataResubmitted> handler_; 1543 }; 1544 1545 class ACE_EXPORT WebFaviconReceived : public AceType { 1546 DECLARE_ACE_TYPE(WebFaviconReceived, AceType) 1547 1548 public: 1549 WebFaviconReceived() = default; 1550 ~WebFaviconReceived() = default; 1551 1552 virtual const void* GetData() = 0; 1553 virtual size_t GetWidth() = 0; 1554 virtual size_t GetHeight() = 0; 1555 virtual int GetColorType() = 0; 1556 virtual int GetAlphaType() = 0; 1557 }; 1558 1559 class ACE_EXPORT FaviconReceivedEvent : public BaseEventInfo { 1560 DECLARE_RELATIONSHIP_OF_CLASSES(FaviconReceivedEvent, BaseEventInfo); 1561 1562 public: FaviconReceivedEvent(const RefPtr<WebFaviconReceived> & handler)1563 FaviconReceivedEvent(const RefPtr<WebFaviconReceived>& handler) 1564 : BaseEventInfo("FaviconReceivedEvent"), handler_(handler) {} 1565 ~FaviconReceivedEvent() = default; 1566 GetHandler()1567 const RefPtr<WebFaviconReceived>& GetHandler() const 1568 { 1569 return handler_; 1570 } 1571 1572 private: 1573 RefPtr<WebFaviconReceived> handler_; 1574 }; 1575 1576 class ACE_EXPORT TouchIconUrlEvent : public BaseEventInfo { 1577 DECLARE_RELATIONSHIP_OF_CLASSES(TouchIconUrlEvent, BaseEventInfo); 1578 1579 public: TouchIconUrlEvent(const std::string & iconUrl,bool precomposed)1580 TouchIconUrlEvent(const std::string& iconUrl, bool precomposed) 1581 : BaseEventInfo("TouchIconUrlEvent"), url_(iconUrl), precomposed_(precomposed) 1582 {} 1583 1584 ~TouchIconUrlEvent() = default; 1585 GetUrl()1586 const std::string& GetUrl() const 1587 { 1588 return url_; 1589 } 1590 GetPreComposed()1591 bool GetPreComposed() const 1592 { 1593 return precomposed_; 1594 } 1595 1596 private: 1597 std::string url_; 1598 bool precomposed_; 1599 }; 1600 1601 class ACE_EXPORT AudioStateChangedEvent : public BaseEventInfo { 1602 DECLARE_RELATIONSHIP_OF_CLASSES(AudioStateChangedEvent, BaseEventInfo); 1603 1604 public: AudioStateChangedEvent(bool playing)1605 AudioStateChangedEvent(bool playing) : BaseEventInfo("AudioStateChangedEvent"), playing_(playing) {} 1606 ~AudioStateChangedEvent() = default; 1607 IsPlaying()1608 bool IsPlaying() const 1609 { 1610 return playing_; 1611 } 1612 1613 private: 1614 bool playing_; 1615 }; 1616 1617 class ACE_EXPORT FirstContentfulPaintEvent : public BaseEventInfo { 1618 DECLARE_RELATIONSHIP_OF_CLASSES(FirstContentfulPaintEvent, BaseEventInfo); 1619 1620 public: FirstContentfulPaintEvent(int64_t navigationStartTick,int64_t firstContentfulPaintMs)1621 FirstContentfulPaintEvent(int64_t navigationStartTick, int64_t firstContentfulPaintMs) 1622 : BaseEventInfo("FirstContentfulPaintEvent"), navigationStartTick_(navigationStartTick), 1623 firstContentfulPaintMs_(firstContentfulPaintMs) 1624 {} 1625 1626 ~FirstContentfulPaintEvent() = default; 1627 GetNavigationStartTick()1628 int64_t GetNavigationStartTick() const 1629 { 1630 return navigationStartTick_; 1631 } 1632 GetFirstContentfulPaintMs()1633 int64_t GetFirstContentfulPaintMs() const 1634 { 1635 return firstContentfulPaintMs_; 1636 } 1637 1638 private: 1639 int64_t navigationStartTick_; 1640 int64_t firstContentfulPaintMs_; 1641 }; 1642 1643 class ACE_EXPORT FirstMeaningfulPaintEvent : public BaseEventInfo { 1644 DECLARE_RELATIONSHIP_OF_CLASSES(FirstMeaningfulPaintEvent, BaseEventInfo); 1645 1646 public: FirstMeaningfulPaintEvent(int64_t navigationStartTime,int64_t firstMeaningfulPaintTime)1647 FirstMeaningfulPaintEvent(int64_t navigationStartTime, int64_t firstMeaningfulPaintTime) 1648 : BaseEventInfo("FirstMeaningfulPaintEvent"), navigationStartTime_(navigationStartTime), 1649 firstMeaningfulPaintTime_(firstMeaningfulPaintTime) 1650 {} 1651 1652 ~FirstMeaningfulPaintEvent() = default; 1653 GetNavigationStartTime()1654 int64_t GetNavigationStartTime() const 1655 { 1656 return navigationStartTime_; 1657 } 1658 GetFirstMeaningfulPaintTime()1659 int64_t GetFirstMeaningfulPaintTime() const 1660 { 1661 return firstMeaningfulPaintTime_; 1662 } 1663 1664 private: 1665 int64_t navigationStartTime_; 1666 int64_t firstMeaningfulPaintTime_; 1667 }; 1668 1669 class ACE_EXPORT LargestContentfulPaintEvent : public BaseEventInfo { 1670 DECLARE_RELATIONSHIP_OF_CLASSES(LargestContentfulPaintEvent, BaseEventInfo); 1671 1672 public: LargestContentfulPaintEvent(int64_t navigationStartTime,int64_t largestImagePaintTime,int64_t largestTextPaintTime,int64_t largestImageLoadStartTime,int64_t largestImageLoadEndTime,double_t imageBPP)1673 LargestContentfulPaintEvent(int64_t navigationStartTime, int64_t largestImagePaintTime, 1674 int64_t largestTextPaintTime, int64_t largestImageLoadStartTime, int64_t largestImageLoadEndTime, 1675 double_t imageBPP) 1676 : BaseEventInfo("LargestContentfulPaintEvent"), navigationStartTime_(navigationStartTime), 1677 largestImagePaintTime_(largestImagePaintTime), largestTextPaintTime_(largestTextPaintTime), 1678 largestImageLoadStartTime_(largestImageLoadStartTime), largestImageLoadEndTime_(largestImageLoadEndTime), 1679 imageBPP_(imageBPP) 1680 {} 1681 1682 ~LargestContentfulPaintEvent() = default; 1683 GetNavigationStartTime()1684 int64_t GetNavigationStartTime() const 1685 { 1686 return navigationStartTime_; 1687 } 1688 GetLargestImagePaintTime()1689 int64_t GetLargestImagePaintTime() const 1690 { 1691 return largestImagePaintTime_; 1692 } 1693 GetLargestTextPaintTime()1694 int64_t GetLargestTextPaintTime() const 1695 { 1696 return largestTextPaintTime_; 1697 } 1698 GetLargestImageLoadStartTime()1699 int64_t GetLargestImageLoadStartTime() const 1700 { 1701 return largestImageLoadStartTime_; 1702 } 1703 GetLargestImageLoadEndTime()1704 int64_t GetLargestImageLoadEndTime() const 1705 { 1706 return largestImageLoadEndTime_; 1707 } 1708 GetImageBPP()1709 double_t GetImageBPP() const 1710 { 1711 return imageBPP_; 1712 } 1713 1714 private: 1715 int64_t navigationStartTime_; 1716 int64_t largestImagePaintTime_; 1717 int64_t largestTextPaintTime_; 1718 int64_t largestImageLoadStartTime_; 1719 int64_t largestImageLoadEndTime_; 1720 double_t imageBPP_; 1721 }; 1722 1723 class ACE_EXPORT SafeBrowsingCheckResultEvent : public BaseEventInfo { 1724 DECLARE_RELATIONSHIP_OF_CLASSES(SafeBrowsingCheckResultEvent, BaseEventInfo); 1725 1726 public: SafeBrowsingCheckResultEvent(int threat_type)1727 SafeBrowsingCheckResultEvent(int threat_type) 1728 : BaseEventInfo("SafeBrowsingCheckResultEvent"), threat_type_(threat_type) 1729 {} 1730 1731 ~SafeBrowsingCheckResultEvent() = default; 1732 GetThreatType()1733 int GetThreatType() const 1734 { 1735 return threat_type_; 1736 } 1737 1738 private: 1739 int threat_type_; 1740 }; 1741 1742 class ACE_EXPORT WebOnOverScrollEvent : public BaseEventInfo { 1743 DECLARE_RELATIONSHIP_OF_CLASSES(WebOnOverScrollEvent, BaseEventInfo); 1744 1745 public: WebOnOverScrollEvent(double xOffset,double yOffset)1746 WebOnOverScrollEvent(double xOffset, double yOffset) 1747 : BaseEventInfo("OnOverScrollEvent"), xOffset_(xOffset), yOffset_(yOffset) 1748 {} 1749 ~WebOnOverScrollEvent() = default; 1750 GetX()1751 float GetX() const 1752 { 1753 return xOffset_; 1754 } 1755 GetY()1756 float GetY() const 1757 { 1758 return yOffset_; 1759 } 1760 1761 private: 1762 float xOffset_ = 0.0f; 1763 float yOffset_ = 0.0f; 1764 }; 1765 1766 class ACE_EXPORT NavigationEntryCommittedEvent : public BaseEventInfo { 1767 DECLARE_RELATIONSHIP_OF_CLASSES(NavigationEntryCommittedEvent, BaseEventInfo); 1768 1769 public: NavigationEntryCommittedEvent(const std::string & url,NavigationType type,bool isMainFrame,bool isSameDocument,bool didReplaceEntry)1770 NavigationEntryCommittedEvent(const std::string& url, NavigationType type, 1771 bool isMainFrame, bool isSameDocument, bool didReplaceEntry) 1772 : BaseEventInfo("NavigationEntryCommittedEvent"), url_(url), type_(type), 1773 isMainFrame_(isMainFrame), isSameDocument_(isSameDocument), 1774 didReplaceEntry_(didReplaceEntry) {} 1775 ~NavigationEntryCommittedEvent() = default; 1776 GetUrl()1777 const std::string& GetUrl() const { 1778 return url_; 1779 } 1780 GetNavigationType()1781 NavigationType GetNavigationType() const { 1782 return type_; 1783 } 1784 IsMainFrame()1785 bool IsMainFrame() const { 1786 return isMainFrame_; 1787 } 1788 IsSameDocument()1789 bool IsSameDocument() const { 1790 return isSameDocument_; 1791 } 1792 DidReplaceEntry()1793 bool DidReplaceEntry() const { 1794 return didReplaceEntry_; 1795 } 1796 1797 private: 1798 std::string url_; 1799 NavigationType type_ = NavigationType::NAVIGATION_TYPE_UNKNOWN; 1800 bool isMainFrame_ = false; 1801 bool isSameDocument_ = false; 1802 bool didReplaceEntry_ = false; 1803 }; 1804 1805 class ACE_EXPORT IntelligentTrackingPreventionResultEvent : public BaseEventInfo { 1806 DECLARE_RELATIONSHIP_OF_CLASSES(IntelligentTrackingPreventionResultEvent, BaseEventInfo); 1807 1808 public: IntelligentTrackingPreventionResultEvent(const std::string & websiteHost,const std::string & trackerHost)1809 IntelligentTrackingPreventionResultEvent( 1810 const std::string& websiteHost, const std::string& trackerHost) 1811 : BaseEventInfo("IntelligentTrackingPreventionResultEvent"), 1812 host_(websiteHost), trackerHost_(trackerHost) {} 1813 1814 ~IntelligentTrackingPreventionResultEvent() = default; 1815 GetHost()1816 const std::string& GetHost() const 1817 { 1818 return host_; 1819 } 1820 GetTrackerHost()1821 const std::string& GetTrackerHost() const 1822 { 1823 return trackerHost_; 1824 } 1825 1826 private: 1827 std::string host_; 1828 std::string trackerHost_; 1829 }; 1830 1831 struct EmbedInfo final { 1832 std::string id = ""; 1833 std::string type = ""; 1834 std::string src = ""; 1835 std::string url = ""; 1836 std::string tag = ""; 1837 int32_t width = 0; 1838 int32_t height = 0; 1839 int32_t x = 0; 1840 int32_t y = 0; 1841 std::map<std::string, std::string> params; 1842 }; 1843 1844 class ACE_EXPORT NativeEmbedDataInfo : public BaseEventInfo { DECLARE_RELATIONSHIP_OF_CLASSES(NativeEmbedDataInfo,BaseEventInfo)1845 DECLARE_RELATIONSHIP_OF_CLASSES(NativeEmbedDataInfo, BaseEventInfo) 1846 1847 public: 1848 NativeEmbedDataInfo(NativeEmbedStatus status, const std::string& surfaceId, 1849 const std::string& embedId, const EmbedInfo& embedInfo) 1850 : BaseEventInfo("NativeEmbedDataInfo"), status_(status), 1851 surfaceId_(surfaceId), embedId_(embedId), embedInfo_(embedInfo) {} 1852 ~NativeEmbedDataInfo() = default; 1853 GetStatus()1854 NativeEmbedStatus GetStatus() const 1855 { 1856 return status_; 1857 } GetSurfaceId()1858 const std::string& GetSurfaceId() const 1859 { 1860 return surfaceId_; 1861 } 1862 GetEmbedId()1863 const std::string& GetEmbedId() const 1864 { 1865 return embedId_; 1866 } 1867 GetEmebdInfo()1868 const EmbedInfo& GetEmebdInfo() const 1869 { 1870 return embedInfo_; 1871 } 1872 1873 private: 1874 NativeEmbedStatus status_; 1875 std::string surfaceId_ = ""; 1876 std::string embedId_ = ""; 1877 EmbedInfo embedInfo_; 1878 }; 1879 1880 class ACE_EXPORT NativeEmbedVisibilityInfo : public BaseEventInfo { DECLARE_RELATIONSHIP_OF_CLASSES(NativeEmbedVisibilityInfo,BaseEventInfo)1881 DECLARE_RELATIONSHIP_OF_CLASSES(NativeEmbedVisibilityInfo, BaseEventInfo) 1882 1883 public: 1884 NativeEmbedVisibilityInfo(bool visibility, const std::string& embed_id) 1885 : BaseEventInfo("NativeEmbedVisibilityInfo"), visibility_(visibility), 1886 embed_id_(embed_id) {} 1887 ~NativeEmbedVisibilityInfo() = default; 1888 GetVisibility()1889 bool GetVisibility() const 1890 { 1891 return visibility_; 1892 } 1893 GetEmbedId()1894 const std::string& GetEmbedId() const 1895 { 1896 return embed_id_; 1897 } 1898 1899 private: 1900 bool visibility_; 1901 std::string embed_id_ = ""; 1902 }; 1903 1904 class ACE_EXPORT RenderProcessNotRespondingEvent : public BaseEventInfo { 1905 DECLARE_RELATIONSHIP_OF_CLASSES(RenderProcessNotRespondingEvent, BaseEventInfo); 1906 1907 public: RenderProcessNotRespondingEvent(const std::string & jsStack,int pid,int reason)1908 RenderProcessNotRespondingEvent(const std::string& jsStack, int pid, int reason) 1909 : BaseEventInfo("RenderProcessNotRespondingEvent"), jsStack_(jsStack), pid_(pid), reason_(reason) 1910 {} 1911 ~RenderProcessNotRespondingEvent() = default; 1912 GetJsStack()1913 const std::string& GetJsStack() const 1914 { 1915 return jsStack_; 1916 } 1917 GetPid()1918 int GetPid() const 1919 { 1920 return pid_; 1921 } 1922 GetReason()1923 int GetReason() const 1924 { 1925 return reason_; 1926 } 1927 1928 private: 1929 std::string jsStack_; 1930 int pid_; 1931 int reason_; 1932 }; 1933 1934 class ACE_EXPORT RenderProcessRespondingEvent : public BaseEventInfo { 1935 DECLARE_RELATIONSHIP_OF_CLASSES(RenderProcessRespondingEvent, BaseEventInfo); 1936 1937 public: RenderProcessRespondingEvent()1938 RenderProcessRespondingEvent() : BaseEventInfo("RenderProcessRespondingEvent") {} 1939 ~RenderProcessRespondingEvent() = default; 1940 }; 1941 1942 class ACE_EXPORT ViewportFitChangedEvent : public BaseEventInfo { 1943 DECLARE_RELATIONSHIP_OF_CLASSES(ViewportFitChangedEvent, BaseEventInfo); 1944 1945 public: ViewportFitChangedEvent(int32_t viewportFit)1946 ViewportFitChangedEvent(int32_t viewportFit) 1947 : BaseEventInfo("ViewportFitChangedEvent"), viewportFit_(viewportFit) {} 1948 ~ViewportFitChangedEvent() = default; 1949 GetViewportFit()1950 int32_t GetViewportFit() const 1951 { 1952 return viewportFit_; 1953 } 1954 1955 private: 1956 int32_t viewportFit_; 1957 }; 1958 1959 class ACE_EXPORT AdsBlockedEvent : public BaseEventInfo { 1960 DECLARE_RELATIONSHIP_OF_CLASSES(AdsBlockedEvent, BaseEventInfo); 1961 1962 public: AdsBlockedEvent(const std::string & url,const std::vector<std::string> & adsBlocked)1963 AdsBlockedEvent(const std::string& url, const std::vector<std::string>& adsBlocked) : 1964 BaseEventInfo("AdsBlockedEvent"), url_(url), adsBlocked_(adsBlocked) {} 1965 ~AdsBlockedEvent() = default; 1966 GetUrl()1967 const std::string& GetUrl() const 1968 { 1969 return url_; 1970 } 1971 GetAdsBlocked()1972 const std::vector<std::string>& GetAdsBlocked() const 1973 { 1974 return adsBlocked_; 1975 } 1976 1977 private: 1978 std::string url_; 1979 std::vector<std::string> adsBlocked_; 1980 }; 1981 1982 } // namespace OHOS::Ace 1983 1984 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_WEB_WEB_EVENT_H 1985