• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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) {}
WebSslErrorEvent(const RefPtr<SslErrorResult> & result,int32_t error,const std::vector<std::string> & certChainData)518     WebSslErrorEvent(const RefPtr<SslErrorResult>& result, int32_t error,
519         const std::vector<std::string>& certChainData)
520         : BaseEventInfo("WebSslErrorEvent"), result_(result), error_(error),
521         certChainData_(certChainData) {}
522     ~WebSslErrorEvent() = default;
523 
GetResult()524     const RefPtr<SslErrorResult>& GetResult() const
525     {
526         return result_;
527     }
528 
GetError()529     int32_t GetError() const
530     {
531         return error_;
532     }
533 
GetCertChainData()534     const std::vector<std::string>& GetCertChainData() const
535     {
536         return certChainData_;
537     }
538 
539 private:
540     RefPtr<SslErrorResult> result_;
541     int32_t error_;
542     std::vector<std::string> certChainData_;
543 };
544 
545 class ACE_EXPORT AllSslErrorResult : public AceType {
546     DECLARE_ACE_TYPE(AllSslErrorResult, AceType)
547 
548 public:
549     AllSslErrorResult() = default;
550     ~AllSslErrorResult() = default;
551     virtual void HandleConfirm() = 0;
552     virtual void HandleCancel() = 0;
553 };
554 
555 class ACE_EXPORT WebAllSslErrorEvent : public BaseEventInfo {
556     DECLARE_RELATIONSHIP_OF_CLASSES(WebAllSslErrorEvent, BaseEventInfo);
557 
558 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)559     WebAllSslErrorEvent(const RefPtr<AllSslErrorResult>& result,
560                         int32_t error,
561                         const std::string& url,
562                         const std::string& originalUrl,
563                         const std::string& referrer,
564                         bool isFatalError,
565                         bool isMainFrame
566     )
567         : BaseEventInfo("WebAllSslErrorEvent"), result_(result),
568                                                 error_(error),
569                                                 url_(url),
570                                                 originalUrl_(originalUrl),
571                                                 referrer_(referrer),
572                                                 isFatalError_(isFatalError),
573                                                 isMainFrame_(isMainFrame) {}
574     ~WebAllSslErrorEvent() = default;
575 
GetResult()576     const RefPtr<AllSslErrorResult>& GetResult() const
577     {
578         return result_;
579     }
580 
GetError()581     int32_t GetError() const
582     {
583         return error_;
584     }
585 
GetUrl()586     std::string GetUrl() const
587     {
588         return url_;
589     }
590 
GetOriginalUrl()591     std::string GetOriginalUrl() const
592     {
593         return originalUrl_;
594     }
595 
GetReferrer()596     std::string GetReferrer() const
597     {
598         return referrer_;
599     }
600 
GetIsFatalError()601     bool GetIsFatalError() const
602     {
603         return isFatalError_;
604     }
605 
GetIsMainFrame()606     bool GetIsMainFrame() const
607     {
608         return isMainFrame_;
609     }
610 
611 private:
612     RefPtr<AllSslErrorResult> result_;
613     int32_t error_;
614     const std::string& url_;
615     const std::string& originalUrl_;
616     const std::string& referrer_;
617     bool isFatalError_;
618     bool isMainFrame_;
619 };
620 
621 class ACE_EXPORT SslSelectCertResult : public AceType {
622     DECLARE_ACE_TYPE(SslSelectCertResult, AceType)
623 public:
624     SslSelectCertResult() = default;
625     ~SslSelectCertResult() = default;
626 
627     virtual void HandleConfirm(const std::string& privateKeyFile, const std::string& certChainFile) = 0;
628     virtual void HandleCancel() = 0;
629     virtual void HandleIgnore() = 0;
630 };
631 
632 class ACE_EXPORT WebSslSelectCertEvent : public BaseEventInfo {
633     DECLARE_RELATIONSHIP_OF_CLASSES(WebSslSelectCertEvent, BaseEventInfo);
634 
635 public:
WebSslSelectCertEvent(const RefPtr<SslSelectCertResult> & result,const std::string & host,int port,const std::vector<std::string> & keyTypes,const std::vector<std::string> & issuers)636     WebSslSelectCertEvent(const RefPtr<SslSelectCertResult>& result,
637         const std::string& host, int port,
638         const std::vector<std::string>& keyTypes,
639         const std::vector<std::string>& issuers)
640         : BaseEventInfo("WebSslSelectCertEvent"),
641         result_(result), host_(host), port_(port), keyTypes_(keyTypes), issuers_(issuers) {}
642 
643     ~WebSslSelectCertEvent() = default;
644 
GetResult()645     const RefPtr<SslSelectCertResult>& GetResult() const
646     {
647         return result_;
648     }
649 
GetHost()650     const std::string& GetHost() const
651     {
652         return host_;
653     }
654 
GetPort()655     int32_t GetPort() const
656     {
657         return port_;
658     }
659 
GetKeyTypes()660     const std::vector<std::string>& GetKeyTypes() const
661     {
662         return keyTypes_;
663     }
664 
GetIssuers_()665     const std::vector<std::string>& GetIssuers_() const
666     {
667         return issuers_;
668     }
669 
670 private:
671     RefPtr<SslSelectCertResult> result_;
672     std::string host_;
673     int32_t port_ = -1;
674     std::vector<std::string> keyTypes_;
675     std::vector<std::string> issuers_;
676 };
677 
678 class ACE_EXPORT WebGeolocation : public AceType {
679     DECLARE_ACE_TYPE(WebGeolocation, AceType)
680 
681 public:
682     WebGeolocation() = default;
683     ~WebGeolocation() = default;
684 
685     virtual void Invoke(const std::string& origin, const bool& allow, const bool& retain) = 0;
686 };
687 
688 class ACE_EXPORT WebPermissionRequest : public AceType {
689     DECLARE_ACE_TYPE(WebPermissionRequest, AceType)
690 
691 public:
692     WebPermissionRequest() = default;
693     ~WebPermissionRequest() = default;
694 
695     virtual void Deny() const = 0;
696 
697     virtual std::string GetOrigin() const = 0;
698 
699     virtual std::vector<std::string> GetResources() const = 0;
700 
701     virtual void Grant(std::vector<std::string>& resources) const = 0;
702 };
703 
704 class ACE_EXPORT WebScreenCaptureRequest : public AceType {
705     DECLARE_ACE_TYPE(WebScreenCaptureRequest, AceType)
706 
707 public:
708     WebScreenCaptureRequest() = default;
709     ~WebScreenCaptureRequest() = default;
710 
711     virtual void Deny() const = 0;
712 
713     virtual std::string GetOrigin() const = 0;
714 
715     virtual void SetCaptureMode(int32_t mode) = 0;
716 
717     virtual void SetSourceId(int32_t sourceId) = 0;
718 
719     virtual void Grant() const = 0;
720 };
721 
722 class ACE_EXPORT WebWindowNewHandler : public AceType {
723     DECLARE_ACE_TYPE(WebWindowNewHandler, AceType)
724 
725 public:
726     WebWindowNewHandler() = default;
727     ~WebWindowNewHandler() = default;
728 
729     virtual void SetWebController(int32_t id) = 0;
730 
731     virtual bool IsFrist() const = 0;
732 
733     virtual int32_t GetId() const = 0;
734 
735     virtual int32_t GetParentNWebId() const = 0;
736 };
737 
738 class ACE_EXPORT WebAppLinkCallback : public AceType {
739     DECLARE_ACE_TYPE(WebAppLinkCallback, AceType)
740 
741 public:
742     WebAppLinkCallback() = default;
743     ~WebAppLinkCallback() = default;
744 
745     virtual void ContinueLoad() = 0;
746     virtual void CancelLoad() = 0;
747 };
748 
749 class ACE_EXPORT WebCustomKeyboardHandler : public AceType {
750     DECLARE_ACE_TYPE(WebCustomKeyboardHandler, AceType)
751 
752 public:
753     WebCustomKeyboardHandler() = default;
754     ~WebCustomKeyboardHandler() = default;
755 
756     virtual void InsertText(const std::string &text) = 0;
757     virtual void DeleteForward(int32_t length) = 0;
758     virtual void DeleteBackward(int32_t length) = 0;
759     virtual void SendFunctionKey(int32_t key) = 0;
760     virtual void Close() = 0;
761 };
762 
763 class ACE_EXPORT LoadWebPageStartEvent : public BaseEventInfo {
764     DECLARE_RELATIONSHIP_OF_CLASSES(LoadWebPageStartEvent, BaseEventInfo);
765 
766 public:
LoadWebPageStartEvent(const std::string & url)767     explicit LoadWebPageStartEvent(const std::string& url) : BaseEventInfo("LoadWebPageStartEvent"), loadedUrl_(url) {}
768     ~LoadWebPageStartEvent() = default;
769 
GetLoadedUrl()770     const std::string& GetLoadedUrl() const
771     {
772         return loadedUrl_;
773     }
774 
775 private:
776     std::string loadedUrl_;
777 };
778 
779 class ACE_EXPORT LoadWebPageFinishEvent : public BaseEventInfo {
780     DECLARE_RELATIONSHIP_OF_CLASSES(LoadWebPageFinishEvent, BaseEventInfo);
781 
782 public:
LoadWebPageFinishEvent(const std::string & url)783     explicit LoadWebPageFinishEvent(const std::string& url) : BaseEventInfo("LoadWebPageFinishEvent"), loadedUrl_(url)
784     {}
785     ~LoadWebPageFinishEvent() = default;
786 
GetLoadedUrl()787     const std::string& GetLoadedUrl() const
788     {
789         return loadedUrl_;
790     }
791 
792 private:
793     std::string loadedUrl_;
794 };
795 
796 class ACE_EXPORT ContextMenuHideEvent : public BaseEventInfo {
797     DECLARE_RELATIONSHIP_OF_CLASSES(ContextMenuHideEvent, BaseEventInfo);
798 
799 public:
ContextMenuHideEvent(const std::string & info)800     explicit ContextMenuHideEvent(const std::string& info) : BaseEventInfo("ContextMenuHideEvent"), info_(info)
801     {}
802     ~ContextMenuHideEvent() = default;
803 
GetInfo()804     const std::string& GetInfo() const
805     {
806         return info_;
807     }
808 
809 private:
810     std::string info_;
811 };
812 
813 class ACE_EXPORT LoadWebProgressChangeEvent : public BaseEventInfo {
814     DECLARE_RELATIONSHIP_OF_CLASSES(LoadWebProgressChangeEvent, BaseEventInfo);
815 
816 public:
LoadWebProgressChangeEvent(const int & newProgress)817     explicit LoadWebProgressChangeEvent(const int& newProgress)
818         : BaseEventInfo("LoadWebProgressChangeEvent"), newProgress_(newProgress)
819     {}
820     ~LoadWebProgressChangeEvent() = default;
821 
GetNewProgress()822     const int& GetNewProgress() const
823     {
824         return newProgress_;
825     }
826 
827 private:
828     int newProgress_;
829 };
830 
831 class ACE_EXPORT LoadWebTitleReceiveEvent : public BaseEventInfo {
832     DECLARE_RELATIONSHIP_OF_CLASSES(LoadWebTitleReceiveEvent, BaseEventInfo);
833 
834 public:
LoadWebTitleReceiveEvent(const std::string & title)835     explicit LoadWebTitleReceiveEvent(const std::string& title)
836         : BaseEventInfo("LoadWebTitleReceiveEvent"), title_(title)
837     {}
838     ~LoadWebTitleReceiveEvent() = default;
839 
GetTitle()840     const std::string& GetTitle() const
841     {
842         return title_;
843     }
844 
845 private:
846     std::string title_;
847 };
848 
849 class ACE_EXPORT FullScreenExitHandler : public AceType {
850     DECLARE_ACE_TYPE(FullScreenExitHandler, AceType)
851 
852 public:
853     FullScreenExitHandler() = default;
854     ~FullScreenExitHandler() = default;
855 
856     virtual void ExitFullScreen() = 0;
857 };
858 
859 class ACE_EXPORT FullScreenEnterEvent : public BaseEventInfo {
860     DECLARE_RELATIONSHIP_OF_CLASSES(FullScreenEnterEvent, BaseEventInfo);
861 
862 public:
FullScreenEnterEvent(const RefPtr<FullScreenExitHandler> & handler,int videoNaturalWidth,int videoNaturalHeight)863     FullScreenEnterEvent(
864         const RefPtr<FullScreenExitHandler>& handler, int videoNaturalWidth, int videoNaturalHeight)
865         : BaseEventInfo("FullScreenEnterEvent"), handler_(handler), videoNaturalWidth_(videoNaturalWidth),
866           videoNaturalHeight_(videoNaturalHeight)
867     {}
868     ~FullScreenEnterEvent() = default;
869 
GetHandler()870     const RefPtr<FullScreenExitHandler>& GetHandler() const
871     {
872         return handler_;
873     }
874 
GetVideoNaturalWidth()875     int GetVideoNaturalWidth() const
876     {
877         return videoNaturalWidth_;
878     }
879 
GetVideoNaturalHeight()880     int GetVideoNaturalHeight() const
881     {
882         return videoNaturalHeight_;
883     }
884 
885 private:
886     RefPtr<FullScreenExitHandler> handler_;
887     int videoNaturalWidth_;
888     int videoNaturalHeight_;
889 };
890 
891 class ACE_EXPORT FullScreenExitEvent : public BaseEventInfo {
892     DECLARE_RELATIONSHIP_OF_CLASSES(FullScreenExitEvent, BaseEventInfo);
893 
894 public:
895     explicit FullScreenExitEvent(bool fullscreen = false)
896         : BaseEventInfo("FullScreenExitEvent"), fullscreen_(fullscreen) {}
897     ~FullScreenExitEvent() = default;
898 
IsFullScreen()899     bool IsFullScreen() const
900     {
901         return fullscreen_;
902     }
903 
904 private:
905     bool fullscreen_ = false;
906 };
907 
908 class ACE_EXPORT UrlLoadInterceptEvent : public BaseEventInfo {
909     DECLARE_RELATIONSHIP_OF_CLASSES(UrlLoadInterceptEvent, BaseEventInfo);
910 
911 public:
UrlLoadInterceptEvent(const std::string & data)912     explicit UrlLoadInterceptEvent(const std::string& data) : BaseEventInfo("UrlLoadInterceptEvent"), data_(data) {}
913     ~UrlLoadInterceptEvent() = default;
914 
GetData()915     const std::string& GetData() const
916     {
917         return data_;
918     }
919 
920 private:
921     std::string data_;
922 };
923 
924 class ACE_EXPORT LoadInterceptEvent : public BaseEventInfo {
925     DECLARE_RELATIONSHIP_OF_CLASSES(LoadInterceptEvent, BaseEventInfo);
926 
927 public:
LoadInterceptEvent(const RefPtr<WebRequest> & request)928     explicit LoadInterceptEvent(const RefPtr<WebRequest>& request) :
929         BaseEventInfo("LoadInterceptEvent"), request_(request) {}
930     ~LoadInterceptEvent() = default;
931 
GetRequest()932     const RefPtr<WebRequest>& GetRequest() const
933     {
934         return request_;
935     }
936 
937 private:
938     RefPtr<WebRequest> request_;
939 };
940 
941 class ACE_EXPORT LoadOverrideEvent : public BaseEventInfo {
942     DECLARE_RELATIONSHIP_OF_CLASSES(LoadOverrideEvent, BaseEventInfo);
943 
944 public:
LoadOverrideEvent(const RefPtr<WebRequest> & request)945     explicit LoadOverrideEvent(const RefPtr<WebRequest>& request) :
946         BaseEventInfo("LoadOverrideEvent"), request_(request) {}
947     ~LoadOverrideEvent() = default;
948 
GetRequest()949     const RefPtr<WebRequest>& GetRequest() const
950     {
951         return request_;
952     }
953 
954 private:
955     RefPtr<WebRequest> request_;
956 };
957 
958 class ACE_EXPORT InterceptKeyboardEvent : public BaseEventInfo {
959     DECLARE_RELATIONSHIP_OF_CLASSES(InterceptKeyboardEvent, BaseEventInfo);
960 
961 public:
InterceptKeyboardEvent(const RefPtr<WebCustomKeyboardHandler> & customKeyboardHandler,const std::map<std::string,std::string> attributes)962     explicit InterceptKeyboardEvent(const RefPtr<WebCustomKeyboardHandler>& customKeyboardHandler,
963         const std::map<std::string, std::string> attributes) :
964         BaseEventInfo("InterceptKeyboardEvent"),
965         customKeyboardHandler_(customKeyboardHandler),
966         attributes_(attributes) {}
967     ~InterceptKeyboardEvent() = default;
968 
GetCustomKeyboardHandler()969     const RefPtr<WebCustomKeyboardHandler>& GetCustomKeyboardHandler() const
970     {
971         return customKeyboardHandler_;
972     }
973 
GetAttributesMap()974     const std::map<std::string, std::string>& GetAttributesMap() const
975     {
976         return attributes_;
977     }
978 
979 private:
980     RefPtr<WebCustomKeyboardHandler> customKeyboardHandler_;
981     std::map<std::string, std::string> attributes_;
982 };
983 
984 class ACE_EXPORT WebAppLinkEvent : public BaseEventInfo {
985     DECLARE_RELATIONSHIP_OF_CLASSES(WebAppLinkEvent, BaseEventInfo);
986 
987 public:
WebAppLinkEvent(const std::string & url,const RefPtr<WebAppLinkCallback> & callback)988     explicit WebAppLinkEvent(
989         const std::string& url,
990         const RefPtr<WebAppLinkCallback>& callback) :
991         BaseEventInfo("WebAppLinkEvent"), url_(url), callback_(callback) {}
992     ~WebAppLinkEvent() = default;
993 
GetCallback()994     const RefPtr<WebAppLinkCallback>& GetCallback() const
995     {
996         return callback_;
997     }
998 
GetUrl()999     const std::string& GetUrl() const
1000     {
1001         return url_;
1002     }
1003 
1004 private:
1005     std::string url_;
1006     RefPtr<WebAppLinkCallback> callback_;
1007 };
1008 
1009 class ACE_EXPORT LoadWebGeolocationHideEvent : public BaseEventInfo {
1010     DECLARE_RELATIONSHIP_OF_CLASSES(LoadWebGeolocationHideEvent, BaseEventInfo);
1011 
1012 public:
LoadWebGeolocationHideEvent(const std::string & origin)1013     explicit LoadWebGeolocationHideEvent(const std::string& origin)
1014         : BaseEventInfo("LoadWebGeolocationHideEvent"), origin_(origin)
1015     {}
1016     ~LoadWebGeolocationHideEvent() = default;
1017 
GetOrigin()1018     const std::string& GetOrigin() const
1019     {
1020         return origin_;
1021     }
1022 
1023 private:
1024     std::string origin_;
1025 };
1026 
1027 class ACE_EXPORT LoadWebGeolocationShowEvent : public BaseEventInfo {
1028     DECLARE_RELATIONSHIP_OF_CLASSES(LoadWebGeolocationShowEvent, BaseEventInfo);
1029 
1030 public:
LoadWebGeolocationShowEvent(const std::string & origin,const RefPtr<WebGeolocation> & webGeolocation)1031     LoadWebGeolocationShowEvent(const std::string& origin, const RefPtr<WebGeolocation>& webGeolocation)
1032         : BaseEventInfo("LoadWebGeolocationShowEvent"), origin_(origin), webGeolocation_(webGeolocation)
1033     {}
1034     ~LoadWebGeolocationShowEvent() = default;
1035 
GetOrigin()1036     const std::string& GetOrigin() const
1037     {
1038         return origin_;
1039     }
1040 
GetWebGeolocation()1041     const RefPtr<WebGeolocation>& GetWebGeolocation() const
1042     {
1043         return webGeolocation_;
1044     }
1045 
1046 private:
1047     std::string origin_;
1048     RefPtr<WebGeolocation> webGeolocation_;
1049 };
1050 
1051 class ACE_EXPORT WebPermissionRequestEvent : public BaseEventInfo {
1052     DECLARE_RELATIONSHIP_OF_CLASSES(WebPermissionRequestEvent, BaseEventInfo);
1053 
1054 public:
WebPermissionRequestEvent(const RefPtr<WebPermissionRequest> & webPermissionRequest)1055     WebPermissionRequestEvent(const RefPtr<WebPermissionRequest>& webPermissionRequest)
1056         : BaseEventInfo("WebPermissionRequestEvent"), webPermissionRequest_(webPermissionRequest)
1057     {}
1058     ~WebPermissionRequestEvent() = default;
1059 
GetWebPermissionRequest()1060     const RefPtr<WebPermissionRequest>& GetWebPermissionRequest() const
1061     {
1062         return webPermissionRequest_;
1063     }
1064 
1065 private:
1066     RefPtr<WebPermissionRequest> webPermissionRequest_;
1067 };
1068 
1069 class ACE_EXPORT WebScreenCaptureRequestEvent : public BaseEventInfo {
1070     DECLARE_RELATIONSHIP_OF_CLASSES(WebScreenCaptureRequestEvent, BaseEventInfo);
1071 
1072 public:
WebScreenCaptureRequestEvent(const RefPtr<WebScreenCaptureRequest> & request)1073     WebScreenCaptureRequestEvent(const RefPtr<WebScreenCaptureRequest>& request)
1074         : BaseEventInfo("WebScreenCaptureRequestEvent"), request_(request)
1075     {}
1076     ~WebScreenCaptureRequestEvent() = default;
1077 
GetWebScreenCaptureRequest()1078     const RefPtr<WebScreenCaptureRequest>& GetWebScreenCaptureRequest() const
1079     {
1080         return request_;
1081     }
1082 
1083 private:
1084     RefPtr<WebScreenCaptureRequest> request_;
1085 };
1086 
1087 class ACE_EXPORT DownloadStartEvent : public BaseEventInfo {
1088     DECLARE_RELATIONSHIP_OF_CLASSES(DownloadStartEvent, BaseEventInfo);
1089 
1090 public:
DownloadStartEvent(const std::string & url,const std::string & userAgent,const std::string & contentDisposition,const std::string & mimetype,long contentLength)1091     DownloadStartEvent(const std::string& url, const std::string& userAgent, const std::string& contentDisposition,
1092         const std::string& mimetype, long contentLength)
1093         : BaseEventInfo("DownloadStartEvent"), url_(url), userAgent_(userAgent),
1094           contentDisposition_(contentDisposition), mimetype_(mimetype), contentLength_(contentLength)
1095     {}
1096     ~DownloadStartEvent() = default;
1097 
GetUrl()1098     const std::string& GetUrl() const
1099     {
1100         return url_;
1101     }
1102 
GetUserAgent()1103     const std::string& GetUserAgent() const
1104     {
1105         return userAgent_;
1106     }
1107 
GetContentDisposition()1108     const std::string& GetContentDisposition() const
1109     {
1110         return contentDisposition_;
1111     }
1112 
GetMimetype()1113     const std::string& GetMimetype() const
1114     {
1115         return mimetype_;
1116     }
1117 
GetContentLength()1118     long GetContentLength() const
1119     {
1120         return contentLength_;
1121     }
1122 
1123 private:
1124     std::string url_;
1125     std::string userAgent_;
1126     std::string contentDisposition_;
1127     std::string mimetype_;
1128     long contentLength_;
1129 };
1130 
1131 class ACE_EXPORT ReceivedErrorEvent : public BaseEventInfo {
1132     DECLARE_RELATIONSHIP_OF_CLASSES(ReceivedErrorEvent, BaseEventInfo);
1133 
1134 public:
ReceivedErrorEvent(const RefPtr<WebRequest> & request,const RefPtr<WebError> & error)1135     ReceivedErrorEvent(const RefPtr<WebRequest>& request, const RefPtr<WebError>& error)
1136         : BaseEventInfo("ReceivedErrorEvent"), request_(request), error_(error) {}
1137     ~ReceivedErrorEvent() = default;
1138 
GetRequest()1139     const RefPtr<WebRequest>& GetRequest() const
1140     {
1141         return request_;
1142     }
1143 
GetError()1144     const RefPtr<WebError>& GetError() const
1145     {
1146         return error_;
1147     }
1148 
1149 private:
1150     RefPtr<WebRequest> request_;
1151     RefPtr<WebError> error_;
1152 };
1153 
1154 class ACE_EXPORT ReceivedHttpErrorEvent : public BaseEventInfo {
1155     DECLARE_RELATIONSHIP_OF_CLASSES(ReceivedHttpErrorEvent, BaseEventInfo);
1156 
1157 public:
ReceivedHttpErrorEvent(const RefPtr<WebRequest> & request,const RefPtr<WebResponse> & response)1158     ReceivedHttpErrorEvent(const RefPtr<WebRequest>& request, const RefPtr<WebResponse>& response)
1159         : BaseEventInfo("ReceivedHttpErrorEvent"), request_(request), response_(response) {}
1160     ~ReceivedHttpErrorEvent() = default;
1161 
GetRequest()1162     const RefPtr<WebRequest>& GetRequest() const
1163     {
1164         return request_;
1165     }
1166 
GetResponse()1167     const RefPtr<WebResponse>& GetResponse() const
1168     {
1169         return response_;
1170     }
1171 
1172 private:
1173     RefPtr<WebRequest> request_;
1174     RefPtr<WebResponse> response_;
1175 };
1176 
1177 class ACE_EXPORT OnInterceptRequestEvent : public BaseEventInfo {
1178     DECLARE_RELATIONSHIP_OF_CLASSES(OnInterceptRequestEvent, BaseEventInfo);
1179 
1180 public:
OnInterceptRequestEvent(const RefPtr<WebRequest> & request)1181     OnInterceptRequestEvent(const RefPtr<WebRequest>& request)
1182         : BaseEventInfo("OnInterceptRequestEvent"), request_(request) {}
1183     ~OnInterceptRequestEvent() = default;
1184 
GetRequest()1185     const RefPtr<WebRequest>& GetRequest() const
1186     {
1187         return request_;
1188     }
1189 
1190 private:
1191     RefPtr<WebRequest> request_;
1192 };
1193 
1194 class ACE_EXPORT LoadWebRequestFocusEvent : public BaseEventInfo {
1195     DECLARE_RELATIONSHIP_OF_CLASSES(LoadWebRequestFocusEvent, BaseEventInfo);
1196 
1197 public:
LoadWebRequestFocusEvent(const std::string & url)1198     explicit LoadWebRequestFocusEvent(const std::string& url)
1199         : BaseEventInfo("LoadWebRequestFocusEvent"), focusUrl_(url)
1200     {}
1201     ~LoadWebRequestFocusEvent() = default;
1202 
GetRequestFocus()1203     const std::string& GetRequestFocus() const
1204     {
1205         return focusUrl_;
1206     }
1207 
1208 private:
1209     std::string focusUrl_;
1210 };
1211 
1212 class ACE_EXPORT LoadWebOnFocusEvent : public BaseEventInfo {
1213     DECLARE_RELATIONSHIP_OF_CLASSES(LoadWebOnFocusEvent, BaseEventInfo);
1214 
1215 public:
LoadWebOnFocusEvent(const std::string & url)1216     explicit LoadWebOnFocusEvent(const std::string& url) : BaseEventInfo("LoadWebOnFocusEvent"), focusUrl_(url) {}
1217     ~LoadWebOnFocusEvent() = default;
1218 
GetOnFocus()1219     const std::string& GetOnFocus() const
1220     {
1221         return focusUrl_;
1222     }
1223 
1224 private:
1225     std::string focusUrl_;
1226 };
1227 
1228 class ACE_EXPORT LoadWebConsoleLogEvent : public BaseEventInfo {
1229     DECLARE_RELATIONSHIP_OF_CLASSES(LoadWebConsoleLogEvent, BaseEventInfo);
1230 
1231 public:
LoadWebConsoleLogEvent(RefPtr<WebConsoleLog> message)1232     LoadWebConsoleLogEvent(RefPtr<WebConsoleLog> message) : BaseEventInfo("LoadWebConsoleLogEvent"), message_(message)
1233     {}
1234     ~LoadWebConsoleLogEvent() = default;
1235 
GetMessage()1236     const RefPtr<WebConsoleLog> GetMessage() const
1237     {
1238         return message_;
1239     }
1240 
1241 private:
1242     RefPtr<WebConsoleLog> message_;
1243 };
1244 
1245 class ACE_EXPORT RenderExitedEvent : public BaseEventInfo {
1246     DECLARE_RELATIONSHIP_OF_CLASSES(RenderExitedEvent, BaseEventInfo);
1247 
1248 public:
RenderExitedEvent(int32_t exitedReason)1249     RenderExitedEvent(int32_t exitedReason) : BaseEventInfo("RenderExitedEvent"), exitedReason_(exitedReason) {}
1250     ~RenderExitedEvent() = default;
1251 
GetExitedReason()1252     int32_t GetExitedReason() const
1253     {
1254         return exitedReason_;
1255     }
1256 
1257 private:
1258     int32_t exitedReason_;
1259 };
1260 
1261 class ACE_EXPORT RefreshAccessedHistoryEvent : public BaseEventInfo {
1262     DECLARE_RELATIONSHIP_OF_CLASSES(RefreshAccessedHistoryEvent, BaseEventInfo);
1263 
1264 public:
RefreshAccessedHistoryEvent(const std::string & url,bool isRefreshed)1265     RefreshAccessedHistoryEvent(const std::string& url, bool isRefreshed)
1266         : BaseEventInfo("RefreshAccessedHistoryEvent"), url_(url), isRefreshed_(isRefreshed)
1267     {}
1268 
1269     ~RefreshAccessedHistoryEvent() = default;
1270 
GetVisitedUrl()1271     const std::string& GetVisitedUrl() const
1272     {
1273         return url_;
1274     }
1275 
IsRefreshed()1276     bool IsRefreshed() const
1277     {
1278         return isRefreshed_;
1279     }
1280 
1281 private:
1282     std::string url_;
1283     bool isRefreshed_;
1284 };
1285 
1286 class ACE_EXPORT FileSelectorEvent : public BaseEventInfo {
1287     DECLARE_RELATIONSHIP_OF_CLASSES(FileSelectorEvent, BaseEventInfo);
1288 
1289 public:
FileSelectorEvent(const RefPtr<WebFileSelectorParam> & param,const RefPtr<FileSelectorResult> & result)1290     FileSelectorEvent(const RefPtr<WebFileSelectorParam>& param, const RefPtr<FileSelectorResult>& result)
1291         : BaseEventInfo("FileSelectorEvent"), param_(param), result_(result) {}
1292     ~FileSelectorEvent() = default;
1293 
GetParam()1294     const RefPtr<WebFileSelectorParam>& GetParam() const
1295     {
1296         return param_;
1297     }
1298 
GetFileSelectorResult()1299     const RefPtr<FileSelectorResult>& GetFileSelectorResult() const
1300     {
1301         return result_;
1302     }
1303 
1304 private:
1305     RefPtr<WebFileSelectorParam> param_;
1306     RefPtr<FileSelectorResult> result_;
1307 };
1308 
1309 class ACE_EXPORT ResourceLoadEvent : public BaseEventInfo {
1310     DECLARE_RELATIONSHIP_OF_CLASSES(ResourceLoadEvent, BaseEventInfo);
1311 
1312 public:
ResourceLoadEvent(const std::string & url)1313     explicit ResourceLoadEvent(const std::string& url) : BaseEventInfo("ResourceLoadEvent"), loadUrl_(url) {}
1314     ~ResourceLoadEvent() = default;
1315 
GetOnResourceLoadUrl()1316     const std::string& GetOnResourceLoadUrl() const
1317     {
1318         return loadUrl_;
1319     }
1320 
1321 private:
1322     std::string loadUrl_;
1323 };
1324 
1325 class ACE_EXPORT ScaleChangeEvent : public BaseEventInfo {
1326     DECLARE_RELATIONSHIP_OF_CLASSES(ScaleChangeEvent, BaseEventInfo);
1327 
1328 public:
ScaleChangeEvent(float oldScale,float newScale)1329     ScaleChangeEvent(float oldScale, float newScale)
1330         : BaseEventInfo("ScaleChangeEvent"), oldScale_(oldScale), newScale_(newScale)
1331     {}
1332     ~ScaleChangeEvent() = default;
1333 
GetOnScaleChangeOldScale()1334     float GetOnScaleChangeOldScale() const
1335     {
1336         return oldScale_;
1337     }
1338 
GetOnScaleChangeNewScale()1339     float GetOnScaleChangeNewScale() const
1340     {
1341         return newScale_;
1342     }
1343 
1344 private:
1345     float oldScale_ = 0.0f;
1346     float newScale_ = 0.0f;
1347 };
1348 
1349 class ACE_EXPORT WebOnScrollEvent : public BaseEventInfo {
1350     DECLARE_RELATIONSHIP_OF_CLASSES(WebOnScrollEvent, BaseEventInfo);
1351 
1352 public:
WebOnScrollEvent(double xOffset,double yOffset)1353     WebOnScrollEvent(double xOffset, double yOffset)
1354         : BaseEventInfo("OnScrollEvent"), xOffset_(xOffset), yOffset_(yOffset)
1355     {}
1356     ~WebOnScrollEvent() = default;
1357 
GetX()1358     float GetX() const
1359     {
1360         return xOffset_;
1361     }
1362 
GetY()1363     float GetY() const
1364     {
1365         return yOffset_;
1366     }
1367 
1368 private:
1369     double xOffset_ = 0.0f;
1370     double yOffset_ = 0.0f;
1371 };
1372 
1373 class WebContextMenuParam : public AceType {
1374     DECLARE_ACE_TYPE(WebContextMenuParam, AceType)
1375 
1376 public:
1377     WebContextMenuParam() = default;
1378     ~WebContextMenuParam() = default;
1379 
1380     virtual int32_t GetXCoord() const = 0;
1381     virtual int32_t GetYCoord() const = 0;
1382     virtual std::string GetLinkUrl() const = 0;
1383     virtual std::string GetUnfilteredLinkUrl() const = 0;
1384     virtual std::string GetSourceUrl() const = 0;
1385     virtual bool HasImageContents() const = 0;
1386     virtual bool IsEditable() const = 0;
1387     virtual int GetEditStateFlags() const = 0;
1388     virtual int GetSourceType() const = 0;
1389     virtual int GetMediaType() const = 0;
1390     virtual int GetInputFieldType() const = 0;
1391     virtual std::string GetSelectionText() const = 0;
GetImageRect(int32_t & x,int32_t & y,int32_t & width,int32_t & height)1392     virtual void GetImageRect(int32_t& x, int32_t& y, int32_t& width, int32_t& height) const {}
1393 };
1394 
1395 class ACE_EXPORT ContextMenuResult : public AceType {
1396     DECLARE_ACE_TYPE(ContextMenuResult, AceType)
1397 
1398 public:
1399     ContextMenuResult() = default;
1400     ~ContextMenuResult() = default;
1401 
1402     virtual void Cancel() const = 0;
1403     virtual void CopyImage() const = 0;
1404     virtual void Copy() const = 0;
1405     virtual void Paste() const = 0;
1406     virtual void Cut() const = 0;
1407     virtual void SelectAll() const = 0;
1408 };
1409 
1410 class ACE_EXPORT ContextMenuEvent : public BaseEventInfo {
1411     DECLARE_RELATIONSHIP_OF_CLASSES(ContextMenuEvent, BaseEventInfo);
1412 
1413 public:
ContextMenuEvent(const RefPtr<WebContextMenuParam> & param,const RefPtr<ContextMenuResult> & result)1414     ContextMenuEvent(const RefPtr<WebContextMenuParam>& param, const RefPtr<ContextMenuResult>& result)
1415         : BaseEventInfo("ContextShowEvent"), param_(param), result_(result) {}
1416     ~ContextMenuEvent() = default;
1417 
GetParam()1418     const RefPtr<WebContextMenuParam>& GetParam() const
1419     {
1420         return param_;
1421     }
1422 
GetContextMenuResult()1423     const RefPtr<ContextMenuResult>& GetContextMenuResult() const
1424     {
1425         return result_;
1426     }
1427 
1428 private:
1429     RefPtr<WebContextMenuParam> param_;
1430     RefPtr<ContextMenuResult> result_;
1431 };
1432 
1433 class ACE_EXPORT SearchResultReceiveEvent : public BaseEventInfo {
1434     DECLARE_RELATIONSHIP_OF_CLASSES(SearchResultReceiveEvent, BaseEventInfo);
1435 
1436 public:
SearchResultReceiveEvent(int activeMatchOrdinal,int numberOfMatches,bool isDoneCounting)1437     SearchResultReceiveEvent(int activeMatchOrdinal, int numberOfMatches, bool isDoneCounting)
1438         : BaseEventInfo("SearchResultReceiveEvent"), activeMatchOrdinal_(activeMatchOrdinal),
1439           numberOfMatches_(numberOfMatches), isDoneCounting_(isDoneCounting)
1440     {}
1441     ~SearchResultReceiveEvent() = default;
1442 
GetActiveMatchOrdinal()1443     int GetActiveMatchOrdinal() const
1444     {
1445         return activeMatchOrdinal_;
1446     }
1447 
GetNumberOfMatches()1448     int GetNumberOfMatches() const
1449     {
1450         return numberOfMatches_;
1451     }
1452 
GetIsDoneCounting()1453     bool GetIsDoneCounting() const
1454     {
1455         return isDoneCounting_;
1456     }
1457 
1458 private:
1459     int activeMatchOrdinal_;
1460     int numberOfMatches_;
1461     bool isDoneCounting_;
1462 };
1463 
1464 class ACE_EXPORT WebWindowNewEvent : public BaseEventInfo {
1465     DECLARE_RELATIONSHIP_OF_CLASSES(WebWindowNewEvent, BaseEventInfo);
1466 
1467 public:
WebWindowNewEvent(const std::string & targetUrl,bool isAlert,bool isUserTrigger,const RefPtr<WebWindowNewHandler> & handler)1468     WebWindowNewEvent(const std::string& targetUrl, bool isAlert, bool isUserTrigger,
1469         const RefPtr<WebWindowNewHandler>& handler)
1470         : BaseEventInfo("WebWindowNewEvent"), targetUrl_(targetUrl), isAlert_(isAlert),
1471           isUserTrigger_(isUserTrigger), handler_(handler) {}
1472     ~WebWindowNewEvent() = default;
1473 
GetTargetUrl()1474     const std::string& GetTargetUrl() const
1475     {
1476         return targetUrl_;
1477     }
1478 
IsAlert()1479     bool IsAlert() const
1480     {
1481         return isAlert_;
1482     }
1483 
IsUserTrigger()1484     bool IsUserTrigger() const
1485     {
1486         return isUserTrigger_;
1487     }
1488 
GetWebWindowNewHandler()1489     const RefPtr<WebWindowNewHandler>& GetWebWindowNewHandler() const
1490     {
1491         return handler_;
1492     }
1493 private:
1494     std::string targetUrl_;
1495     bool isAlert_;
1496     bool isUserTrigger_;
1497     RefPtr<WebWindowNewHandler> handler_;
1498 };
1499 
1500 class ACE_EXPORT WebWindowExitEvent : public BaseEventInfo {
1501     DECLARE_RELATIONSHIP_OF_CLASSES(WebWindowExitEvent, BaseEventInfo);
1502 
1503 public:
WebWindowExitEvent()1504     WebWindowExitEvent() : BaseEventInfo("WebWindowExitEvent") {}
1505     ~WebWindowExitEvent() = default;
1506 };
1507 
1508 class ACE_EXPORT PageVisibleEvent : public BaseEventInfo {
1509     DECLARE_RELATIONSHIP_OF_CLASSES(PageVisibleEvent, BaseEventInfo);
1510 
1511 public:
PageVisibleEvent(const std::string & url)1512     PageVisibleEvent(const std::string& url)
1513         : BaseEventInfo("PageVisibleEvent"), url_(url)
1514     {}
1515 
1516     ~PageVisibleEvent() = default;
1517 
GetUrl()1518     const std::string& GetUrl() const
1519     {
1520         return url_;
1521     }
1522 
1523 private:
1524     std::string url_;
1525 };
1526 
1527 class ACE_EXPORT DataResubmitted : public AceType {
1528     DECLARE_ACE_TYPE(DataResubmitted, AceType)
1529 
1530 public:
1531     DataResubmitted() = default;
1532     ~DataResubmitted() = default;
1533 
1534     virtual void Resend() = 0;
1535     virtual void Cancel() = 0;
1536 };
1537 
1538 class ACE_EXPORT DataResubmittedEvent : public BaseEventInfo {
1539     DECLARE_RELATIONSHIP_OF_CLASSES(DataResubmittedEvent, BaseEventInfo);
1540 
1541 public:
DataResubmittedEvent(const RefPtr<DataResubmitted> & handler)1542     DataResubmittedEvent(const RefPtr<DataResubmitted>& handler)
1543         : BaseEventInfo("DataResubmittedEvent"), handler_(handler) {}
1544     ~DataResubmittedEvent() = default;
1545 
GetHandler()1546     const RefPtr<DataResubmitted>& GetHandler() const
1547     {
1548         return handler_;
1549     }
1550 
1551 private:
1552     RefPtr<DataResubmitted> handler_;
1553 };
1554 
1555 class ACE_EXPORT WebFaviconReceived : public AceType {
1556     DECLARE_ACE_TYPE(WebFaviconReceived, AceType)
1557 
1558 public:
1559     WebFaviconReceived() = default;
1560     ~WebFaviconReceived() = default;
1561 
1562     virtual const void* GetData() = 0;
1563     virtual size_t GetWidth() = 0;
1564     virtual size_t GetHeight() = 0;
1565     virtual int GetColorType() = 0;
1566     virtual int GetAlphaType() = 0;
1567 };
1568 
1569 class ACE_EXPORT FaviconReceivedEvent : public BaseEventInfo {
1570     DECLARE_RELATIONSHIP_OF_CLASSES(FaviconReceivedEvent, BaseEventInfo);
1571 
1572 public:
FaviconReceivedEvent(const RefPtr<WebFaviconReceived> & handler)1573     FaviconReceivedEvent(const RefPtr<WebFaviconReceived>& handler)
1574         : BaseEventInfo("FaviconReceivedEvent"), handler_(handler) {}
1575     ~FaviconReceivedEvent() = default;
1576 
GetHandler()1577     const RefPtr<WebFaviconReceived>& GetHandler() const
1578     {
1579         return handler_;
1580     }
1581 
1582 private:
1583     RefPtr<WebFaviconReceived> handler_;
1584 };
1585 
1586 class ACE_EXPORT TouchIconUrlEvent : public BaseEventInfo {
1587     DECLARE_RELATIONSHIP_OF_CLASSES(TouchIconUrlEvent, BaseEventInfo);
1588 
1589 public:
TouchIconUrlEvent(const std::string & iconUrl,bool precomposed)1590     TouchIconUrlEvent(const std::string& iconUrl, bool precomposed)
1591         : BaseEventInfo("TouchIconUrlEvent"), url_(iconUrl), precomposed_(precomposed)
1592     {}
1593 
1594     ~TouchIconUrlEvent() = default;
1595 
GetUrl()1596     const std::string& GetUrl() const
1597     {
1598         return url_;
1599     }
1600 
GetPreComposed()1601     bool GetPreComposed() const
1602     {
1603         return precomposed_;
1604     }
1605 
1606 private:
1607     std::string url_;
1608     bool precomposed_;
1609 };
1610 
1611 class ACE_EXPORT AudioStateChangedEvent : public BaseEventInfo {
1612     DECLARE_RELATIONSHIP_OF_CLASSES(AudioStateChangedEvent, BaseEventInfo);
1613 
1614 public:
AudioStateChangedEvent(bool playing)1615     AudioStateChangedEvent(bool playing) : BaseEventInfo("AudioStateChangedEvent"), playing_(playing) {}
1616     ~AudioStateChangedEvent() = default;
1617 
IsPlaying()1618     bool IsPlaying() const
1619     {
1620         return playing_;
1621     }
1622 
1623 private:
1624     bool playing_;
1625 };
1626 
1627 class ACE_EXPORT FirstContentfulPaintEvent : public BaseEventInfo {
1628     DECLARE_RELATIONSHIP_OF_CLASSES(FirstContentfulPaintEvent, BaseEventInfo);
1629 
1630 public:
FirstContentfulPaintEvent(int64_t navigationStartTick,int64_t firstContentfulPaintMs)1631     FirstContentfulPaintEvent(int64_t navigationStartTick, int64_t firstContentfulPaintMs)
1632         : BaseEventInfo("FirstContentfulPaintEvent"), navigationStartTick_(navigationStartTick),
1633           firstContentfulPaintMs_(firstContentfulPaintMs)
1634     {}
1635 
1636     ~FirstContentfulPaintEvent() = default;
1637 
GetNavigationStartTick()1638     int64_t GetNavigationStartTick() const
1639     {
1640         return navigationStartTick_;
1641     }
1642 
GetFirstContentfulPaintMs()1643     int64_t GetFirstContentfulPaintMs() const
1644     {
1645         return firstContentfulPaintMs_;
1646     }
1647 
1648 private:
1649     int64_t navigationStartTick_;
1650     int64_t firstContentfulPaintMs_;
1651 };
1652 
1653 class ACE_EXPORT FirstMeaningfulPaintEvent : public BaseEventInfo {
1654     DECLARE_RELATIONSHIP_OF_CLASSES(FirstMeaningfulPaintEvent, BaseEventInfo);
1655 
1656 public:
FirstMeaningfulPaintEvent(int64_t navigationStartTime,int64_t firstMeaningfulPaintTime)1657     FirstMeaningfulPaintEvent(int64_t navigationStartTime, int64_t firstMeaningfulPaintTime)
1658         : BaseEventInfo("FirstMeaningfulPaintEvent"), navigationStartTime_(navigationStartTime),
1659           firstMeaningfulPaintTime_(firstMeaningfulPaintTime)
1660     {}
1661 
1662     ~FirstMeaningfulPaintEvent() = default;
1663 
GetNavigationStartTime()1664     int64_t GetNavigationStartTime() const
1665     {
1666         return navigationStartTime_;
1667     }
1668 
GetFirstMeaningfulPaintTime()1669     int64_t GetFirstMeaningfulPaintTime() const
1670     {
1671         return firstMeaningfulPaintTime_;
1672     }
1673 
1674 private:
1675     int64_t navigationStartTime_;
1676     int64_t firstMeaningfulPaintTime_;
1677 };
1678 
1679 class ACE_EXPORT LargestContentfulPaintEvent : public BaseEventInfo {
1680     DECLARE_RELATIONSHIP_OF_CLASSES(LargestContentfulPaintEvent, BaseEventInfo);
1681 
1682 public:
LargestContentfulPaintEvent(int64_t navigationStartTime,int64_t largestImagePaintTime,int64_t largestTextPaintTime,int64_t largestImageLoadStartTime,int64_t largestImageLoadEndTime,double_t imageBPP)1683     LargestContentfulPaintEvent(int64_t navigationStartTime, int64_t largestImagePaintTime,
1684         int64_t largestTextPaintTime, int64_t largestImageLoadStartTime, int64_t largestImageLoadEndTime,
1685         double_t imageBPP)
1686         : BaseEventInfo("LargestContentfulPaintEvent"), navigationStartTime_(navigationStartTime),
1687           largestImagePaintTime_(largestImagePaintTime), largestTextPaintTime_(largestTextPaintTime),
1688           largestImageLoadStartTime_(largestImageLoadStartTime), largestImageLoadEndTime_(largestImageLoadEndTime),
1689           imageBPP_(imageBPP)
1690     {}
1691 
1692     ~LargestContentfulPaintEvent() = default;
1693 
GetNavigationStartTime()1694     int64_t GetNavigationStartTime() const
1695     {
1696         return navigationStartTime_;
1697     }
1698 
GetLargestImagePaintTime()1699     int64_t GetLargestImagePaintTime() const
1700     {
1701         return largestImagePaintTime_;
1702     }
1703 
GetLargestTextPaintTime()1704     int64_t GetLargestTextPaintTime() const
1705     {
1706         return largestTextPaintTime_;
1707     }
1708 
GetLargestImageLoadStartTime()1709     int64_t GetLargestImageLoadStartTime() const
1710     {
1711         return largestImageLoadStartTime_;
1712     }
1713 
GetLargestImageLoadEndTime()1714     int64_t GetLargestImageLoadEndTime() const
1715     {
1716         return largestImageLoadEndTime_;
1717     }
1718 
GetImageBPP()1719     double_t GetImageBPP() const
1720     {
1721         return imageBPP_;
1722     }
1723 
1724 private:
1725     int64_t navigationStartTime_;
1726     int64_t largestImagePaintTime_;
1727     int64_t largestTextPaintTime_;
1728     int64_t largestImageLoadStartTime_;
1729     int64_t largestImageLoadEndTime_;
1730     double_t imageBPP_;
1731 };
1732 
1733 class ACE_EXPORT SafeBrowsingCheckResultEvent : public BaseEventInfo {
1734     DECLARE_RELATIONSHIP_OF_CLASSES(SafeBrowsingCheckResultEvent, BaseEventInfo);
1735 
1736 public:
SafeBrowsingCheckResultEvent(int threat_type)1737     SafeBrowsingCheckResultEvent(int threat_type)
1738         : BaseEventInfo("SafeBrowsingCheckResultEvent"), threat_type_(threat_type)
1739     {}
1740 
1741     ~SafeBrowsingCheckResultEvent() = default;
1742 
GetThreatType()1743     int GetThreatType() const
1744     {
1745         return threat_type_;
1746     }
1747 
1748 private:
1749     int threat_type_;
1750 };
1751 
1752 class ACE_EXPORT WebOnOverScrollEvent : public BaseEventInfo {
1753     DECLARE_RELATIONSHIP_OF_CLASSES(WebOnOverScrollEvent, BaseEventInfo);
1754 
1755 public:
WebOnOverScrollEvent(double xOffset,double yOffset)1756     WebOnOverScrollEvent(double xOffset, double yOffset)
1757         : BaseEventInfo("OnOverScrollEvent"), xOffset_(xOffset), yOffset_(yOffset)
1758     {}
1759     ~WebOnOverScrollEvent() = default;
1760 
GetX()1761     float GetX() const
1762     {
1763         return xOffset_;
1764     }
1765 
GetY()1766     float GetY() const
1767     {
1768         return yOffset_;
1769     }
1770 
1771 private:
1772     float xOffset_ = 0.0f;
1773     float yOffset_ = 0.0f;
1774 };
1775 
1776 class ACE_EXPORT NavigationEntryCommittedEvent : public BaseEventInfo {
1777     DECLARE_RELATIONSHIP_OF_CLASSES(NavigationEntryCommittedEvent, BaseEventInfo);
1778 
1779 public:
NavigationEntryCommittedEvent(const std::string & url,NavigationType type,bool isMainFrame,bool isSameDocument,bool didReplaceEntry)1780     NavigationEntryCommittedEvent(const std::string& url, NavigationType type,
1781         bool isMainFrame, bool isSameDocument, bool didReplaceEntry)
1782         : BaseEventInfo("NavigationEntryCommittedEvent"), url_(url), type_(type),
1783           isMainFrame_(isMainFrame), isSameDocument_(isSameDocument),
1784           didReplaceEntry_(didReplaceEntry) {}
1785     ~NavigationEntryCommittedEvent() = default;
1786 
GetUrl()1787     const std::string& GetUrl() const {
1788         return url_;
1789     }
1790 
GetNavigationType()1791     NavigationType GetNavigationType() const {
1792         return type_;
1793     }
1794 
IsMainFrame()1795     bool IsMainFrame() const {
1796         return isMainFrame_;
1797     }
1798 
IsSameDocument()1799     bool IsSameDocument() const {
1800         return isSameDocument_;
1801     }
1802 
DidReplaceEntry()1803     bool DidReplaceEntry() const {
1804         return didReplaceEntry_;
1805     }
1806 
1807 private:
1808     std::string url_;
1809     NavigationType type_ = NavigationType::NAVIGATION_TYPE_UNKNOWN;
1810     bool isMainFrame_ = false;
1811     bool isSameDocument_ = false;
1812     bool didReplaceEntry_ = false;
1813 };
1814 
1815 class ACE_EXPORT IntelligentTrackingPreventionResultEvent : public BaseEventInfo {
1816     DECLARE_RELATIONSHIP_OF_CLASSES(IntelligentTrackingPreventionResultEvent, BaseEventInfo);
1817 
1818 public:
IntelligentTrackingPreventionResultEvent(const std::string & websiteHost,const std::string & trackerHost)1819     IntelligentTrackingPreventionResultEvent(
1820         const std::string& websiteHost, const std::string& trackerHost)
1821         : BaseEventInfo("IntelligentTrackingPreventionResultEvent"),
1822           host_(websiteHost), trackerHost_(trackerHost) {}
1823 
1824     ~IntelligentTrackingPreventionResultEvent() = default;
1825 
GetHost()1826     const std::string& GetHost() const
1827     {
1828         return host_;
1829     }
1830 
GetTrackerHost()1831     const std::string& GetTrackerHost() const
1832     {
1833         return trackerHost_;
1834     }
1835 
1836 private:
1837     std::string host_;
1838     std::string trackerHost_;
1839 };
1840 
1841 struct EmbedInfo final {
1842     std::string id = "";
1843     std::string type = "";
1844     std::string src = "";
1845     std::string url = "";
1846     std::string tag = "";
1847     int32_t width = 0;
1848     int32_t height = 0;
1849     int32_t x = 0;
1850     int32_t y = 0;
1851     std::map<std::string, std::string> params;
1852 };
1853 
1854 class ACE_EXPORT NativeEmbedDataInfo : public BaseEventInfo {
DECLARE_RELATIONSHIP_OF_CLASSES(NativeEmbedDataInfo,BaseEventInfo)1855     DECLARE_RELATIONSHIP_OF_CLASSES(NativeEmbedDataInfo, BaseEventInfo)
1856 
1857 public:
1858     NativeEmbedDataInfo(NativeEmbedStatus status, const std::string& surfaceId,
1859         const std::string& embedId, const EmbedInfo& embedInfo)
1860         : BaseEventInfo("NativeEmbedDataInfo"), status_(status),
1861         surfaceId_(surfaceId), embedId_(embedId), embedInfo_(embedInfo) {}
1862     ~NativeEmbedDataInfo() = default;
1863 
GetStatus()1864     NativeEmbedStatus GetStatus() const
1865     {
1866         return status_;
1867     }
GetSurfaceId()1868     const std::string& GetSurfaceId() const
1869     {
1870         return surfaceId_;
1871     }
1872 
GetEmbedId()1873     const std::string& GetEmbedId() const
1874     {
1875         return embedId_;
1876     }
1877 
GetEmebdInfo()1878     const EmbedInfo& GetEmebdInfo() const
1879     {
1880         return embedInfo_;
1881     }
1882 
1883 private:
1884     NativeEmbedStatus status_;
1885     std::string surfaceId_ = "";
1886     std::string embedId_ = "";
1887     EmbedInfo embedInfo_;
1888 };
1889 
1890 class ACE_EXPORT NativeEmbedVisibilityInfo : public BaseEventInfo {
DECLARE_RELATIONSHIP_OF_CLASSES(NativeEmbedVisibilityInfo,BaseEventInfo)1891     DECLARE_RELATIONSHIP_OF_CLASSES(NativeEmbedVisibilityInfo, BaseEventInfo)
1892 
1893 public:
1894     NativeEmbedVisibilityInfo(bool visibility, const std::string& embed_id)
1895         : BaseEventInfo("NativeEmbedVisibilityInfo"), visibility_(visibility),
1896         embed_id_(embed_id) {}
1897     ~NativeEmbedVisibilityInfo() = default;
1898 
GetVisibility()1899     bool GetVisibility() const
1900     {
1901         return visibility_;
1902     }
1903 
GetEmbedId()1904     const std::string& GetEmbedId() const
1905     {
1906         return embed_id_;
1907     }
1908 
1909 private:
1910     bool visibility_;
1911     std::string embed_id_ = "";
1912 };
1913 
1914 class ACE_EXPORT RenderProcessNotRespondingEvent : public BaseEventInfo {
1915     DECLARE_RELATIONSHIP_OF_CLASSES(RenderProcessNotRespondingEvent, BaseEventInfo);
1916 
1917 public:
RenderProcessNotRespondingEvent(const std::string & jsStack,int pid,int reason)1918     RenderProcessNotRespondingEvent(const std::string& jsStack, int pid, int reason)
1919         : BaseEventInfo("RenderProcessNotRespondingEvent"), jsStack_(jsStack), pid_(pid), reason_(reason)
1920     {}
1921     ~RenderProcessNotRespondingEvent() = default;
1922 
GetJsStack()1923     const std::string& GetJsStack() const
1924     {
1925         return jsStack_;
1926     }
1927 
GetPid()1928     int GetPid() const
1929     {
1930         return pid_;
1931     }
1932 
GetReason()1933     int GetReason() const
1934     {
1935         return reason_;
1936     }
1937 
1938 private:
1939     std::string jsStack_;
1940     int pid_;
1941     int reason_;
1942 };
1943 
1944 class ACE_EXPORT RenderProcessRespondingEvent : public BaseEventInfo {
1945     DECLARE_RELATIONSHIP_OF_CLASSES(RenderProcessRespondingEvent, BaseEventInfo);
1946 
1947 public:
RenderProcessRespondingEvent()1948     RenderProcessRespondingEvent() : BaseEventInfo("RenderProcessRespondingEvent") {}
1949     ~RenderProcessRespondingEvent() = default;
1950 };
1951 
1952 class ACE_EXPORT ViewportFitChangedEvent : public BaseEventInfo {
1953     DECLARE_RELATIONSHIP_OF_CLASSES(ViewportFitChangedEvent, BaseEventInfo);
1954 
1955 public:
ViewportFitChangedEvent(int32_t viewportFit)1956     ViewportFitChangedEvent(int32_t viewportFit)
1957         : BaseEventInfo("ViewportFitChangedEvent"), viewportFit_(viewportFit) {}
1958     ~ViewportFitChangedEvent() = default;
1959 
GetViewportFit()1960     int32_t GetViewportFit() const
1961     {
1962         return viewportFit_;
1963     }
1964 
1965 private:
1966     int32_t viewportFit_;
1967 };
1968 
1969 class ACE_EXPORT AdsBlockedEvent : public BaseEventInfo {
1970     DECLARE_RELATIONSHIP_OF_CLASSES(AdsBlockedEvent, BaseEventInfo);
1971 
1972 public:
AdsBlockedEvent(const std::string & url,const std::vector<std::string> & adsBlocked)1973     AdsBlockedEvent(const std::string& url, const std::vector<std::string>& adsBlocked) :
1974         BaseEventInfo("AdsBlockedEvent"), url_(url), adsBlocked_(adsBlocked) {}
1975     ~AdsBlockedEvent() = default;
1976 
GetUrl()1977     const std::string& GetUrl() const
1978     {
1979         return url_;
1980     }
1981 
GetAdsBlocked()1982     const std::vector<std::string>& GetAdsBlocked() const
1983     {
1984         return adsBlocked_;
1985     }
1986 
1987 private:
1988     std::string url_;
1989     std::vector<std::string> adsBlocked_;
1990 };
1991 
1992 } // namespace OHOS::Ace
1993 
1994 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_WEB_WEB_EVENT_H
1995