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