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 class WebConsoleLog : public AceType { 34 DECLARE_ACE_TYPE(WebConsoleLog, AceType) 35 public: 36 WebConsoleLog() = default; 37 ~WebConsoleLog() = default; 38 39 virtual int GetLineNumber() = 0; 40 virtual std::string GetLog() = 0; 41 virtual int GetLogLevel() = 0; 42 virtual std::string GetSourceId() = 0; 43 }; 44 45 class WebFileSelectorParam : public AceType { 46 DECLARE_ACE_TYPE(WebFileSelectorParam, AceType) 47 public: 48 WebFileSelectorParam() = default; 49 ~WebFileSelectorParam() = default; 50 51 virtual std::string GetTitle() = 0; 52 virtual int GetMode() = 0; 53 virtual std::string GetDefaultFileName() = 0; 54 virtual std::vector<std::string> GetAcceptType() = 0; 55 virtual bool IsCapture() = 0; 56 }; 57 58 class ACE_EXPORT WebError : public AceType { DECLARE_ACE_TYPE(WebError,AceType)59 DECLARE_ACE_TYPE(WebError, AceType) 60 61 public: 62 WebError(const std::string& info, int32_t code) : info_(info), code_(code) {} 63 ~WebError() = default; 64 GetInfo()65 const std::string& GetInfo() const 66 { 67 return info_; 68 } 69 GetCode()70 int32_t GetCode() const 71 { 72 return code_; 73 } 74 75 private: 76 std::string info_; 77 int32_t code_; 78 }; 79 80 enum class WebResponseDataType : int32_t { 81 STRING_TYPE, 82 FILE_TYPE, 83 RESOURCE_URL_TYPE, 84 }; 85 86 class WebResponseAsyncHandle : public AceType { 87 DECLARE_ACE_TYPE(WebResponseAsyncHandle, AceType) 88 public: 89 WebResponseAsyncHandle() = default; 90 virtual ~WebResponseAsyncHandle() = default; 91 92 virtual void HandleData(std::string& data) = 0; 93 virtual void HandleFileFd(int32_t fd) = 0; 94 virtual void HandleResourceUrl(std::string& url) = 0; 95 virtual void HandleHeadersVal(const std::map<std::string, std::string>& response_headers) = 0; 96 virtual void HandleEncoding(std::string& encoding) = 0; 97 virtual void HandleMimeType(std::string& mimeType) = 0; 98 virtual void HandleStatusCodeAndReason(int32_t statusCode, std::string& reason) = 0; 99 virtual void HandleResponseStatus(bool isReady) = 0; 100 }; 101 102 class ACE_EXPORT WebResponse : public AceType { DECLARE_ACE_TYPE(WebResponse,AceType)103 DECLARE_ACE_TYPE(WebResponse, AceType) 104 105 public: 106 WebResponse(const std::map<std::string, std::string>& headers, const std::string& data, const std::string& encoding, 107 const std::string& mimeType, const std::string& reason, int32_t statusCode) 108 : headers_(headers), data_(data), encoding_(encoding), mimeType_(mimeType), reason_(reason), 109 statusCode_(statusCode) 110 {} 111 WebResponse() = default; 112 ~WebResponse() = default; 113 GetHeaders()114 const std::map<std::string, std::string>& GetHeaders() const 115 { 116 return headers_; 117 } 118 GetData()119 const std::string& GetData() const 120 { 121 return data_; 122 } 123 GetEncoding()124 const std::string& GetEncoding() const 125 { 126 return encoding_; 127 } 128 GetMimeType()129 const std::string& GetMimeType() const 130 { 131 return mimeType_; 132 } 133 GetReason()134 const std::string& GetReason() const 135 { 136 return reason_; 137 } 138 GetStatusCode()139 int32_t GetStatusCode() const 140 { 141 return statusCode_; 142 } 143 GetResponseStatus()144 bool GetResponseStatus() const 145 { 146 return isReady_; 147 } 148 GetFileHandle()149 int32_t GetFileHandle() const 150 { 151 return fd_; 152 } 153 GetResourceUrl()154 const std::string& GetResourceUrl() const 155 { 156 return resourceUrl_; 157 } 158 GetDataType()159 WebResponseDataType GetDataType() const 160 { 161 return dataType_; 162 } 163 SetHeadersVal(std::string & key,std::string & val)164 void SetHeadersVal(std::string& key, std::string& val) 165 { 166 headers_[key] = val; 167 } 168 SetData(std::string & data)169 void SetData(std::string& data) 170 { 171 data_ = data; 172 dataType_ = WebResponseDataType::STRING_TYPE; 173 fd_ = 0; 174 } 175 SetFileHandle(int32_t fd)176 void SetFileHandle(int32_t fd) 177 { 178 fd_ = fd; 179 data_.clear(); 180 dataType_ = WebResponseDataType::FILE_TYPE; 181 } 182 SetResourceUrl(const std::string & url)183 void SetResourceUrl(const std::string& url) 184 { 185 resourceUrl_ = url; 186 dataType_ = WebResponseDataType::RESOURCE_URL_TYPE; 187 } 188 SetEncoding(std::string & encoding)189 void SetEncoding(std::string& encoding) 190 { 191 encoding_ = encoding; 192 } 193 SetMimeType(std::string & mimeType)194 void SetMimeType(std::string& mimeType) 195 { 196 mimeType_ = mimeType; 197 } 198 SetReason(std::string & reason)199 void SetReason(std::string& reason) 200 { 201 reason_ = reason; 202 } 203 SetStatusCode(int32_t statusCode)204 void SetStatusCode(int32_t statusCode) 205 { 206 statusCode_ = statusCode; 207 } 208 SetResponseStatus(bool isReady)209 void SetResponseStatus(bool isReady) 210 { 211 isReady_ = isReady; 212 if (handle_ == nullptr) { 213 return; 214 } 215 if (isReady_ == true) { 216 if (dataType_ == WebResponseDataType::FILE_TYPE) { 217 handle_->HandleFileFd(fd_); 218 } else if (dataType_ == WebResponseDataType::RESOURCE_URL_TYPE) { 219 handle_->HandleResourceUrl(resourceUrl_); 220 } else { 221 handle_->HandleData(data_); 222 } 223 handle_->HandleHeadersVal(headers_); 224 handle_->HandleEncoding(encoding_); 225 handle_->HandleMimeType(mimeType_); 226 handle_->HandleStatusCodeAndReason(statusCode_, reason_); 227 } 228 handle_->HandleResponseStatus(isReady_); 229 } 230 SetAsyncHandle(std::shared_ptr<WebResponseAsyncHandle> handle)231 void SetAsyncHandle(std::shared_ptr<WebResponseAsyncHandle> handle) 232 { 233 handle_ = handle; 234 } 235 IsFileHandle()236 bool IsFileHandle() 237 { 238 if (dataType_ == WebResponseDataType::FILE_TYPE) { 239 return true; 240 } 241 return false; 242 } 243 244 private: 245 std::map<std::string, std::string> headers_; 246 std::string data_; 247 int32_t fd_; 248 std::string resourceUrl_; 249 WebResponseDataType dataType_ = WebResponseDataType::STRING_TYPE; 250 std::string encoding_; 251 std::string mimeType_; 252 std::string reason_; 253 int32_t statusCode_; 254 bool isReady_ = true; 255 std::shared_ptr<WebResponseAsyncHandle> handle_; 256 }; 257 258 class ACE_EXPORT WebRequest : public AceType { DECLARE_ACE_TYPE(WebRequest,AceType)259 DECLARE_ACE_TYPE(WebRequest, AceType) 260 261 public: 262 WebRequest(const std::map<std::string, std::string>& headers, const std::string& method, const std::string& url, 263 bool hasGesture, bool isMainFrame, bool isRedirect) 264 : headers_(headers), method_(method), url_(url), hasGesture_(hasGesture), isMainFrame_(isMainFrame), 265 isRedirect_(isRedirect) 266 {} 267 ~WebRequest() = default; 268 GetHeaders()269 const std::map<std::string, std::string>& GetHeaders() const 270 { 271 return headers_; 272 } 273 GetMethod()274 const std::string& GetMethod() const 275 { 276 return method_; 277 } 278 GetUrl()279 const std::string& GetUrl() const 280 { 281 return url_; 282 } 283 HasGesture()284 bool HasGesture() const 285 { 286 return hasGesture_; 287 } 288 IsMainFrame()289 bool IsMainFrame() const 290 { 291 return isMainFrame_; 292 } 293 IsRedirect()294 bool IsRedirect() const 295 { 296 return isRedirect_; 297 } 298 299 private: 300 std::map<std::string, std::string> headers_; 301 std::string method_; 302 std::string url_; 303 bool hasGesture_; 304 bool isMainFrame_; 305 bool isRedirect_; 306 }; 307 308 class ACE_EXPORT Result : public AceType { 309 DECLARE_ACE_TYPE(Result, AceType) 310 311 public: 312 Result() = default; 313 ~Result() = default; 314 315 virtual void Confirm() = 0; 316 virtual void Confirm(const std::string& message) = 0; 317 virtual void Cancel() = 0; 318 }; 319 320 class ACE_EXPORT FileSelectorResult : public AceType { 321 DECLARE_ACE_TYPE(FileSelectorResult, AceType) 322 323 public: 324 FileSelectorResult() = default; 325 ~FileSelectorResult() = default; 326 327 virtual void HandleFileList(std::vector<std::string>& fileList) = 0; 328 }; 329 330 class ACE_EXPORT WebDialogEvent : public BaseEventInfo { 331 DECLARE_RELATIONSHIP_OF_CLASSES(WebDialogEvent, BaseEventInfo); 332 333 public: WebDialogEvent(const std::string & url,const std::string & message,const std::string & value,const DialogEventType & type,const RefPtr<Result> & result)334 WebDialogEvent(const std::string& url, const std::string& message, const std::string& value, 335 const DialogEventType& type, const RefPtr<Result>& result) 336 : BaseEventInfo("WebDialogEvent"), url_(url), message_(message), value_(value), type_(type), result_(result) 337 {} 338 ~WebDialogEvent() = default; 339 GetUrl()340 const std::string& GetUrl() const 341 { 342 return url_; 343 } 344 GetMessage()345 const std::string& GetMessage() const 346 { 347 return message_; 348 } 349 GetValue()350 const std::string& GetValue() const 351 { 352 return value_; 353 } 354 GetResult()355 const RefPtr<Result>& GetResult() const 356 { 357 return result_; 358 } 359 GetType()360 const DialogEventType& GetType() const 361 { 362 return type_; 363 } 364 365 private: 366 std::string url_; 367 std::string message_; 368 std::string value_; 369 DialogEventType type_; 370 RefPtr<Result> result_; 371 }; 372 373 class ACE_EXPORT AuthResult : public AceType { 374 DECLARE_ACE_TYPE(AuthResult, AceType) 375 376 public: 377 AuthResult() = default; 378 ~AuthResult() = default; 379 380 virtual bool Confirm(std::string& userName, std::string& pwd) = 0; 381 virtual bool IsHttpAuthInfoSaved() = 0; 382 virtual void Cancel() = 0; 383 }; 384 385 class ACE_EXPORT WebHttpAuthEvent : public BaseEventInfo { 386 DECLARE_RELATIONSHIP_OF_CLASSES(WebHttpAuthEvent, BaseEventInfo); 387 388 public: WebHttpAuthEvent(const RefPtr<AuthResult> & result,const std::string & host,const std::string & realm)389 WebHttpAuthEvent(const RefPtr<AuthResult>& result, const std::string& host, const std::string& realm) 390 : BaseEventInfo("WebHttpAuthEvent"), result_(result), host_(host), realm_(realm) 391 {} 392 ~WebHttpAuthEvent() = default; 393 GetResult()394 const RefPtr<AuthResult>& GetResult() const 395 { 396 return result_; 397 } 398 GetHost()399 const std::string& GetHost() const 400 { 401 return host_; 402 } 403 GetRealm()404 const std::string& GetRealm() const 405 { 406 return realm_; 407 } 408 409 private: 410 RefPtr<AuthResult> result_; 411 std::string host_; 412 std::string realm_; 413 }; 414 415 class ACE_EXPORT SslErrorResult : public AceType { 416 DECLARE_ACE_TYPE(SslErrorResult, AceType) 417 418 public: 419 SslErrorResult() = default; 420 ~SslErrorResult() = default; 421 virtual void HandleConfirm() = 0; 422 virtual void HandleCancel() = 0; 423 }; 424 425 class ACE_EXPORT WebSslErrorEvent : public BaseEventInfo { 426 DECLARE_RELATIONSHIP_OF_CLASSES(WebSslErrorEvent, BaseEventInfo); 427 428 public: WebSslErrorEvent(const RefPtr<SslErrorResult> & result,int32_t error)429 WebSslErrorEvent(const RefPtr<SslErrorResult>& result, int32_t error) 430 : BaseEventInfo("WebSslErrorEvent"), result_(result), error_(error) {} 431 ~WebSslErrorEvent() = default; 432 GetResult()433 const RefPtr<SslErrorResult>& GetResult() const 434 { 435 return result_; 436 } 437 GetError()438 int32_t GetError() const 439 { 440 return error_; 441 } 442 443 private: 444 RefPtr<SslErrorResult> result_; 445 int32_t error_; 446 }; 447 448 class ACE_EXPORT SslSelectCertResult : public AceType { 449 DECLARE_ACE_TYPE(SslSelectCertResult, AceType) 450 public: 451 SslSelectCertResult() = default; 452 ~SslSelectCertResult() = default; 453 454 virtual void HandleConfirm(const std::string& privateKeyFile, const std::string& certChainFile) = 0; 455 virtual void HandleCancel() = 0; 456 virtual void HandleIgnore() = 0; 457 }; 458 459 class ACE_EXPORT WebSslSelectCertEvent : public BaseEventInfo { 460 DECLARE_RELATIONSHIP_OF_CLASSES(WebSslSelectCertEvent, BaseEventInfo); 461 462 public: WebSslSelectCertEvent(const RefPtr<SslSelectCertResult> & result,const std::string & host,int port,const std::vector<std::string> & keyTypes,const std::vector<std::string> & issuers)463 WebSslSelectCertEvent(const RefPtr<SslSelectCertResult>& result, 464 const std::string& host, int port, 465 const std::vector<std::string>& keyTypes, 466 const std::vector<std::string>& issuers) 467 : BaseEventInfo("WebSslSelectCertEvent"), 468 result_(result), host_(host), port_(port), keyTypes_(keyTypes), issuers_(issuers) {} 469 470 ~WebSslSelectCertEvent() = default; 471 GetResult()472 const RefPtr<SslSelectCertResult>& GetResult() const 473 { 474 return result_; 475 } 476 GetHost()477 const std::string& GetHost() const 478 { 479 return host_; 480 } 481 GetPort()482 int32_t GetPort() const 483 { 484 return port_; 485 } 486 GetKeyTypes()487 const std::vector<std::string>& GetKeyTypes() const 488 { 489 return keyTypes_; 490 } 491 GetIssuers_()492 const std::vector<std::string>& GetIssuers_() const 493 { 494 return issuers_; 495 } 496 497 private: 498 RefPtr<SslSelectCertResult> result_; 499 std::string host_; 500 int32_t port_ = -1; 501 std::vector<std::string> keyTypes_; 502 std::vector<std::string> issuers_; 503 }; 504 505 class ACE_EXPORT WebGeolocation : public AceType { 506 DECLARE_ACE_TYPE(WebGeolocation, AceType) 507 508 public: 509 WebGeolocation() = default; 510 ~WebGeolocation() = default; 511 512 virtual void Invoke(const std::string& origin, const bool& allow, const bool& retain) = 0; 513 }; 514 515 class ACE_EXPORT WebPermissionRequest : public AceType { 516 DECLARE_ACE_TYPE(WebPermissionRequest, AceType) 517 518 public: 519 WebPermissionRequest() = default; 520 ~WebPermissionRequest() = default; 521 522 virtual void Deny() const = 0; 523 524 virtual std::string GetOrigin() const = 0; 525 526 virtual std::vector<std::string> GetResources() const = 0; 527 528 virtual void Grant(std::vector<std::string>& resources) const = 0; 529 }; 530 531 class ACE_EXPORT WebScreenCaptureRequest : public AceType { 532 DECLARE_ACE_TYPE(WebScreenCaptureRequest, AceType) 533 534 public: 535 WebScreenCaptureRequest() = default; 536 ~WebScreenCaptureRequest() = default; 537 538 virtual void Deny() const = 0; 539 540 virtual std::string GetOrigin() const = 0; 541 542 virtual void SetCaptureMode(int32_t mode) = 0; 543 544 virtual void SetSourceId(int32_t sourceId) = 0; 545 546 virtual void Grant() const = 0; 547 }; 548 549 class ACE_EXPORT WebWindowNewHandler : public AceType { 550 DECLARE_ACE_TYPE(WebWindowNewHandler, AceType) 551 552 public: 553 WebWindowNewHandler() = default; 554 ~WebWindowNewHandler() = default; 555 556 virtual void SetWebController(int32_t id) = 0; 557 558 virtual bool IsFrist() const = 0; 559 560 virtual int32_t GetId() const = 0; 561 562 virtual int32_t GetParentNWebId() const = 0; 563 }; 564 565 class ACE_EXPORT LoadWebPageStartEvent : public BaseEventInfo { 566 DECLARE_RELATIONSHIP_OF_CLASSES(LoadWebPageStartEvent, BaseEventInfo); 567 568 public: LoadWebPageStartEvent(const std::string & url)569 explicit LoadWebPageStartEvent(const std::string& url) : BaseEventInfo("LoadWebPageStartEvent"), loadedUrl_(url) {} 570 ~LoadWebPageStartEvent() = default; 571 GetLoadedUrl()572 const std::string& GetLoadedUrl() const 573 { 574 return loadedUrl_; 575 } 576 577 private: 578 std::string loadedUrl_; 579 }; 580 581 class ACE_EXPORT LoadWebPageFinishEvent : public BaseEventInfo { 582 DECLARE_RELATIONSHIP_OF_CLASSES(LoadWebPageFinishEvent, BaseEventInfo); 583 584 public: LoadWebPageFinishEvent(const std::string & url)585 explicit LoadWebPageFinishEvent(const std::string& url) : BaseEventInfo("LoadWebPageFinishEvent"), loadedUrl_(url) 586 {} 587 ~LoadWebPageFinishEvent() = default; 588 GetLoadedUrl()589 const std::string& GetLoadedUrl() const 590 { 591 return loadedUrl_; 592 } 593 594 private: 595 std::string loadedUrl_; 596 }; 597 598 class ACE_EXPORT ContextMenuHideEvent : public BaseEventInfo { 599 DECLARE_RELATIONSHIP_OF_CLASSES(ContextMenuHideEvent, BaseEventInfo); 600 601 public: ContextMenuHideEvent(const std::string & info)602 explicit ContextMenuHideEvent(const std::string& info) : BaseEventInfo("ContextMenuHideEvent"), info_(info) 603 {} 604 ~ContextMenuHideEvent() = default; 605 GetInfo()606 const std::string& GetInfo() const 607 { 608 return info_; 609 } 610 611 private: 612 std::string info_; 613 }; 614 615 class ACE_EXPORT LoadWebProgressChangeEvent : public BaseEventInfo { 616 DECLARE_RELATIONSHIP_OF_CLASSES(LoadWebProgressChangeEvent, BaseEventInfo); 617 618 public: LoadWebProgressChangeEvent(const int & newProgress)619 explicit LoadWebProgressChangeEvent(const int& newProgress) 620 : BaseEventInfo("LoadWebProgressChangeEvent"), newProgress_(newProgress) 621 {} 622 ~LoadWebProgressChangeEvent() = default; 623 GetNewProgress()624 const int& GetNewProgress() const 625 { 626 return newProgress_; 627 } 628 629 private: 630 int newProgress_; 631 }; 632 633 class ACE_EXPORT LoadWebTitleReceiveEvent : public BaseEventInfo { 634 DECLARE_RELATIONSHIP_OF_CLASSES(LoadWebTitleReceiveEvent, BaseEventInfo); 635 636 public: LoadWebTitleReceiveEvent(const std::string & title)637 explicit LoadWebTitleReceiveEvent(const std::string& title) 638 : BaseEventInfo("LoadWebTitleReceiveEvent"), title_(title) 639 {} 640 ~LoadWebTitleReceiveEvent() = default; 641 GetTitle()642 const std::string& GetTitle() const 643 { 644 return title_; 645 } 646 647 private: 648 std::string title_; 649 }; 650 651 class ACE_EXPORT FullScreenExitHandler : public AceType { 652 DECLARE_ACE_TYPE(FullScreenExitHandler, AceType) 653 654 public: 655 FullScreenExitHandler() = default; 656 ~FullScreenExitHandler() = default; 657 658 virtual void ExitFullScreen() = 0; 659 }; 660 661 class ACE_EXPORT FullScreenEnterEvent : public BaseEventInfo { 662 DECLARE_RELATIONSHIP_OF_CLASSES(FullScreenEnterEvent, BaseEventInfo); 663 664 public: FullScreenEnterEvent(const RefPtr<FullScreenExitHandler> & handler)665 FullScreenEnterEvent(const RefPtr<FullScreenExitHandler>& handler) 666 : BaseEventInfo("FullScreenEnterEvent"), handler_(handler) {} 667 ~FullScreenEnterEvent() = default; 668 GetHandler()669 const RefPtr<FullScreenExitHandler>& GetHandler() const 670 { 671 return handler_; 672 } 673 674 private: 675 RefPtr<FullScreenExitHandler> handler_; 676 }; 677 678 class ACE_EXPORT FullScreenExitEvent : public BaseEventInfo { 679 DECLARE_RELATIONSHIP_OF_CLASSES(FullScreenExitEvent, BaseEventInfo); 680 681 public: 682 explicit FullScreenExitEvent(bool fullscreen = false) 683 : BaseEventInfo("FullScreenExitEvent"), fullscreen_(fullscreen) {} 684 ~FullScreenExitEvent() = default; 685 IsFullScreen()686 bool IsFullScreen() const 687 { 688 return fullscreen_; 689 } 690 691 private: 692 bool fullscreen_ = false; 693 }; 694 695 class ACE_EXPORT UrlLoadInterceptEvent : public BaseEventInfo { 696 DECLARE_RELATIONSHIP_OF_CLASSES(UrlLoadInterceptEvent, BaseEventInfo); 697 698 public: UrlLoadInterceptEvent(const std::string & data)699 explicit UrlLoadInterceptEvent(const std::string& data) : BaseEventInfo("UrlLoadInterceptEvent"), data_(data) {} 700 ~UrlLoadInterceptEvent() = default; 701 GetData()702 const std::string& GetData() const 703 { 704 return data_; 705 } 706 707 private: 708 std::string data_; 709 }; 710 711 class ACE_EXPORT LoadInterceptEvent : public BaseEventInfo { 712 DECLARE_RELATIONSHIP_OF_CLASSES(LoadInterceptEvent, BaseEventInfo); 713 714 public: LoadInterceptEvent(const RefPtr<WebRequest> & request)715 explicit LoadInterceptEvent(const RefPtr<WebRequest>& request) : 716 BaseEventInfo("LoadInterceptEvent"), request_(request) {} 717 ~LoadInterceptEvent() = default; 718 GetRequest()719 const RefPtr<WebRequest>& GetRequest() const 720 { 721 return request_; 722 } 723 724 private: 725 RefPtr<WebRequest> request_; 726 }; 727 728 class ACE_EXPORT LoadWebGeolocationHideEvent : public BaseEventInfo { 729 DECLARE_RELATIONSHIP_OF_CLASSES(LoadWebGeolocationHideEvent, BaseEventInfo); 730 731 public: LoadWebGeolocationHideEvent(const std::string & origin)732 explicit LoadWebGeolocationHideEvent(const std::string& origin) 733 : BaseEventInfo("LoadWebGeolocationHideEvent"), origin_(origin) 734 {} 735 ~LoadWebGeolocationHideEvent() = default; 736 GetOrigin()737 const std::string& GetOrigin() const 738 { 739 return origin_; 740 } 741 742 private: 743 std::string origin_; 744 }; 745 746 class ACE_EXPORT LoadWebGeolocationShowEvent : public BaseEventInfo { 747 DECLARE_RELATIONSHIP_OF_CLASSES(LoadWebGeolocationShowEvent, BaseEventInfo); 748 749 public: LoadWebGeolocationShowEvent(const std::string & origin,const RefPtr<WebGeolocation> & webGeolocation)750 LoadWebGeolocationShowEvent(const std::string& origin, const RefPtr<WebGeolocation>& webGeolocation) 751 : BaseEventInfo("LoadWebGeolocationShowEvent"), origin_(origin), webGeolocation_(webGeolocation) 752 {} 753 ~LoadWebGeolocationShowEvent() = default; 754 GetOrigin()755 const std::string& GetOrigin() const 756 { 757 return origin_; 758 } 759 GetWebGeolocation()760 const RefPtr<WebGeolocation>& GetWebGeolocation() const 761 { 762 return webGeolocation_; 763 } 764 765 private: 766 std::string origin_; 767 RefPtr<WebGeolocation> webGeolocation_; 768 }; 769 770 class ACE_EXPORT WebPermissionRequestEvent : public BaseEventInfo { 771 DECLARE_RELATIONSHIP_OF_CLASSES(WebPermissionRequestEvent, BaseEventInfo); 772 773 public: WebPermissionRequestEvent(const RefPtr<WebPermissionRequest> & webPermissionRequest)774 WebPermissionRequestEvent(const RefPtr<WebPermissionRequest>& webPermissionRequest) 775 : BaseEventInfo("WebPermissionRequestEvent"), webPermissionRequest_(webPermissionRequest) 776 {} 777 ~WebPermissionRequestEvent() = default; 778 GetWebPermissionRequest()779 const RefPtr<WebPermissionRequest>& GetWebPermissionRequest() const 780 { 781 return webPermissionRequest_; 782 } 783 784 private: 785 RefPtr<WebPermissionRequest> webPermissionRequest_; 786 }; 787 788 class ACE_EXPORT WebScreenCaptureRequestEvent : public BaseEventInfo { 789 DECLARE_RELATIONSHIP_OF_CLASSES(WebScreenCaptureRequestEvent, BaseEventInfo); 790 791 public: WebScreenCaptureRequestEvent(const RefPtr<WebScreenCaptureRequest> & request)792 WebScreenCaptureRequestEvent(const RefPtr<WebScreenCaptureRequest>& request) 793 : BaseEventInfo("WebScreenCaptureRequestEvent"), request_(request) 794 {} 795 ~WebScreenCaptureRequestEvent() = default; 796 GetWebScreenCaptureRequest()797 const RefPtr<WebScreenCaptureRequest>& GetWebScreenCaptureRequest() const 798 { 799 return request_; 800 } 801 802 private: 803 RefPtr<WebScreenCaptureRequest> request_; 804 }; 805 806 class ACE_EXPORT DownloadStartEvent : public BaseEventInfo { 807 DECLARE_RELATIONSHIP_OF_CLASSES(DownloadStartEvent, BaseEventInfo); 808 809 public: DownloadStartEvent(const std::string & url,const std::string & userAgent,const std::string & contentDisposition,const std::string & mimetype,long contentLength)810 DownloadStartEvent(const std::string& url, const std::string& userAgent, const std::string& contentDisposition, 811 const std::string& mimetype, long contentLength) 812 : BaseEventInfo("DownloadStartEvent"), url_(url), userAgent_(userAgent), 813 contentDisposition_(contentDisposition), mimetype_(mimetype), contentLength_(contentLength) 814 {} 815 ~DownloadStartEvent() = default; 816 GetUrl()817 const std::string& GetUrl() const 818 { 819 return url_; 820 } 821 GetUserAgent()822 const std::string& GetUserAgent() const 823 { 824 return userAgent_; 825 } 826 GetContentDisposition()827 const std::string& GetContentDisposition() const 828 { 829 return contentDisposition_; 830 } 831 GetMimetype()832 const std::string& GetMimetype() const 833 { 834 return mimetype_; 835 } 836 GetContentLength()837 long GetContentLength() const 838 { 839 return contentLength_; 840 } 841 842 private: 843 std::string url_; 844 std::string userAgent_; 845 std::string contentDisposition_; 846 std::string mimetype_; 847 long contentLength_; 848 }; 849 850 class ACE_EXPORT ReceivedErrorEvent : public BaseEventInfo { 851 DECLARE_RELATIONSHIP_OF_CLASSES(ReceivedErrorEvent, BaseEventInfo); 852 853 public: ReceivedErrorEvent(const RefPtr<WebRequest> & request,const RefPtr<WebError> & error)854 ReceivedErrorEvent(const RefPtr<WebRequest>& request, const RefPtr<WebError>& error) 855 : BaseEventInfo("ReceivedErrorEvent"), request_(request), error_(error) 856 { 857 LOGI("ReceivedErrorEvent constructor"); 858 } 859 ~ReceivedErrorEvent() = default; 860 GetRequest()861 const RefPtr<WebRequest>& GetRequest() const 862 { 863 return request_; 864 } 865 GetError()866 const RefPtr<WebError>& GetError() const 867 { 868 return error_; 869 } 870 871 private: 872 RefPtr<WebRequest> request_; 873 RefPtr<WebError> error_; 874 }; 875 876 class ACE_EXPORT ReceivedHttpErrorEvent : public BaseEventInfo { 877 DECLARE_RELATIONSHIP_OF_CLASSES(ReceivedHttpErrorEvent, BaseEventInfo); 878 879 public: ReceivedHttpErrorEvent(const RefPtr<WebRequest> & request,const RefPtr<WebResponse> & response)880 ReceivedHttpErrorEvent(const RefPtr<WebRequest>& request, const RefPtr<WebResponse>& response) 881 : BaseEventInfo("ReceivedHttpErrorEvent"), request_(request), response_(response) 882 { 883 LOGI("ReceivedHttpErrorEvent constructor"); 884 } 885 ~ReceivedHttpErrorEvent() = default; 886 GetRequest()887 const RefPtr<WebRequest>& GetRequest() const 888 { 889 return request_; 890 } 891 GetResponse()892 const RefPtr<WebResponse>& GetResponse() const 893 { 894 return response_; 895 } 896 897 private: 898 RefPtr<WebRequest> request_; 899 RefPtr<WebResponse> response_; 900 }; 901 902 class ACE_EXPORT OnInterceptRequestEvent : public BaseEventInfo { 903 DECLARE_RELATIONSHIP_OF_CLASSES(OnInterceptRequestEvent, BaseEventInfo); 904 905 public: OnInterceptRequestEvent(const RefPtr<WebRequest> & request)906 OnInterceptRequestEvent(const RefPtr<WebRequest>& request) 907 : BaseEventInfo("OnInterceptRequestEvent"), request_(request) 908 { 909 LOGI("OnInterceptRequestEvent constructor"); 910 } 911 ~OnInterceptRequestEvent() = default; 912 GetRequest()913 const RefPtr<WebRequest>& GetRequest() const 914 { 915 return request_; 916 } 917 918 private: 919 RefPtr<WebRequest> request_; 920 }; 921 922 class ACE_EXPORT LoadWebRequestFocusEvent : public BaseEventInfo { 923 DECLARE_RELATIONSHIP_OF_CLASSES(LoadWebRequestFocusEvent, BaseEventInfo); 924 925 public: LoadWebRequestFocusEvent(const std::string & url)926 explicit LoadWebRequestFocusEvent(const std::string& url) 927 : BaseEventInfo("LoadWebRequestFocusEvent"), focusUrl_(url) 928 {} 929 ~LoadWebRequestFocusEvent() = default; 930 GetRequestFocus()931 const std::string& GetRequestFocus() const 932 { 933 return focusUrl_; 934 } 935 936 private: 937 std::string focusUrl_; 938 }; 939 940 class ACE_EXPORT LoadWebOnFocusEvent : public BaseEventInfo { 941 DECLARE_RELATIONSHIP_OF_CLASSES(LoadWebOnFocusEvent, BaseEventInfo); 942 943 public: LoadWebOnFocusEvent(const std::string & url)944 explicit LoadWebOnFocusEvent(const std::string& url) : BaseEventInfo("LoadWebOnFocusEvent"), focusUrl_(url) {} 945 ~LoadWebOnFocusEvent() = default; 946 GetOnFocus()947 const std::string& GetOnFocus() const 948 { 949 return focusUrl_; 950 } 951 952 private: 953 std::string focusUrl_; 954 }; 955 956 class ACE_EXPORT LoadWebConsoleLogEvent : public BaseEventInfo { 957 DECLARE_RELATIONSHIP_OF_CLASSES(LoadWebConsoleLogEvent, BaseEventInfo); 958 959 public: LoadWebConsoleLogEvent(RefPtr<WebConsoleLog> message)960 LoadWebConsoleLogEvent(RefPtr<WebConsoleLog> message) : BaseEventInfo("LoadWebConsoleLogEvent"), message_(message) 961 {} 962 ~LoadWebConsoleLogEvent() = default; 963 GetMessage()964 const RefPtr<WebConsoleLog> GetMessage() const 965 { 966 return message_; 967 } 968 969 private: 970 RefPtr<WebConsoleLog> message_; 971 }; 972 973 class ACE_EXPORT RenderExitedEvent : public BaseEventInfo { 974 DECLARE_RELATIONSHIP_OF_CLASSES(RenderExitedEvent, BaseEventInfo); 975 976 public: RenderExitedEvent(int32_t exitedReason)977 RenderExitedEvent(int32_t exitedReason) : BaseEventInfo("RenderExitedEvent"), exitedReason_(exitedReason) {} 978 ~RenderExitedEvent() = default; 979 GetExitedReason()980 int32_t GetExitedReason() const 981 { 982 return exitedReason_; 983 } 984 985 private: 986 int32_t exitedReason_; 987 }; 988 989 class ACE_EXPORT RefreshAccessedHistoryEvent : public BaseEventInfo { 990 DECLARE_RELATIONSHIP_OF_CLASSES(RefreshAccessedHistoryEvent, BaseEventInfo); 991 992 public: RefreshAccessedHistoryEvent(const std::string & url,bool isRefreshed)993 RefreshAccessedHistoryEvent(const std::string& url, bool isRefreshed) 994 : BaseEventInfo("RefreshAccessedHistoryEvent"), url_(url), isRefreshed_(isRefreshed) 995 {} 996 997 ~RefreshAccessedHistoryEvent() = default; 998 GetVisitedUrl()999 const std::string& GetVisitedUrl() const 1000 { 1001 return url_; 1002 } 1003 IsRefreshed()1004 bool IsRefreshed() const 1005 { 1006 return isRefreshed_; 1007 } 1008 1009 private: 1010 std::string url_; 1011 bool isRefreshed_; 1012 }; 1013 1014 class ACE_EXPORT FileSelectorEvent : public BaseEventInfo { 1015 DECLARE_RELATIONSHIP_OF_CLASSES(FileSelectorEvent, BaseEventInfo); 1016 1017 public: FileSelectorEvent(const RefPtr<WebFileSelectorParam> & param,const RefPtr<FileSelectorResult> & result)1018 FileSelectorEvent(const RefPtr<WebFileSelectorParam>& param, const RefPtr<FileSelectorResult>& result) 1019 : BaseEventInfo("FileSelectorEvent"), param_(param), result_(result) 1020 { 1021 LOGI("FileSelectorEvent constructor"); 1022 } 1023 ~FileSelectorEvent() = default; 1024 GetParam()1025 const RefPtr<WebFileSelectorParam>& GetParam() const 1026 { 1027 return param_; 1028 } 1029 GetFileSelectorResult()1030 const RefPtr<FileSelectorResult>& GetFileSelectorResult() const 1031 { 1032 return result_; 1033 } 1034 1035 private: 1036 RefPtr<WebFileSelectorParam> param_; 1037 RefPtr<FileSelectorResult> result_; 1038 }; 1039 1040 class ACE_EXPORT ResourceLoadEvent : public BaseEventInfo { 1041 DECLARE_RELATIONSHIP_OF_CLASSES(ResourceLoadEvent, BaseEventInfo); 1042 1043 public: ResourceLoadEvent(const std::string & url)1044 explicit ResourceLoadEvent(const std::string& url) : BaseEventInfo("ResourceLoadEvent"), loadUrl_(url) {} 1045 ~ResourceLoadEvent() = default; 1046 GetOnResourceLoadUrl()1047 const std::string& GetOnResourceLoadUrl() const 1048 { 1049 return loadUrl_; 1050 } 1051 1052 private: 1053 std::string loadUrl_; 1054 }; 1055 1056 class ACE_EXPORT ScaleChangeEvent : public BaseEventInfo { 1057 DECLARE_RELATIONSHIP_OF_CLASSES(ScaleChangeEvent, BaseEventInfo); 1058 1059 public: ScaleChangeEvent(float oldScale,float newScale)1060 ScaleChangeEvent(float oldScale, float newScale) 1061 : BaseEventInfo("ScaleChangeEvent"), oldScale_(oldScale), newScale_(newScale) 1062 {} 1063 ~ScaleChangeEvent() = default; 1064 GetOnScaleChangeOldScale()1065 float GetOnScaleChangeOldScale() const 1066 { 1067 return oldScale_; 1068 } 1069 GetOnScaleChangeNewScale()1070 float GetOnScaleChangeNewScale() const 1071 { 1072 return newScale_; 1073 } 1074 1075 private: 1076 float oldScale_ = 0.0f; 1077 float newScale_ = 0.0f; 1078 }; 1079 1080 class ACE_EXPORT WebOnScrollEvent : public BaseEventInfo { 1081 DECLARE_RELATIONSHIP_OF_CLASSES(WebOnScrollEvent, BaseEventInfo); 1082 1083 public: WebOnScrollEvent(double xOffset,double yOffset)1084 WebOnScrollEvent(double xOffset, double yOffset) 1085 : BaseEventInfo("OnScrollEvent"), xOffset_(xOffset), yOffset_(yOffset) 1086 {} 1087 ~WebOnScrollEvent() = default; 1088 GetX()1089 float GetX() const 1090 { 1091 return xOffset_; 1092 } 1093 GetY()1094 float GetY() const 1095 { 1096 return yOffset_; 1097 } 1098 1099 private: 1100 double xOffset_ = 0.0f; 1101 double yOffset_ = 0.0f; 1102 }; 1103 1104 class WebContextMenuParam : public AceType { 1105 DECLARE_ACE_TYPE(WebContextMenuParam, AceType) 1106 1107 public: 1108 WebContextMenuParam() = default; 1109 ~WebContextMenuParam() = default; 1110 1111 virtual int32_t GetXCoord() const = 0; 1112 virtual int32_t GetYCoord() const = 0; 1113 virtual std::string GetLinkUrl() const = 0; 1114 virtual std::string GetUnfilteredLinkUrl() const = 0; 1115 virtual std::string GetSourceUrl() const = 0; 1116 virtual bool HasImageContents() const = 0; 1117 virtual bool IsEditable() const = 0; 1118 virtual int GetEditStateFlags() const = 0; 1119 virtual int GetSourceType() const = 0; 1120 virtual int GetMediaType() const = 0; 1121 virtual int GetInputFieldType() const = 0; 1122 virtual std::string GetSelectionText() const = 0; 1123 }; 1124 1125 class ACE_EXPORT ContextMenuResult : public AceType { 1126 DECLARE_ACE_TYPE(ContextMenuResult, AceType) 1127 1128 public: 1129 ContextMenuResult() = default; 1130 ~ContextMenuResult() = default; 1131 1132 virtual void Cancel() const = 0; 1133 virtual void CopyImage() const = 0; 1134 virtual void Copy() const = 0; 1135 virtual void Paste() const = 0; 1136 virtual void Cut() const = 0; 1137 virtual void SelectAll() const = 0; 1138 }; 1139 1140 class ACE_EXPORT ContextMenuEvent : public BaseEventInfo { 1141 DECLARE_RELATIONSHIP_OF_CLASSES(ContextMenuEvent, BaseEventInfo); 1142 1143 public: ContextMenuEvent(const RefPtr<WebContextMenuParam> & param,const RefPtr<ContextMenuResult> & result)1144 ContextMenuEvent(const RefPtr<WebContextMenuParam>& param, const RefPtr<ContextMenuResult>& result) 1145 : BaseEventInfo("ContextShowEvent"), param_(param), result_(result) 1146 { 1147 LOGI("ContextShowEvent constructor"); 1148 } 1149 ~ContextMenuEvent() = default; 1150 GetParam()1151 const RefPtr<WebContextMenuParam>& GetParam() const 1152 { 1153 return param_; 1154 } 1155 GetContextMenuResult()1156 const RefPtr<ContextMenuResult>& GetContextMenuResult() const 1157 { 1158 return result_; 1159 } 1160 1161 private: 1162 RefPtr<WebContextMenuParam> param_; 1163 RefPtr<ContextMenuResult> result_; 1164 }; 1165 1166 class ACE_EXPORT SearchResultReceiveEvent : public BaseEventInfo { 1167 DECLARE_RELATIONSHIP_OF_CLASSES(SearchResultReceiveEvent, BaseEventInfo); 1168 1169 public: SearchResultReceiveEvent(int activeMatchOrdinal,int numberOfMatches,bool isDoneCounting)1170 SearchResultReceiveEvent(int activeMatchOrdinal, int numberOfMatches, bool isDoneCounting) 1171 : BaseEventInfo("SearchResultReceiveEvent"), activeMatchOrdinal_(activeMatchOrdinal), 1172 numberOfMatches_(numberOfMatches), isDoneCounting_(isDoneCounting) 1173 {} 1174 ~SearchResultReceiveEvent() = default; 1175 GetActiveMatchOrdinal()1176 int GetActiveMatchOrdinal() const 1177 { 1178 return activeMatchOrdinal_; 1179 } 1180 GetNumberOfMatches()1181 int GetNumberOfMatches() const 1182 { 1183 return numberOfMatches_; 1184 } 1185 GetIsDoneCounting()1186 bool GetIsDoneCounting() const 1187 { 1188 return isDoneCounting_; 1189 } 1190 1191 private: 1192 int activeMatchOrdinal_; 1193 int numberOfMatches_; 1194 bool isDoneCounting_; 1195 }; 1196 1197 class ACE_EXPORT WebWindowNewEvent : public BaseEventInfo { 1198 DECLARE_RELATIONSHIP_OF_CLASSES(WebWindowNewEvent, BaseEventInfo); 1199 1200 public: WebWindowNewEvent(const std::string & targetUrl,bool isAlert,bool isUserTrigger,const RefPtr<WebWindowNewHandler> & handler)1201 WebWindowNewEvent(const std::string& targetUrl, bool isAlert, bool isUserTrigger, 1202 const RefPtr<WebWindowNewHandler>& handler) 1203 : BaseEventInfo("WebWindowNewEvent"), targetUrl_(targetUrl), isAlert_(isAlert), 1204 isUserTrigger_(isUserTrigger), handler_(handler) {} 1205 ~WebWindowNewEvent() = default; 1206 GetTargetUrl()1207 const std::string& GetTargetUrl() const 1208 { 1209 return targetUrl_; 1210 } 1211 IsAlert()1212 bool IsAlert() const 1213 { 1214 return isAlert_; 1215 } 1216 IsUserTrigger()1217 bool IsUserTrigger() const 1218 { 1219 return isUserTrigger_; 1220 } 1221 GetWebWindowNewHandler()1222 const RefPtr<WebWindowNewHandler>& GetWebWindowNewHandler() const 1223 { 1224 return handler_; 1225 } 1226 private: 1227 std::string targetUrl_; 1228 bool isAlert_; 1229 bool isUserTrigger_; 1230 RefPtr<WebWindowNewHandler> handler_; 1231 }; 1232 1233 class ACE_EXPORT WebWindowExitEvent : public BaseEventInfo { 1234 DECLARE_RELATIONSHIP_OF_CLASSES(WebWindowExitEvent, BaseEventInfo); 1235 1236 public: WebWindowExitEvent()1237 WebWindowExitEvent() : BaseEventInfo("WebWindowExitEvent") {} 1238 ~WebWindowExitEvent() = default; 1239 }; 1240 1241 class ACE_EXPORT PageVisibleEvent : public BaseEventInfo { 1242 DECLARE_RELATIONSHIP_OF_CLASSES(PageVisibleEvent, BaseEventInfo); 1243 1244 public: PageVisibleEvent(const std::string & url)1245 PageVisibleEvent(const std::string& url) 1246 : BaseEventInfo("PageVisibleEvent"), url_(url) 1247 {} 1248 1249 ~PageVisibleEvent() = default; 1250 GetUrl()1251 const std::string& GetUrl() const 1252 { 1253 return url_; 1254 } 1255 1256 private: 1257 std::string url_; 1258 }; 1259 1260 class ACE_EXPORT DataResubmitted : public AceType { 1261 DECLARE_ACE_TYPE(DataResubmitted, AceType) 1262 1263 public: 1264 DataResubmitted() = default; 1265 ~DataResubmitted() = default; 1266 1267 virtual void Resend() = 0; 1268 virtual void Cancel() = 0; 1269 }; 1270 1271 class ACE_EXPORT DataResubmittedEvent : public BaseEventInfo { 1272 DECLARE_RELATIONSHIP_OF_CLASSES(DataResubmittedEvent, BaseEventInfo); 1273 1274 public: DataResubmittedEvent(const RefPtr<DataResubmitted> & handler)1275 DataResubmittedEvent(const RefPtr<DataResubmitted>& handler) 1276 : BaseEventInfo("DataResubmittedEvent"), handler_(handler) {} 1277 ~DataResubmittedEvent() = default; 1278 GetHandler()1279 const RefPtr<DataResubmitted>& GetHandler() const 1280 { 1281 return handler_; 1282 } 1283 1284 private: 1285 RefPtr<DataResubmitted> handler_; 1286 }; 1287 1288 class ACE_EXPORT WebFaviconReceived : public AceType { 1289 DECLARE_ACE_TYPE(WebFaviconReceived, AceType) 1290 1291 public: 1292 WebFaviconReceived() = default; 1293 ~WebFaviconReceived() = default; 1294 1295 virtual const void* GetData() = 0; 1296 virtual size_t GetWidth() = 0; 1297 virtual size_t GetHeight() = 0; 1298 virtual int GetColorType() = 0; 1299 virtual int GetAlphaType() = 0; 1300 }; 1301 1302 class ACE_EXPORT FaviconReceivedEvent : public BaseEventInfo { 1303 DECLARE_RELATIONSHIP_OF_CLASSES(FaviconReceivedEvent, BaseEventInfo); 1304 1305 public: FaviconReceivedEvent(const RefPtr<WebFaviconReceived> & handler)1306 FaviconReceivedEvent(const RefPtr<WebFaviconReceived>& handler) 1307 : BaseEventInfo("FaviconReceivedEvent"), handler_(handler) {} 1308 ~FaviconReceivedEvent() = default; 1309 GetHandler()1310 const RefPtr<WebFaviconReceived>& GetHandler() const 1311 { 1312 return handler_; 1313 } 1314 1315 private: 1316 RefPtr<WebFaviconReceived> handler_; 1317 }; 1318 1319 class ACE_EXPORT TouchIconUrlEvent : public BaseEventInfo { 1320 DECLARE_RELATIONSHIP_OF_CLASSES(TouchIconUrlEvent, BaseEventInfo); 1321 1322 public: TouchIconUrlEvent(const std::string & iconUrl,bool precomposed)1323 TouchIconUrlEvent(const std::string& iconUrl, bool precomposed) 1324 : BaseEventInfo("TouchIconUrlEvent"), url_(iconUrl), precomposed_(precomposed) 1325 {} 1326 1327 ~TouchIconUrlEvent() = default; 1328 GetUrl()1329 const std::string& GetUrl() const 1330 { 1331 return url_; 1332 } 1333 GetPreComposed()1334 bool GetPreComposed() const 1335 { 1336 return precomposed_; 1337 } 1338 1339 private: 1340 std::string url_; 1341 bool precomposed_; 1342 }; 1343 1344 class ACE_EXPORT AudioStateChangedEvent : public BaseEventInfo { 1345 DECLARE_RELATIONSHIP_OF_CLASSES(AudioStateChangedEvent, BaseEventInfo); 1346 1347 public: AudioStateChangedEvent(bool playing)1348 AudioStateChangedEvent(bool playing) : BaseEventInfo("AudioStateChangedEvent"), playing_(playing) {} 1349 ~AudioStateChangedEvent() = default; 1350 IsPlaying()1351 bool IsPlaying() const 1352 { 1353 return playing_; 1354 } 1355 1356 private: 1357 bool playing_; 1358 }; 1359 1360 class ACE_EXPORT FirstContentfulPaintEvent : public BaseEventInfo { 1361 DECLARE_RELATIONSHIP_OF_CLASSES(FirstContentfulPaintEvent, BaseEventInfo); 1362 1363 public: FirstContentfulPaintEvent(int64_t navigationStartTick,int64_t firstContentfulPaintMs)1364 FirstContentfulPaintEvent(int64_t navigationStartTick, int64_t firstContentfulPaintMs) 1365 : BaseEventInfo("FirstContentfulPaintEvent"), navigationStartTick_(navigationStartTick), 1366 firstContentfulPaintMs_(firstContentfulPaintMs) 1367 {} 1368 1369 ~FirstContentfulPaintEvent() = default; 1370 GetNavigationStartTick()1371 int64_t GetNavigationStartTick() const 1372 { 1373 return navigationStartTick_; 1374 } 1375 GetFirstContentfulPaintMs()1376 int64_t GetFirstContentfulPaintMs() const 1377 { 1378 return firstContentfulPaintMs_; 1379 } 1380 1381 private: 1382 int64_t navigationStartTick_; 1383 int64_t firstContentfulPaintMs_; 1384 }; 1385 1386 class ACE_EXPORT WebOnOverScrollEvent : public BaseEventInfo { 1387 DECLARE_RELATIONSHIP_OF_CLASSES(WebOnOverScrollEvent, BaseEventInfo); 1388 1389 public: WebOnOverScrollEvent(double xOffset,double yOffset)1390 WebOnOverScrollEvent(double xOffset, double yOffset) 1391 : BaseEventInfo("OnOverScrollEvent"), xOffset_(xOffset), yOffset_(yOffset) 1392 {} 1393 ~WebOnOverScrollEvent() = default; 1394 GetX()1395 float GetX() const 1396 { 1397 return xOffset_; 1398 } 1399 GetY()1400 float GetY() const 1401 { 1402 return yOffset_; 1403 } 1404 1405 private: 1406 float xOffset_ = 0.0f; 1407 float yOffset_ = 0.0f; 1408 }; 1409 } // namespace OHOS::Ace 1410 1411 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_WEB_WEB_EVENT_H 1412