• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-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_COMPONENT_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_WEB_WEB_COMPONENT_H
18 
19 #include <string>
20 #include <tuple>
21 #include <utility>
22 
23 #include "base/geometry/size.h"
24 #include "base/log/log.h"
25 #include "base/utils/utils.h"
26 #include "core/components/box/drag_drop_event.h"
27 #include "core/components/declaration/common/declaration.h"
28 #include "core/components/declaration/web/web_client.h"
29 #include "core/components/declaration/web/web_declaration.h"
30 #include "core/components/web/resource/web_javascript_value.h"
31 #include "core/components/web/web_event.h"
32 #include "core/components/web/web_property.h"
33 #include "core/components_v2/common/common_def.h"
34 #include "core/event/key_event.h"
35 #include "core/focus/focus_node.h"
36 #include "core/pipeline/base/element.h"
37 
38 namespace OHOS::Ace {
39 
40 // A component can show HTML5 webpages.
41 class ACE_EXPORT WebComponent : public RenderComponent {
42     DECLARE_ACE_TYPE(WebComponent, RenderComponent);
43 
44 public:
45     using CreatedCallback = std::function<void()>;
46     using ReleasedCallback = std::function<void(bool)>;
47     using ErrorCallback = std::function<void(const std::string&, const std::string&)>;
48     using MethodCall = std::function<void(const std::string&)>;
49     using Method = std::string;
50     using SetWebIdCallback = std::function<void(int32_t)>;
51     using SetHapPathCallback = std::function<void(const std::string&)>;
52     using JsProxyCallback = std::function<void()>;
53     using PreKeyEventCallback = std::function<bool(KeyEventInfo& keyEventInfo)>;
54 
55     WebComponent() = default;
56     explicit WebComponent(const std::string& type);
57     ~WebComponent() override = default;
58 
59     RefPtr<RenderNode> CreateRenderNode() override;
60     RefPtr<Element> CreateElement() override;
61 
SetType(const std::string & type)62     void SetType(const std::string& type)
63     {
64         type_ = type;
65     }
66 
GetType()67     const std::string& GetType() const
68     {
69         return type_;
70     }
71 
SetIncognitoMode(const bool incognitoMode)72     void SetIncognitoMode(const bool incognitoMode)
73     {
74         incognitoMode_ = incognitoMode;
75     }
76 
GetIncognitoMode()77     bool GetIncognitoMode() const
78     {
79         return incognitoMode_;
80     }
81 
SetSrc(const std::string & src)82     void SetSrc(const std::string& src)
83     {
84         CHECK_NULL_VOID(declaration_);
85         declaration_->SetWebSrc(src);
86     }
87 
GetSrc()88     const std::string& GetSrc() const
89     {
90         return declaration_->GetWebSrc();
91     }
92 
SetPopup(bool popup)93     void SetPopup(bool popup)
94     {
95         isPopup_ = popup;
96     }
97 
SetParentNWebId(int32_t parentNWebId)98     void SetParentNWebId(int32_t parentNWebId)
99     {
100         parentNWebId_ = parentNWebId;
101     }
102 
SetSharedRenderProcessToken(const std::string & sharedRenderProcessToken)103     void SetSharedRenderProcessToken(const std::string& sharedRenderProcessToken)
104     {
105         shared_render_process_token_ = sharedRenderProcessToken;
106     }
107 
GetSharedRenderProcessToken()108     const std::string& GetSharedRenderProcessToken() const
109     {
110         return shared_render_process_token_;
111     }
112 
SetData(const std::string & data)113     void SetData(const std::string& data)
114     {
115         CHECK_NULL_VOID(declaration_);
116         declaration_->SetWebData(data);
117     }
118 
GetData()119     const std::string& GetData() const
120     {
121         return declaration_->GetWebData();
122     }
123 
SetPageStartedEventId(const EventMarker & pageStartedEventId)124     void SetPageStartedEventId(const EventMarker& pageStartedEventId)
125     {
126         CHECK_NULL_VOID(declaration_);
127         declaration_->SetPageStartedEventId(pageStartedEventId);
128     }
129 
GetPageStartedEventId()130     const EventMarker& GetPageStartedEventId() const
131     {
132         return declaration_->GetPageStartedEventId();
133     }
134 
SetPageFinishedEventId(const EventMarker & pageFinishedEventId)135     void SetPageFinishedEventId(const EventMarker& pageFinishedEventId)
136     {
137         CHECK_NULL_VOID(declaration_);
138         declaration_->SetPageFinishedEventId(pageFinishedEventId);
139     }
140 
GetPageFinishedEventId()141     const EventMarker& GetPageFinishedEventId() const
142     {
143         return declaration_->GetPageFinishedEventId();
144     }
145 
SetOnLoadStartedEventId(const EventMarker & onLoadStartedEventId)146     void SetOnLoadStartedEventId(const EventMarker& onLoadStartedEventId)
147     {
148         CHECK_NULL_VOID(declaration_);
149         declaration_->SetOnLoadStartedEventId(onLoadStartedEventId);
150     }
151 
GetOnLoadStartedEventId()152     const EventMarker& GetOnLoadStartedEventId() const
153     {
154         return declaration_->GetOnLoadStartedEventId();
155     }
156 
SetOnLoadFinishedEventId(const EventMarker & onLoadFinishedEventId)157     void SetOnLoadFinishedEventId(const EventMarker& onLoadFinishedEventId)
158     {
159         CHECK_NULL_VOID(declaration_);
160         declaration_->SetOnLoadFinishedEventId(onLoadFinishedEventId);
161     }
162 
GetOnLoadFinishedEventId()163     const EventMarker& GetOnLoadFinishedEventId() const
164     {
165         return declaration_->GetOnLoadFinishedEventId();
166     }
167 
168     using OnProgressChangeImpl = std::function<void(const BaseEventInfo* info)>;
OnProgressChange(const BaseEventInfo * info)169     void OnProgressChange(const BaseEventInfo* info) const
170     {
171         if (onProgressChangeImpl_) {
172             onProgressChangeImpl_(info);
173         }
174     }
SetProgressChangeImpl(OnProgressChangeImpl && onProgressChangeImpl)175     void SetProgressChangeImpl(OnProgressChangeImpl&& onProgressChangeImpl)
176     {
177         if (onProgressChangeImpl == nullptr) {
178             return;
179         }
180         onProgressChangeImpl_ = std::move(onProgressChangeImpl);
181     }
182 
SetTitleReceiveEventId(const EventMarker & titleReceiveEventId)183     void SetTitleReceiveEventId(const EventMarker& titleReceiveEventId)
184     {
185         CHECK_NULL_VOID(declaration_);
186         declaration_->SetTitleReceiveEventId(titleReceiveEventId);
187     }
188 
GetTitleReceiveEventId()189     const EventMarker& GetTitleReceiveEventId() const
190     {
191         return declaration_->GetTitleReceiveEventId();
192     }
193 
SetOnFullScreenExitEventId(const EventMarker & fullScreenExitEventId)194     void SetOnFullScreenExitEventId(const EventMarker& fullScreenExitEventId)
195     {
196         CHECK_NULL_VOID(declaration_);
197         declaration_->SetOnFullScreenExitEventId(fullScreenExitEventId);
198     }
199 
GetOnFullScreenExitEventId()200     const EventMarker& GetOnFullScreenExitEventId() const
201     {
202         return declaration_->GetOnFullScreenExitEventId();
203     }
204 
SetGeolocationHideEventId(const EventMarker & geolocationHideEventId)205     void SetGeolocationHideEventId(const EventMarker& geolocationHideEventId)
206     {
207         CHECK_NULL_VOID(declaration_);
208         declaration_->SetGeolocationHideEventId(geolocationHideEventId);
209     }
210 
GetGeolocationHideEventId()211     const EventMarker& GetGeolocationHideEventId() const
212     {
213         return declaration_->GetGeolocationHideEventId();
214     }
215 
SetGeolocationShowEventId(const EventMarker & geolocationShowEventId)216     void SetGeolocationShowEventId(const EventMarker& geolocationShowEventId)
217     {
218         CHECK_NULL_VOID(declaration_);
219         declaration_->SetGeolocationShowEventId(geolocationShowEventId);
220     }
221 
GetGeolocationShowEventId()222     const EventMarker& GetGeolocationShowEventId() const
223     {
224         return declaration_->GetGeolocationShowEventId();
225     }
226 
SetRequestFocusEventId(const EventMarker & requestFocusEventId)227     void SetRequestFocusEventId(const EventMarker& requestFocusEventId)
228     {
229         CHECK_NULL_VOID(declaration_);
230         declaration_->SetRequestFocusEventId(requestFocusEventId);
231     }
232 
GetRequestFocusEventId()233     const EventMarker& GetRequestFocusEventId() const
234     {
235         return declaration_->GetRequestFocusEventId();
236     }
237 
SetDownloadStartEventId(const EventMarker & downloadStartEventId)238     void SetDownloadStartEventId(const EventMarker& downloadStartEventId)
239     {
240         CHECK_NULL_VOID(declaration_);
241         declaration_->SetDownloadStartEventId(downloadStartEventId);
242     }
243 
GetDownloadStartEventId()244     const EventMarker& GetDownloadStartEventId() const
245     {
246         return declaration_->GetDownloadStartEventId();
247     }
248 
SetPageErrorEventId(const EventMarker & pageErrorEventId)249     void SetPageErrorEventId(const EventMarker& pageErrorEventId)
250     {
251         CHECK_NULL_VOID(declaration_);
252         declaration_->SetPageErrorEventId(pageErrorEventId);
253     }
254 
GetPageErrorEventId()255     const EventMarker& GetPageErrorEventId() const
256     {
257         return declaration_->GetPageErrorEventId();
258     }
259 
SetHttpErrorEventId(const EventMarker & httpErrorEventId)260     void SetHttpErrorEventId(const EventMarker& httpErrorEventId)
261     {
262         CHECK_NULL_VOID(declaration_);
263         declaration_->SetHttpErrorEventId(httpErrorEventId);
264     }
265 
GetHttpErrorEventId()266     const EventMarker& GetHttpErrorEventId() const
267     {
268         return declaration_->GetHttpErrorEventId();
269     }
270 
SetMessageEventId(const EventMarker & messageEventId)271     void SetMessageEventId(const EventMarker& messageEventId)
272     {
273         CHECK_NULL_VOID(declaration_);
274         declaration_->SetMessageEventId(messageEventId);
275     }
276 
GetMessageEventId()277     const EventMarker& GetMessageEventId() const
278     {
279         return declaration_->GetMessageEventId();
280     }
281 
SetRenderExitedId(const EventMarker & renderExitedId)282     void SetRenderExitedId(const EventMarker& renderExitedId)
283     {
284         CHECK_NULL_VOID(declaration_);
285         declaration_->SetRenderExitedId(renderExitedId);
286     }
287 
GetRenderExitedId()288     const EventMarker& GetRenderExitedId() const
289     {
290         return declaration_->GetRenderExitedId();
291     }
292 
SetRefreshAccessedHistoryId(const EventMarker & refreshAccessedHistoryId)293     void SetRefreshAccessedHistoryId(const EventMarker& refreshAccessedHistoryId)
294     {
295         CHECK_NULL_VOID(declaration_);
296         declaration_->SetRefreshAccessedHistoryId(refreshAccessedHistoryId);
297     }
298 
GetRefreshAccessedHistoryId()299     const EventMarker& GetRefreshAccessedHistoryId() const
300     {
301         return declaration_->GetRefreshAccessedHistoryId();
302     }
303 
SetResourceLoadId(const EventMarker & resourceLoadId)304     void SetResourceLoadId(const EventMarker& resourceLoadId)
305     {
306         CHECK_NULL_VOID(declaration_);
307         declaration_->SetResourceLoadId(resourceLoadId);
308     }
309 
GetResourceLoadId()310     const EventMarker& GetResourceLoadId() const
311     {
312         return declaration_->GetResourceLoadId();
313     }
314 
SetScaleChangeId(const EventMarker & scaleChangeId)315     void SetScaleChangeId(const EventMarker& scaleChangeId)
316     {
317         CHECK_NULL_VOID(declaration_);
318         declaration_->SetScaleChangeId(scaleChangeId);
319     }
320 
GetScaleChangeId()321     const EventMarker& GetScaleChangeId() const
322     {
323         return declaration_->GetScaleChangeId();
324     }
325 
SetScrollId(const EventMarker & scrollId)326     void SetScrollId(const EventMarker& scrollId)
327     {
328         CHECK_NULL_VOID(declaration_);
329         declaration_->SetScrollId(scrollId);
330     }
331 
GetScrollId()332     const EventMarker& GetScrollId() const
333     {
334         return declaration_->GetScrollId();
335     }
336 
SetPermissionRequestEventId(const EventMarker & permissionRequestEventId)337     void SetPermissionRequestEventId(const EventMarker& permissionRequestEventId)
338     {
339         CHECK_NULL_VOID(declaration_);
340         declaration_->SetPermissionRequestEventId(permissionRequestEventId);
341     }
342 
GetPermissionRequestEventId()343     const EventMarker& GetPermissionRequestEventId() const
344     {
345         return declaration_->GetPermissionRequestEventId();
346     }
347 
348     using OnWindowNewImpl = std::function<void(const std::shared_ptr<BaseEventInfo>& info)>;
SetWindowNewEvent(OnWindowNewImpl && onWindowNewImpl)349     void SetWindowNewEvent(OnWindowNewImpl && onWindowNewImpl)
350     {
351         if (onWindowNewImpl == nullptr) {
352             return;
353         }
354         onWindowNewImpl_ = std::move(onWindowNewImpl);
355     }
356 
OnWindowNewEvent(const std::shared_ptr<BaseEventInfo> & info)357     void OnWindowNewEvent(const std::shared_ptr<BaseEventInfo>& info) const
358     {
359         if (onWindowNewImpl_) {
360             onWindowNewImpl_(info);
361         }
362     }
363 
SetActivateContentEventId(const EventMarker & activateContentEventId)364     void SetActivateContentEventId(const EventMarker& activateContentEventId)
365     {
366         CHECK_NULL_VOID(declaration_);
367         declaration_->SetActivateContentEventId(activateContentEventId);
368     }
369 
GetActivateContentEventId()370     const EventMarker& GetActivateContentEventId() const
371     {
372         return declaration_->GetActivateContentEventId();
373     }
374 
SetWindowExitEventId(const EventMarker & windowExitEventId)375     void SetWindowExitEventId(const EventMarker& windowExitEventId)
376     {
377         CHECK_NULL_VOID(declaration_);
378         declaration_->SetWindowExitEventId(windowExitEventId);
379     }
380 
GetWindowExitEventId()381     const EventMarker& GetWindowExitEventId() const
382     {
383         return declaration_->GetWindowExitEventId();
384     }
385 
SetDeclaration(const RefPtr<WebDeclaration> & declaration)386     void SetDeclaration(const RefPtr<WebDeclaration>& declaration)
387     {
388         if (declaration) {
389             declaration_ = declaration;
390         }
391     }
392 
GetController()393     RefPtr<WebController> GetController() const
394     {
395         return webController_;
396     }
397 
SetWebController(const RefPtr<WebController> & webController)398     void SetWebController(const RefPtr<WebController>& webController)
399     {
400         webController_ = webController;
401     }
402 
SetSetWebIdCallback(SetWebIdCallback && SetIdCallback)403     void SetSetWebIdCallback(SetWebIdCallback&& SetIdCallback)
404     {
405         setWebIdCallback_ = std::move(SetIdCallback);
406     }
407 
GetSetWebIdCallback()408     SetWebIdCallback GetSetWebIdCallback() const
409     {
410         return setWebIdCallback_;
411     }
412 
SetSetHapPathCallback(SetHapPathCallback && callback)413     void SetSetHapPathCallback(SetHapPathCallback&& callback)
414     {
415         setHapPathCallback_ = std::move(callback);
416     }
417 
GetSetHapPathCallback()418     SetHapPathCallback GetSetHapPathCallback() const
419     {
420         return setHapPathCallback_;
421     }
422 
GetJsEnabled()423     bool GetJsEnabled() const
424     {
425         return isJsEnabled_;
426     }
427 
SetJsEnabled(bool isEnabled)428     void SetJsEnabled(bool isEnabled)
429     {
430         isJsEnabled_ = isEnabled;
431     }
432 
GetUserAgent()433     std::string GetUserAgent() const
434     {
435         return userAgent_;
436     }
437 
SetUserAgent(std::string userAgent)438     void SetUserAgent(std::string userAgent)
439     {
440         userAgent_ = std::move(userAgent);
441     }
442 
GetCustomScheme()443     std::string GetCustomScheme() const
444     {
445         return customScheme_;
446     }
447 
SetCustomScheme(std::string cmdLine)448     void SetCustomScheme(std::string cmdLine)
449     {
450         customScheme_ = std::move(cmdLine);
451     }
452 
GetContentAccessEnabled()453     bool GetContentAccessEnabled() const
454     {
455         return isContentAccessEnabled_;
456     }
457 
SetContentAccessEnabled(bool isEnabled)458     void SetContentAccessEnabled(bool isEnabled)
459     {
460         isContentAccessEnabled_ = isEnabled;
461     }
462 
GetFileAccessEnabled()463     bool GetFileAccessEnabled() const
464     {
465         return isFileAccessEnabled_;
466     }
467 
SetFileAccessEnabled(bool isEnabled)468     void SetFileAccessEnabled(bool isEnabled)
469     {
470         isFileAccessEnabled_ = isEnabled;
471     }
GetOnLineImageAccessEnabled()472     bool GetOnLineImageAccessEnabled() const
473     {
474         return isOnLineImageAccessEnabled_;
475     }
476 
SetOnLineImageAccessEnabled(bool isEnabled)477     void SetOnLineImageAccessEnabled(bool isEnabled)
478     {
479         isOnLineImageAccessEnabled_ = isEnabled;
480     }
481 
GetDomStorageAccessEnabled()482     bool GetDomStorageAccessEnabled() const
483     {
484         return isDomStorageAccessEnabled_;
485     }
486 
SetDomStorageAccessEnabled(bool isEnabled)487     void SetDomStorageAccessEnabled(bool isEnabled)
488     {
489         isDomStorageAccessEnabled_ = isEnabled;
490     }
491 
GetImageAccessEnabled()492     bool GetImageAccessEnabled() const
493     {
494         return isImageAccessEnabled_;
495     }
496 
SetImageAccessEnabled(bool isEnabled)497     void SetImageAccessEnabled(bool isEnabled)
498     {
499         isImageAccessEnabled_ = isEnabled;
500     }
501 
GetMixedMode()502     MixedModeContent GetMixedMode() const
503     {
504         return mixedContentMode_;
505     }
506 
SetMixedMode(MixedModeContent mixedModeNum)507     void SetMixedMode(MixedModeContent mixedModeNum)
508     {
509         mixedContentMode_ = mixedModeNum;
510     }
511 
SetBypassVsyncCondition(WebBypassVsyncCondition webBypassVsyncCondition)512     void SetBypassVsyncCondition(WebBypassVsyncCondition webBypassVsyncCondition)
513     {
514         webBypassVsyncCondition_ = webBypassVsyncCondition;
515     }
516 
GetZoomAccessEnabled()517     bool GetZoomAccessEnabled() const
518     {
519         return isZoomAccessEnabled_;
520     }
521 
SetZoomAccessEnabled(bool isEnabled)522     void SetZoomAccessEnabled(bool isEnabled)
523     {
524         isZoomAccessEnabled_ = isEnabled;
525     }
526 
GetGeolocationAccessEnabled()527     bool GetGeolocationAccessEnabled() const
528     {
529         return isGeolocationAccessEnabled_;
530     }
531 
SetGeolocationAccessEnabled(bool isEnabled)532     void SetGeolocationAccessEnabled(bool isEnabled)
533     {
534         isGeolocationAccessEnabled_ = isEnabled;
535     }
536 
GetCacheMode()537     WebCacheMode GetCacheMode()
538     {
539         return cacheMode_;
540     }
541 
SetCacheMode(WebCacheMode mode)542     void SetCacheMode(WebCacheMode mode)
543     {
544         cacheMode_ = mode;
545     }
546 
GetOverScrollMode()547     OverScrollMode GetOverScrollMode() const
548     {
549         return OverScrollMode_;
550     }
551 
SetOverScrollMode(OverScrollMode mode)552     void SetOverScrollMode(OverScrollMode mode)
553     {
554         OverScrollMode_ = mode;
555     }
556 
GetCopyOptionMode()557     CopyOptions GetCopyOptionMode() const
558     {
559         return CopyOptionMode_;
560     }
561 
SetCopyOptionMode(CopyOptions mode)562     void SetCopyOptionMode(CopyOptions mode)
563     {
564         CopyOptionMode_ = mode;
565     }
566 
GetOverviewModeAccessEnabled()567     bool GetOverviewModeAccessEnabled() const
568     {
569         return isOverviewModeAccessEnabled_;
570     }
571 
SetOverviewModeAccessEnabled(bool isEnabled)572     void SetOverviewModeAccessEnabled(bool isEnabled)
573     {
574         isOverviewModeAccessEnabled_ = isEnabled;
575     }
576 
GetFileFromUrlAccessEnabled()577     bool GetFileFromUrlAccessEnabled() const
578     {
579         return isFileFromUrlAccessEnabled_;
580     }
581 
SetFileFromUrlAccessEnabled(bool isEnabled)582     void SetFileFromUrlAccessEnabled(bool isEnabled)
583     {
584         isFileFromUrlAccessEnabled_ = isEnabled;
585     }
586 
GetDatabaseAccessEnabled()587     bool GetDatabaseAccessEnabled() const
588     {
589         return isDatabaseAccessEnabled_;
590     }
591 
SetDatabaseAccessEnabled(bool isEnabled)592     void SetDatabaseAccessEnabled(bool isEnabled)
593     {
594         isDatabaseAccessEnabled_ = isEnabled;
595     }
596 
GetWebDebuggingAccessEnabled()597     bool GetWebDebuggingAccessEnabled() const
598     {
599         return isWebDebuggingAccessEnabled_;
600     }
601 
SetWebDebuggingAccessEnabled(bool isEnabled)602     void SetWebDebuggingAccessEnabled(bool isEnabled)
603     {
604         isWebDebuggingAccessEnabled_ = isEnabled;
605         webDebuggingPort_ = 0;
606     }
607 
GetWebDebuggingAccessEnabledAndPort()608     const std::tuple<bool, int32_t> GetWebDebuggingAccessEnabledAndPort() const
609     {
610         return std::make_tuple(isWebDebuggingAccessEnabled_, webDebuggingPort_);
611     }
612 
SetWebDebuggingAccessEnabledAndPort(bool isEnabled,int32_t port)613     void SetWebDebuggingAccessEnabledAndPort(bool isEnabled, int32_t port)
614     {
615         isWebDebuggingAccessEnabled_ = isEnabled;
616         webDebuggingPort_ = port;
617     }
618 
GetPinchSmoothModeEnabled()619     bool GetPinchSmoothModeEnabled() const
620     {
621         return isPinchSmoothModeEnabled_;
622     }
623 
SetPinchSmoothModeEnabled(bool isEnabled)624     void SetPinchSmoothModeEnabled(bool isEnabled)
625     {
626         isPinchSmoothModeEnabled_ = isEnabled;
627     }
628 
GetMultiWindowAccessEnabled()629     bool GetMultiWindowAccessEnabled() const
630     {
631         return isMultiWindowAccessEnabled_;
632     }
633 
SetMultiWindowAccessEnabled(bool isEnabled)634     void SetMultiWindowAccessEnabled(bool isEnabled)
635     {
636         isMultiWindowAccessEnabled_ = isEnabled;
637     }
638 
GetAllowWindowOpenMethod()639     bool GetAllowWindowOpenMethod() const
640     {
641         return isAllowWindowOpenMethod_;
642     }
643 
SetAllowWindowOpenMethod(bool isEnabled)644     void SetAllowWindowOpenMethod(bool isEnabled)
645     {
646         isAllowWindowOpenMethod_ = isEnabled;
647     }
648 
GetIsInitialScaleSet()649     bool GetIsInitialScaleSet() const
650     {
651         return isInitialScaleSet_;
652     }
653 
GetInitialScale()654     float GetInitialScale() const
655     {
656         return initialScale_;
657     }
658 
SetInitialScale(float scale)659     void SetInitialScale(float scale)
660     {
661         initialScale_ = scale;
662         isInitialScaleSet_ = true;
663     }
664 
GetBackgroundColorEnabled()665     bool GetBackgroundColorEnabled() const
666     {
667         return isBackgroundColor_;
668     }
669 
GetBackgroundColor()670     int32_t GetBackgroundColor() const
671     {
672         return backgroundColor_;
673     }
674 
SetBackgroundColor(int32_t backgroundColor)675     void SetBackgroundColor(int32_t backgroundColor)
676     {
677         backgroundColor_ = backgroundColor;
678         isBackgroundColor_ = true;
679     }
680 
GetTextZoomRatio()681     int32_t GetTextZoomRatio() const
682     {
683         return textZoomRatioNum_;
684     }
685 
SetTextZoomRatio(int32_t ratio)686     void SetTextZoomRatio(int32_t ratio)
687     {
688         textZoomRatioNum_ = ratio;
689     }
690 
SetNativeEmbedModeEnabled(bool isEnabled)691     void SetNativeEmbedModeEnabled(bool isEnabled)
692     {
693         isNativeEmbedMode_ = isEnabled;
694     }
695 
SetIntrinsicSizeEnabled(bool isEnabled)696     void SetIntrinsicSizeEnabled(bool isEnabled)
697     {
698         isIntrinsicSize_ = isEnabled;
699     }
700 
SetCssDisplayChangeEnabled(bool isEnabled)701     void SetCssDisplayChangeEnabled(bool isEnabled)
702     {
703         isCssDisplayChangeEnabled_ = isEnabled;
704     }
705 
GetNativeVideoPlayerConfig()706     const std::tuple<bool, bool>& GetNativeVideoPlayerConfig() const
707     {
708         return native_video_player_config_;
709     }
710 
SetNativeVideoPlayerConfig(bool enable,bool shouldOverlay)711     void SetNativeVideoPlayerConfig(bool enable, bool shouldOverlay)
712     {
713         native_video_player_config_ = std::make_tuple(enable, shouldOverlay);
714     }
715 
RegisterNativeEmbedRule(const std::string & tag,const std::string & type)716     void RegisterNativeEmbedRule(const std::string& tag, const std::string& type)
717     {
718         tag_ = tag;
719         tag_type_ = type;
720     }
721 
722     using OnCommonDialogImpl = std::function<bool(const BaseEventInfo* info)>;
OnCommonDialog(const BaseEventInfo * info,DialogEventType dialogEventType)723     bool OnCommonDialog(const BaseEventInfo* info, DialogEventType dialogEventType) const
724     {
725         if (dialogEventType == DialogEventType::DIALOG_EVENT_ALERT && onAlertImpl_) {
726             return onAlertImpl_(info);
727         }
728         if (dialogEventType == DialogEventType::DIALOG_EVENT_CONFIRM && onConfirmImpl_) {
729             return onConfirmImpl_(info);
730         }
731         if (dialogEventType == DialogEventType::DIALOG_EVENT_PROMPT && onPromptImpl_) {
732             return onPromptImpl_(info);
733         }
734         if (dialogEventType == DialogEventType::DIALOG_EVENT_BEFORE_UNLOAD && onBeforeUnloadImpl_) {
735             return onBeforeUnloadImpl_(info);
736         }
737         return false;
738     }
SetOnCommonDialogImpl(OnCommonDialogImpl && onCommonDialogImpl,DialogEventType dialogEventType)739     void SetOnCommonDialogImpl(OnCommonDialogImpl&& onCommonDialogImpl, DialogEventType dialogEventType)
740     {
741         if (onCommonDialogImpl == nullptr) {
742             return;
743         }
744 
745         switch (dialogEventType) {
746             case DialogEventType::DIALOG_EVENT_ALERT:
747                 onAlertImpl_ = std::move(onCommonDialogImpl);
748                 break;
749             case DialogEventType::DIALOG_EVENT_CONFIRM:
750                 onConfirmImpl_ = std::move(onCommonDialogImpl);
751                 break;
752             case DialogEventType::DIALOG_EVENT_PROMPT:
753                 onPromptImpl_ = std::move(onCommonDialogImpl);
754                 break;
755             case DialogEventType::DIALOG_EVENT_BEFORE_UNLOAD:
756                 onBeforeUnloadImpl_ = std::move(onCommonDialogImpl);
757                 break;
758             default:
759                 break;
760         }
761     }
762 
763     using OnFullScreenEnterImpl = std::function<void(const BaseEventInfo* info)>;
OnFullScreenEnter(const BaseEventInfo * info)764     void OnFullScreenEnter(const BaseEventInfo* info) const
765     {
766         if (onFullScreenEnterImpl_) {
767             onFullScreenEnterImpl_(info);
768         }
769     }
SetOnFullScreenEnterImpl(OnFullScreenEnterImpl && onFullScreenEnterImpl)770     void SetOnFullScreenEnterImpl(OnFullScreenEnterImpl&& onFullScreenEnterImpl)
771     {
772         onFullScreenEnterImpl_ = std::move(onFullScreenEnterImpl);
773     }
774 
775     using OnHttpAuthRequestImpl = std::function<bool(const BaseEventInfo* info)>;
OnHttpAuthRequest(const BaseEventInfo * info)776     bool OnHttpAuthRequest(const BaseEventInfo* info) const
777     {
778         if (onHttpAuthRequestImpl_) {
779             return onHttpAuthRequestImpl_(info);
780         }
781         return false;
782     }
SetOnHttpAuthRequestImpl(OnHttpAuthRequestImpl && onHttpAuthRequestImpl)783     void SetOnHttpAuthRequestImpl(OnHttpAuthRequestImpl&& onHttpAuthRequestImpl)
784     {
785         if (onHttpAuthRequestImpl == nullptr) {
786             return;
787         }
788         onHttpAuthRequestImpl_ = std::move(onHttpAuthRequestImpl);
789     }
790 
791     using OnSslErrorRequestImpl = std::function<bool(const BaseEventInfo* info)>;
OnSslErrorRequest(const BaseEventInfo * info)792     bool OnSslErrorRequest(const BaseEventInfo* info) const
793     {
794         if (onSslErrorRequestImpl_) {
795             return onSslErrorRequestImpl_(info);
796         }
797         return false;
798     }
SetOnSslErrorRequestImpl(OnSslErrorRequestImpl && onSslErrorRequestImpl)799     void SetOnSslErrorRequestImpl(OnSslErrorRequestImpl && onSslErrorRequestImpl)
800     {
801         if (onSslErrorRequestImpl == nullptr) {
802             return;
803         }
804         onSslErrorRequestImpl_ = std::move(onSslErrorRequestImpl);
805     }
806 
807     using OnAllSslErrorRequestImpl = std::function<bool(const BaseEventInfo* info)>;
OnAllSslErrorRequest(const BaseEventInfo * info)808     bool OnAllSslErrorRequest(const BaseEventInfo* info) const
809     {
810         if (onAllSslErrorRequestImpl_) {
811             return onAllSslErrorRequestImpl_(info);
812         }
813         return false;
814     }
815 
SetOnAllSslErrorRequestImpl(OnAllSslErrorRequestImpl && onAllSslErrorRequestImpl)816     void SetOnAllSslErrorRequestImpl(OnAllSslErrorRequestImpl && onAllSslErrorRequestImpl)
817     {
818         if (onAllSslErrorRequestImpl == nullptr) {
819             return;
820         }
821         onAllSslErrorRequestImpl_ = std::move(onAllSslErrorRequestImpl);
822     }
823 
824     using OnSslSelectCertRequestImpl = std::function<bool(const BaseEventInfo* info)>;
OnSslSelectCertRequest(const BaseEventInfo * info)825     bool OnSslSelectCertRequest(const BaseEventInfo* info) const
826     {
827         if (onSslSelectCertRequestImpl_) {
828             return onSslSelectCertRequestImpl_(info);
829         }
830         return false;
831     }
SetOnSslSelectCertRequestImpl(OnSslSelectCertRequestImpl && impl)832     void SetOnSslSelectCertRequestImpl(OnSslSelectCertRequestImpl && impl)
833     {
834         if (!impl) {
835             return;
836         }
837         onSslSelectCertRequestImpl_ = std::move(impl);
838     }
839 
840     bool RequestFocus();
841 
842     using OnConsoleImpl = std::function<bool(const BaseEventInfo* info)>;
OnConsole(const BaseEventInfo * info)843     bool OnConsole(const BaseEventInfo* info) const
844     {
845         if (consoleImpl_) {
846             return consoleImpl_(info);
847         }
848         return false;
849     }
850 
SetOnConsoleImpl(OnConsoleImpl && consoleImpl)851     void SetOnConsoleImpl(OnConsoleImpl&& consoleImpl)
852     {
853         consoleImpl_ = std::move(consoleImpl);
854     }
855 
SetFocusElement(const WeakPtr<FocusNode> & focusElement)856     void SetFocusElement(const WeakPtr<FocusNode>& focusElement)
857     {
858         focusElement_ = focusElement;
859     }
860 
861     using OnFileSelectorShowImpl = std::function<bool(const BaseEventInfo* info)>;
OnFileSelectorShow(const BaseEventInfo * info)862     bool OnFileSelectorShow(const BaseEventInfo* info) const
863     {
864         if (onFileSelectorShowImpl_) {
865             return onFileSelectorShowImpl_(info);
866         }
867         return false;
868     }
SetOnFileSelectorShow(OnFileSelectorShowImpl && onFileSelectorShowImpl)869     void SetOnFileSelectorShow(OnFileSelectorShowImpl&& onFileSelectorShowImpl)
870     {
871         if (onFileSelectorShowImpl == nullptr) {
872             return;
873         }
874 
875         onFileSelectorShowImpl_ = onFileSelectorShowImpl;
876     }
877 
878     using OnContextMenuImpl = std::function<bool(const BaseEventInfo* info)>;
OnContextMenuShow(const BaseEventInfo * info)879     bool OnContextMenuShow(const BaseEventInfo* info) const
880     {
881         if (onContextMenuImpl_) {
882             return onContextMenuImpl_(info);
883         }
884         return false;
885     }
SetOnContextMenuShow(OnContextMenuImpl && onContextMenuImpl)886     void SetOnContextMenuShow(OnContextMenuImpl&& onContextMenuImpl)
887     {
888         if (onContextMenuImpl == nullptr) {
889             return;
890         }
891         onContextMenuImpl_ = std::move(onContextMenuImpl);
892     }
893 
894     using OnContextMenuHideImpl = std::function<void(const BaseEventInfo* info)>;
OnContextMenuHide(const BaseEventInfo * info)895     void OnContextMenuHide(const BaseEventInfo* info) const
896     {
897         if (onContextMenuHideImpl_) {
898             onContextMenuHideImpl_(info);
899         }
900     }
SetOnContextMenuHide(OnContextMenuHideImpl && onContextMenuHideImpl)901     void SetOnContextMenuHide(OnContextMenuHideImpl&& onContextMenuHideImpl)
902     {
903         if (onContextMenuHideImpl == nullptr) {
904             return;
905         }
906         onContextMenuHideImpl_ = std::move(onContextMenuHideImpl);
907     }
908 
909     using OnUrlLoadInterceptImpl = std::function<bool(const BaseEventInfo* info)>;
OnUrlLoadIntercept(const BaseEventInfo * info)910     bool OnUrlLoadIntercept(const BaseEventInfo* info) const
911     {
912         if (onUrlLoadInterceptImpl_) {
913             return onUrlLoadInterceptImpl_(info);
914         }
915         return false;
916     }
SetOnUrlLoadIntercept(OnUrlLoadInterceptImpl && onUrlLoadInterceptImpl)917     void SetOnUrlLoadIntercept(OnUrlLoadInterceptImpl&& onUrlLoadInterceptImpl)
918     {
919         if (onUrlLoadInterceptImpl == nullptr) {
920             return;
921         }
922 
923         onUrlLoadInterceptImpl_ = onUrlLoadInterceptImpl;
924     }
925 
926     using OnLoadInterceptImpl = std::function<bool(const BaseEventInfo* info)>;
OnLoadIntercept(const BaseEventInfo * info)927     bool OnLoadIntercept(const BaseEventInfo* info) const
928     {
929         if (onLoadInterceptImpl_) {
930             return onLoadInterceptImpl_(info);
931         }
932         return false;
933     }
SetOnLoadIntercept(OnLoadInterceptImpl && onLoadInterceptImpl)934     void SetOnLoadIntercept(OnLoadInterceptImpl&& onLoadInterceptImpl)
935     {
936         if (onLoadInterceptImpl == nullptr) {
937             return;
938         }
939 
940         onLoadInterceptImpl_ = onLoadInterceptImpl;
941     }
942 
943     using OnOverrideUrlLoadingImpl = std::function<bool(const BaseEventInfo* info)>;
OnOverrideUrlLoading(const BaseEventInfo * info)944     bool OnOverrideUrlLoading(const BaseEventInfo* info) const
945     {
946         if (onOverrideUrlLoadingImpl_) {
947             return onOverrideUrlLoadingImpl_(info);
948         }
949         return false;
950     }
SetOnOverrideUrlLoading(OnOverrideUrlLoadingImpl && onOverrideUrlLoadingImpl)951     void SetOnOverrideUrlLoading(OnOverrideUrlLoadingImpl&& onOverrideUrlLoadingImpl)
952     {
953         if (onOverrideUrlLoadingImpl == nullptr) {
954             return;
955         }
956 
957         onOverrideUrlLoadingImpl_ = onOverrideUrlLoadingImpl;
958     }
959 
960     using OnInterceptRequestImpl = std::function<RefPtr<WebResponse>(const BaseEventInfo* info)>;
OnInterceptRequest(const BaseEventInfo * info)961     RefPtr<WebResponse> OnInterceptRequest(const BaseEventInfo* info) const
962     {
963         if (onInterceptRequestImpl_) {
964             return onInterceptRequestImpl_(info);
965         }
966         return nullptr;
967     }
968 
IsEmptyOnInterceptRequest()969     bool IsEmptyOnInterceptRequest() const
970     {
971         return onInterceptRequestImpl_ == nullptr;
972     }
973 
SetOnInterceptRequest(OnInterceptRequestImpl && onInterceptRequestImpl)974     void SetOnInterceptRequest(OnInterceptRequestImpl&& onInterceptRequestImpl)
975     {
976         if (onInterceptRequestImpl == nullptr) {
977             return;
978         }
979         onInterceptRequestImpl_ = std::move(onInterceptRequestImpl);
980     }
981 
982     using OnOverrideErrorPageImpl = std::function<std::string(const BaseEventInfo* info)>;
OnOverrideErrorPage(const BaseEventInfo * info)983     std::string OnOverrideErrorPage(const BaseEventInfo* info) const
984     {
985         if (onOverrideErrorPageImpl_) {
986             return onOverrideErrorPageImpl_(info);
987         }
988         return "";
989     }
SetOnOverrideErrorPage(OnOverrideErrorPageImpl && onOverrideErrorPageImpl)990     void SetOnOverrideErrorPage(OnOverrideErrorPageImpl&& onOverrideErrorPageImpl)
991     {
992         if (!onOverrideErrorPageImpl) {
993             return;
994         }
995 
996         onOverrideErrorPageImpl_ = onOverrideErrorPageImpl;
997     }
998 
SetOnMouseEventCallback(const OnMouseCallback & onMouseId)999     void SetOnMouseEventCallback(const OnMouseCallback& onMouseId)
1000     {
1001         onMouseEvent_ = onMouseId;
1002     }
1003 
GetOnMouseEventCallback()1004     OnMouseCallback GetOnMouseEventCallback() const
1005     {
1006         return onMouseEvent_;
1007     }
1008 
SetOnKeyEventCallback(const OnKeyEventCallback & onKeyEventId)1009     void SetOnKeyEventCallback(const OnKeyEventCallback& onKeyEventId)
1010     {
1011         onKeyEvent_ = onKeyEventId;
1012     }
1013 
GetOnKeyEventCallback()1014     OnKeyEventCallback GetOnKeyEventCallback() const
1015     {
1016         return onKeyEvent_;
1017     }
1018 
SetSearchResultReceiveEventId(const EventMarker & searchResultReceiveEventId)1019     void SetSearchResultReceiveEventId(const EventMarker& searchResultReceiveEventId)
1020     {
1021         CHECK_NULL_VOID(declaration_);
1022         declaration_->SetSearchResultReceiveEventId(searchResultReceiveEventId);
1023     }
1024 
GetSearchResultReceiveEventId()1025     const EventMarker& GetSearchResultReceiveEventId() const
1026     {
1027         return declaration_->GetSearchResultReceiveEventId();
1028     }
1029 
SetMediaPlayGestureAccess(bool isNeedGestureAccess)1030     void SetMediaPlayGestureAccess(bool isNeedGestureAccess)
1031     {
1032         isNeedGestureAccess_ = isNeedGestureAccess;
1033     }
1034 
IsMediaPlayGestureAccess()1035     bool IsMediaPlayGestureAccess() const
1036     {
1037         return isNeedGestureAccess_;
1038     }
1039 
GetOnDragStartId()1040     const OnDragFunc& GetOnDragStartId() const
1041     {
1042         return onDragStartId_;
1043     }
1044 
SetOnDragStartId(const OnDragFunc & onDragStartId)1045     void SetOnDragStartId(const OnDragFunc& onDragStartId)
1046     {
1047         onDragStartId_ = onDragStartId;
1048     }
1049 
GetOnDragEnterId()1050     const OnDropFunc& GetOnDragEnterId() const
1051     {
1052         return onDragEnterId_;
1053     }
1054 
SetOnDragEnterId(const OnDropFunc & onDragEnterId)1055     void SetOnDragEnterId(const OnDropFunc& onDragEnterId)
1056     {
1057         onDragEnterId_ = onDragEnterId;
1058     }
1059 
GetOnDragMoveId()1060     const OnDropFunc& GetOnDragMoveId() const
1061     {
1062         return onDragMoveId_;
1063     }
1064 
SetOnDragMoveId(const OnDropFunc & onDragMoveId)1065     void SetOnDragMoveId(const OnDropFunc& onDragMoveId)
1066     {
1067         onDragMoveId_ = onDragMoveId;
1068     }
1069 
GetOnDragLeaveId()1070     const OnDropFunc& GetOnDragLeaveId() const
1071     {
1072         return onDragLeaveId_;
1073     }
1074 
SetOnDragLeaveId(const OnDropFunc & onDragLeaveId)1075     void SetOnDragLeaveId(const OnDropFunc& onDragLeaveId)
1076     {
1077         onDragLeaveId_ = onDragLeaveId;
1078     }
1079 
GetOnDropId()1080     const OnDropFunc& GetOnDropId() const
1081     {
1082         return onDropId_;
1083     }
1084 
SetOnDropId(const OnDropFunc & onDropId)1085     void SetOnDropId(const OnDropFunc& onDropId)
1086     {
1087         onDropId_ = onDropId;
1088     }
1089 
SetJsProxyCallback(JsProxyCallback && jsProxyCallback)1090     void SetJsProxyCallback(JsProxyCallback&& jsProxyCallback)
1091     {
1092         jsProxyCallback_ = std::move(jsProxyCallback);
1093     }
1094 
CallJsProxyCallback()1095     void CallJsProxyCallback()
1096     {
1097         if (jsProxyCallback_) {
1098             jsProxyCallback_();
1099         }
1100     }
1101 
SetOnInterceptKeyEventCallback(const PreKeyEventCallback & onPreKeyEventId)1102     void SetOnInterceptKeyEventCallback(const PreKeyEventCallback& onPreKeyEventId)
1103     {
1104         onPreKeyEvent_ = onPreKeyEventId;
1105     }
1106 
GetOnInterceptKeyEventCallback()1107     PreKeyEventCallback GetOnInterceptKeyEventCallback() const
1108     {
1109         return onPreKeyEvent_;
1110     }
1111 
SetOverScrollId(const EventMarker & overScrollId)1112     void SetOverScrollId(const EventMarker& overScrollId)
1113     {
1114         CHECK_NULL_VOID(declaration_);
1115         declaration_->SetOverScrollId(overScrollId);
1116     }
1117 
GetOverScrollId()1118     const EventMarker& GetOverScrollId() const
1119     {
1120         return declaration_->GetOverScrollId();
1121     }
1122 
SetNativeEmbedLifecycleChangeId(const EventMarker & embedLifecycleChangeId)1123     void SetNativeEmbedLifecycleChangeId(const EventMarker& embedLifecycleChangeId)
1124     {
1125         CHECK_NULL_VOID(declaration_);
1126         declaration_->SetNativeEmbedLifecycleChangeId(embedLifecycleChangeId);
1127     }
1128 
GetNativeEmbedLifecycleChangeId()1129     const EventMarker& GetNativeEmbedLifecycleChangeId() const
1130     {
1131         return declaration_->GetNativeEmbedLifecycleChangeId();
1132     }
1133 
SetNativeEmbedVisibilityChangeId(const EventMarker & embedVisibilityChangeId)1134     void SetNativeEmbedVisibilityChangeId(const EventMarker& embedVisibilityChangeId)
1135     {
1136         CHECK_NULL_VOID(declaration_);
1137         declaration_->SetNativeEmbedVisibilityChangeId(embedVisibilityChangeId);
1138     }
1139 
GetNativeEmbedVisibilityChangeId()1140     const EventMarker& GetNativeEmbedVisibilityChangeId() const
1141     {
1142         return declaration_->GetNativeEmbedVisibilityChangeId();
1143     }
1144 
SetNativeEmbedGestureEventId(const EventMarker & embedGestureEventId)1145     void SetNativeEmbedGestureEventId(const EventMarker& embedGestureEventId)
1146     {
1147         CHECK_NULL_VOID(declaration_);
1148         declaration_->SetNativeEmbedGestureEventId(embedGestureEventId);
1149     }
1150 
GetNativeEmbedGestureEventId()1151     const EventMarker& GetNativeEmbedGestureEventId() const
1152     {
1153         return declaration_->GetNativeEmbedGestureEventId();
1154     }
1155 
SetRenderProcessNotRespondingId(const EventMarker & renderNotRespondingId)1156     void SetRenderProcessNotRespondingId(const EventMarker& renderNotRespondingId)
1157     {
1158         CHECK_NULL_VOID(declaration_);
1159         declaration_->SetRenderProcessNotRespondingId(renderNotRespondingId);
1160     }
1161 
GetRenderProcessNotRespondingId()1162     const EventMarker& GetRenderProcessNotRespondingId() const
1163     {
1164         return declaration_->GetRenderProcessNotRespondingId();
1165     }
1166 
SetRenderProcessRespondingId(const EventMarker & renderRespondingId)1167     void SetRenderProcessRespondingId(const EventMarker& renderRespondingId)
1168     {
1169         CHECK_NULL_VOID(declaration_);
1170         declaration_->SetRenderProcessRespondingId(renderRespondingId);
1171     }
1172 
GetRenderProcessRespondingId()1173     const EventMarker& GetRenderProcessRespondingId() const
1174     {
1175         return declaration_->GetRenderProcessRespondingId();
1176     }
1177 
SetViewportFitChangedId(const EventMarker & viewportFitId)1178     void SetViewportFitChangedId(const EventMarker& viewportFitId)
1179     {
1180         CHECK_NULL_VOID(declaration_);
1181         declaration_->SetViewportFitChangedId(viewportFitId);
1182     }
1183 
GetViewportFitChangedId()1184     const EventMarker& GetViewportFitChangedId() const
1185     {
1186         return declaration_->GetViewportFitChangedId();
1187     }
1188 
SetAdsBlockedEventId(const EventMarker & adsBlockedEventId)1189     void SetAdsBlockedEventId(const EventMarker& adsBlockedEventId)
1190     {
1191         CHECK_NULL_VOID(declaration_);
1192         declaration_->SetAdsBlockedEventId(adsBlockedEventId);
1193     }
1194 
GetAdsBlockedEventId()1195     const EventMarker& GetAdsBlockedEventId() const
1196     {
1197         return declaration_->GetAdsBlockedEventId();
1198     }
1199 
SetOptimizeParserBudgetEnabled(bool enable)1200     void SetOptimizeParserBudgetEnabled(bool enable)
1201     {
1202         isParserBudgetOptimized_ = enable;
1203     }
1204 
GetOptimizeParserBudgetEnabled()1205     bool GetOptimizeParserBudgetEnabled() const
1206     {
1207         return isParserBudgetOptimized_;
1208     }
1209 
1210 private:
1211     RefPtr<WebDeclaration> declaration_;
1212     CreatedCallback createdCallback_ = nullptr;
1213     ReleasedCallback releasedCallback_ = nullptr;
1214     ErrorCallback errorCallback_ = nullptr;
1215     SetWebIdCallback setWebIdCallback_ = nullptr;
1216     SetHapPathCallback setHapPathCallback_ = nullptr;
1217     JsProxyCallback jsProxyCallback_ = nullptr;
1218     RefPtr<WebDelegate> delegate_;
1219     RefPtr<WebController> webController_;
1220     OnCommonDialogImpl onAlertImpl_;
1221     OnCommonDialogImpl onConfirmImpl_;
1222     OnCommonDialogImpl onPromptImpl_;
1223     OnCommonDialogImpl onBeforeUnloadImpl_;
1224     OnConsoleImpl consoleImpl_;
1225     OnFileSelectorShowImpl onFileSelectorShowImpl_;
1226     OnFullScreenEnterImpl onFullScreenEnterImpl_;
1227     OnUrlLoadInterceptImpl onUrlLoadInterceptImpl_;
1228     OnLoadInterceptImpl onLoadInterceptImpl_;
1229     OnOverrideUrlLoadingImpl onOverrideUrlLoadingImpl_;
1230     OnHttpAuthRequestImpl onHttpAuthRequestImpl_;
1231     OnSslErrorRequestImpl onSslErrorRequestImpl_;
1232     OnAllSslErrorRequestImpl onAllSslErrorRequestImpl_;
1233     OnSslSelectCertRequestImpl onSslSelectCertRequestImpl_;
1234     OnContextMenuImpl onContextMenuImpl_;
1235     OnContextMenuHideImpl onContextMenuHideImpl_;
1236     OnInterceptRequestImpl onInterceptRequestImpl_ = nullptr;
1237     OnOverrideErrorPageImpl onOverrideErrorPageImpl_ = nullptr;
1238     OnProgressChangeImpl onProgressChangeImpl_ = nullptr;
1239     OnWindowNewImpl onWindowNewImpl_ = nullptr;
1240 
1241     std::string type_;
1242     bool incognitoMode_ = false;
1243     bool isJsEnabled_ = true;
1244     bool isContentAccessEnabled_ = true;
1245     bool isFileAccessEnabled_ = true;
1246     std::string userAgent_;
1247     std::string customScheme_;
1248     WeakPtr<FocusNode> focusElement_;
1249     bool isOnLineImageAccessEnabled_ = false;
1250     bool isDomStorageAccessEnabled_ = false;
1251     bool isImageAccessEnabled_ = true;
1252     MixedModeContent mixedContentMode_ = MixedModeContent::MIXED_CONTENT_NEVER_ALLOW;
1253     WebBypassVsyncCondition webBypassVsyncCondition_ = WebBypassVsyncCondition::NONE;
1254     bool isZoomAccessEnabled_ = true;
1255     bool isGeolocationAccessEnabled_ = true;
1256     bool isOverviewModeAccessEnabled_ = true;
1257     bool isFileFromUrlAccessEnabled_ = false;
1258     bool isDatabaseAccessEnabled_ = false;
1259     int32_t textZoomRatioNum_ = DEFAULT_TEXT_ZOOM_RATIO;
1260     WebCacheMode cacheMode_ = WebCacheMode::DEFAULT;
1261     bool isWebDebuggingAccessEnabled_ = false;
1262     int32_t webDebuggingPort_ = 0;
1263     bool isMultiWindowAccessEnabled_ = false;
1264     bool isAllowWindowOpenMethod_ = false;
1265     OnMouseCallback onMouseEvent_;
1266     OnKeyEventCallback onKeyEvent_;
1267     float initialScale_ = 0;
1268     bool isInitialScaleSet_ = false;
1269     int32_t backgroundColor_ = 0;
1270     bool isBackgroundColor_ = false;
1271     bool isNeedGestureAccess_ = true;
1272     bool isNativeEmbedMode_ = false;
1273     bool isIntrinsicSize_ = false;
1274     bool isCssDisplayChangeEnabled_ = false;
1275     std::string tag_;
1276     std::string tag_type_;
1277     OnDragFunc onDragStartId_;
1278     OnDropFunc onDragEnterId_;
1279     OnDropFunc onDragMoveId_;
1280     OnDropFunc onDragLeaveId_;
1281     OnDropFunc onDropId_;
1282     bool isPinchSmoothModeEnabled_ = false;
1283     PreKeyEventCallback onPreKeyEvent_;
1284     bool isPopup_ = false;
1285     int32_t parentNWebId_ = -1;
1286     OverScrollMode OverScrollMode_ = OverScrollMode::NEVER;
1287     CopyOptions CopyOptionMode_ = CopyOptions::Distributed;
1288     std::tuple<bool, bool> native_video_player_config_{false, false};
1289     std::string shared_render_process_token_;
1290     bool isParserBudgetOptimized_ = false;
1291 };
1292 
1293 } // namespace OHOS::Ace
1294 
1295 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_WEB_WEB_COMPONENT_H
1296