• 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 FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_JS_VIEW_JS_WEB_H
17 #define FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_JS_VIEW_JS_WEB_H
18 
19 #include <string>
20 
21 #include "bridge/declarative_frontend/jsview/js_view_common_def.h"
22 #include "core/components/web/web_component.h"
23 #include "frameworks/bridge/declarative_frontend/jsview/js_container_base.h"
24 
25 namespace OHOS::Ace::Framework {
26 class JSWeb : public JSContainerBase {
27 public:
28     static void JSBind(BindingTarget globalObj);
29     static void Create(const JSCallbackInfo& info);
30     static void CreateInNewPipeline(JSRef<JSObject> controller, JSRef<JSVal> setWebIdFunction,
31         std::optional<std::string> dstSrc);
32     static void CreateInOldPipeline(JSRef<JSObject> controller, JSRef<JSVal> setWebIdFunction,
33         std::optional<std::string> dstSrc);
34     static void CreateWithWebController(JSRef<JSObject> controller,
35         RefPtr<WebComponent>& webComponent);
36     static void CreateWithWebviewController(JSRef<JSObject> controller, JSRef<JSVal> setWebIdFunction,
37         RefPtr<WebComponent>& webComponent);
38     static void OnAlert(const JSCallbackInfo& args);
39     static void OnBeforeUnload(const JSCallbackInfo& args);
40     static void OnConfirm(const JSCallbackInfo& args);
41     static void OnFullScreenEnter(const JSCallbackInfo& args);
42     static void OnFullScreenExit(const JSCallbackInfo& args);
43     static void OnPrompt(const JSCallbackInfo& args);
44     static void OnConsoleLog(const JSCallbackInfo& args);
45     static void OnPageStart(const JSCallbackInfo& args);
46     static void OnPageFinish(const JSCallbackInfo& args);
47     static void OnProgressChange(const JSCallbackInfo& args);
48     static void OnTitleReceive(const JSCallbackInfo& args);
49     static void OnGeolocationHide(const JSCallbackInfo& args);
50     static void OnGeolocationShow(const JSCallbackInfo& args);
51     static void OnRequestFocus(const JSCallbackInfo& args);
52     static void OnError(const JSCallbackInfo& args);
53     static void OnMessage(const JSCallbackInfo& args);
54     static void OnDownloadStart(const JSCallbackInfo& args);
55     static void OnErrorReceive(const JSCallbackInfo& args);
56     static void OnHttpErrorReceive(const JSCallbackInfo& args);
57     static void OnFileSelectorShow(const JSCallbackInfo& args);
58     static void OnInterceptRequest(const JSCallbackInfo& args);
59     static void OnUrlLoadIntercept(const JSCallbackInfo& args);
60     static void JsEnabled(bool isJsEnabled);
61     static void ContentAccessEnabled(bool isContentAccessEnabled);
62     static void FileAccessEnabled(bool isFileAccessEnabled);
63     static void OnFocus(const JSCallbackInfo& args);
64     static void OnLineImageAccessEnabled(bool isOnLineImageAccessEnabled);
65     static void DomStorageAccessEnabled(bool isDomStorageAccessEnabled);
66     static void ImageAccessEnabled(bool isImageAccessEnabled);
67     static void MixedMode(int32_t MixedModeNum);
68     static void ZoomAccessEnabled(bool isZoomAccessEnabled);
69     static void GeolocationAccessEnabled(bool isGeolocationAccessEnabled);
70     static void JavaScriptProxy(const JSCallbackInfo& args);
71     static void UserAgent(const std::string& userAgent);
72     static void OnRenderExited(const JSCallbackInfo& args);
73     static void OnRefreshAccessedHistory(const JSCallbackInfo& args);
74     static void CacheMode(int32_t cacheMode);
75     static void OverviewModeAccess(bool isOverviewModeAccessEnabled);
76     static void WideViewModeAccess(const JSCallbackInfo& args);
77     static void FileFromUrlAccess(bool isFileFromUrlAccessEnabled);
78     static void DatabaseAccess(bool isDatabaseAccessEnabled);
79     static void TextZoomRatio(int32_t textZoomRatioNum);
80     static void WebDebuggingAccessEnabled(bool isWebDebuggingAccessEnabled);
81     static void OnMouse(const JSCallbackInfo& args);
82     static void OnResourceLoad(const JSCallbackInfo& args);
83     static void OnScaleChange(const JSCallbackInfo& args);
84     static void OnScroll(const JSCallbackInfo& args);
85     static void BackgroundColor(const JSCallbackInfo& info);
86     static void InitialScale(float scale);
87     static void Password(bool password);
88     static void TableData(bool tableData);
89     static void OnFileSelectorShowAbandoned(const JSCallbackInfo& args);
90     static void OnHttpAuthRequest(const JSCallbackInfo& args);
91     static void OnSslErrorRequest(const JSCallbackInfo& args);
92     static void OnSslSelectCertRequest(const JSCallbackInfo& args);
93     static void OnPermissionRequest(const JSCallbackInfo& args);
94     static void OnContextMenuShow(const JSCallbackInfo& args);
95     static void OnSearchResultReceive(const JSCallbackInfo& args);
96     static void MediaPlayGestureAccess(bool isNeedGestureAccess);
97     static void OnKeyEvent(const JSCallbackInfo& args);
98     static void JsOnDragStart(const JSCallbackInfo& info);
99     static void JsOnDragEnter(const JSCallbackInfo& info);
100     static void JsOnDragMove(const JSCallbackInfo& info);
101     static void JsOnDragLeave(const JSCallbackInfo& info);
102     static void JsOnDrop(const JSCallbackInfo& info);
103     static void PinchSmoothModeEnabled(bool isPinchSmoothModeEnabled);
104     static void OnWindowNew(const JSCallbackInfo& args);
105     static void OnWindowExit(const JSCallbackInfo& args);
106     static void MultiWindowAccessEnabled(bool isMultiWindowAccessEnable);
107     static void WebCursiveFont(const std::string& cursiveFontFamily);
108     static void WebFantasyFont(const std::string& fantasyFontFamily);
109     static void WebFixedFont(const std::string& fixedFontFamily);
110     static void WebSansSerifFont(const std::string& sansSerifFontFamily);
111     static void WebSerifFont(const std::string& serifFontFamily);
112     static void WebStandardFont(const std::string& standardFontFamily);
113     static void DefaultFixedFontSize(int32_t defaultFixedFontSize);
114     static void DefaultFontSize(int32_t defaultFontSize);
115     static void MinFontSize(int32_t minFontSize);
116     static void MinLogicalFontSize(int32_t minLogicalFontSize);
117     static void BlockNetwork(bool isNetworkBlocked);
118     static void OnPageVisible(const JSCallbackInfo& args);
119     static void OnInterceptKeyEvent(const JSCallbackInfo& args);
120     static void OnDataResubmitted(const JSCallbackInfo& args);
121     static void OnFaviconReceived(const JSCallbackInfo& args);
122     static void OnTouchIconUrlReceived(const JSCallbackInfo& args);
123     static void DarkMode(int32_t darkMode);
124     static void ForceDarkAccess(bool access);
125     static void HorizontalScrollBarAccess(bool isHorizontalScrollBarAccessEnabled);
126     static void VerticalScrollBarAccess(bool isVerticalScrollBarAccessEnabled);
127     // Enable or disable debugging of web content
128     static bool webDebuggingAccess_;
129 
130 protected:
131     static void OnCommonDialog(const JSCallbackInfo& args, int dialogEventType);
132 };
133 } // namespace OHOS::Ace::Framework
134 #endif // FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_JS_VIEW_JS_WEB_H
135