Merge "Add callbacks for form repost decision and frame rendering." into devel/master
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / devel-api / controls / web-view / web-view.cpp
1 /*
2  * Copyright (c) 2021 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 // CLASS HEADER
19 #include <dali-toolkit/devel-api/controls/web-view/web-view.h>
20
21 // INTERNAL INCLUDES
22 #include <dali-toolkit/internal/controls/web-view/web-view-impl.h>
23 #include <dali-toolkit/public-api/controls/image-view/image-view.h>
24
25 namespace Dali
26 {
27 namespace Toolkit
28 {
29 WebView::WebView()
30 {
31 }
32
33 WebView::WebView(const WebView& WebView)
34 : Control(WebView)
35 {
36 }
37
38 WebView& WebView::operator=(const WebView& view)
39 {
40   if(&view != this)
41   {
42     Control::operator=(view);
43   }
44
45   return *this;
46 }
47
48 WebView::~WebView()
49 {
50 }
51
52 WebView WebView::New()
53 {
54   return Internal::WebView::New();
55 }
56
57 WebView WebView::New(const std::string& locale, const std::string& timezoneId)
58 {
59   return Internal::WebView::New(locale, timezoneId);
60 }
61
62 WebView WebView::New(int argc, char** argv)
63 {
64   return Internal::WebView::New(argc, argv);
65 }
66
67 WebView WebView::DownCast(BaseHandle handle)
68 {
69   return Control::DownCast<WebView, Internal::WebView>(handle);
70 }
71
72 Dali::Toolkit::WebSettings* WebView::GetSettings() const
73 {
74   return Dali::Toolkit::GetImpl(*this).GetSettings();
75 }
76
77 Dali::Toolkit::WebContext* WebView::GetContext() const
78 {
79   return Dali::Toolkit::GetImpl(*this).GetContext();
80 }
81
82 Dali::Toolkit::WebCookieManager* WebView::GetCookieManager() const
83 {
84   return Dali::Toolkit::GetImpl(*this).GetCookieManager();
85 }
86
87 Dali::Toolkit::WebBackForwardList* WebView::GetBackForwardList() const
88 {
89   return Dali::Toolkit::GetImpl(*this).GetBackForwardList();
90 }
91
92 Dali::Toolkit::ImageView& WebView::GetFavicon()
93 {
94   return Dali::Toolkit::GetImpl(*this).GetFavicon();
95 }
96
97 void WebView::LoadUrl(const std::string& url)
98 {
99   Dali::Toolkit::GetImpl(*this).LoadUrl(url);
100 }
101
102 void WebView::LoadHtmlString(const std::string& htmlString)
103 {
104   Dali::Toolkit::GetImpl(*this).LoadHtmlString(htmlString);
105 }
106
107 void WebView::Reload()
108 {
109   Dali::Toolkit::GetImpl(*this).Reload();
110 }
111
112 void WebView::StopLoading()
113 {
114   Dali::Toolkit::GetImpl(*this).StopLoading();
115 }
116
117 void WebView::Suspend()
118 {
119   Dali::Toolkit::GetImpl(*this).Suspend();
120 }
121
122 void WebView::Resume()
123 {
124   Dali::Toolkit::GetImpl(*this).Resume();
125 }
126
127 void WebView::ScrollBy(int deltaX, int deltaY)
128 {
129   Dali::Toolkit::GetImpl(*this).ScrollBy(deltaX, deltaY);
130 }
131
132 bool WebView::CanGoForward()
133 {
134   return Dali::Toolkit::GetImpl(*this).CanGoForward();
135 }
136
137 void WebView::GoForward()
138 {
139   Dali::Toolkit::GetImpl(*this).GoForward();
140 }
141
142 bool WebView::CanGoBack()
143 {
144   return Dali::Toolkit::GetImpl(*this).CanGoBack();
145 }
146
147 void WebView::GoBack()
148 {
149   Dali::Toolkit::GetImpl(*this).GoBack();
150 }
151
152 void WebView::EvaluateJavaScript(const std::string& script, std::function<void(const std::string&)> resultHandler)
153 {
154   Dali::Toolkit::GetImpl(*this).EvaluateJavaScript(script, resultHandler);
155 }
156
157 void WebView::EvaluateJavaScript(const std::string& script)
158 {
159   Dali::Toolkit::GetImpl(*this).EvaluateJavaScript(script, nullptr);
160 }
161
162 void WebView::AddJavaScriptMessageHandler(const std::string& exposedObjectName, std::function<void(const std::string&)> handler)
163 {
164   Dali::Toolkit::GetImpl(*this).AddJavaScriptMessageHandler(exposedObjectName, handler);
165 }
166
167 void WebView::RegisterJavaScriptAlertCallback(Dali::WebEnginePlugin::JavaScriptAlertCallback callback)
168 {
169   Dali::Toolkit::GetImpl(*this).RegisterJavaScriptAlertCallback(callback);
170 }
171
172 void WebView::JavaScriptAlertReply()
173 {
174   Dali::Toolkit::GetImpl(*this).JavaScriptAlertReply();
175 }
176
177 void WebView::RegisterJavaScriptConfirmCallback(Dali::WebEnginePlugin::JavaScriptConfirmCallback callback)
178 {
179   Dali::Toolkit::GetImpl(*this).RegisterJavaScriptConfirmCallback(callback);
180 }
181
182 void WebView::JavaScriptConfirmReply(bool confirmed)
183 {
184   Dali::Toolkit::GetImpl(*this).JavaScriptConfirmReply(confirmed);
185 }
186
187 void WebView::RegisterJavaScriptPromptCallback(Dali::WebEnginePlugin::JavaScriptPromptCallback callback)
188 {
189   Dali::Toolkit::GetImpl(*this).RegisterJavaScriptPromptCallback(callback);
190 }
191
192 void WebView::JavaScriptPromptReply(const std::string& result)
193 {
194   Dali::Toolkit::GetImpl(*this).JavaScriptPromptReply(result);
195 }
196
197 void WebView::ClearHistory()
198 {
199   Dali::Toolkit::GetImpl(*this).ClearHistory();
200 }
201
202 void WebView::ClearAllTilesResources()
203 {
204   Dali::Toolkit::GetImpl(*this).ClearAllTilesResources();
205 }
206
207 WebView::WebViewPageLoadSignalType& WebView::PageLoadStartedSignal()
208 {
209   return Dali::Toolkit::GetImpl(*this).PageLoadStartedSignal();
210 }
211
212 WebView::WebViewPageLoadSignalType& WebView::PageLoadInProgressSignal()
213 {
214   return Dali::Toolkit::GetImpl(*this).PageLoadInProgressSignal();
215 }
216
217 WebView::WebViewPageLoadSignalType& WebView::PageLoadFinishedSignal()
218 {
219   return Dali::Toolkit::GetImpl(*this).PageLoadFinishedSignal();
220 }
221
222 WebView::WebViewPageLoadErrorSignalType& WebView::PageLoadErrorSignal()
223 {
224   return Dali::Toolkit::GetImpl(*this).PageLoadErrorSignal();
225 }
226
227 WebView::WebViewScrollEdgeReachedSignalType& WebView::ScrollEdgeReachedSignal()
228 {
229   return Dali::Toolkit::GetImpl(*this).ScrollEdgeReachedSignal();
230 }
231
232 WebView::WebViewUrlChangedSignalType& WebView::UrlChangedSignal()
233 {
234   return Dali::Toolkit::GetImpl(*this).UrlChangedSignal();
235 }
236
237 WebView::WebViewFormRepostDecisionSignalType& WebView::FormRepostDecisionSignal()
238 {
239   return Dali::Toolkit::GetImpl(*this).FormRepostDecisionSignal();
240 }
241
242 WebView::WebViewFrameRenderedSignalType& WebView::FrameRenderedSignal()
243 {
244   return Dali::Toolkit::GetImpl(*this).FrameRenderedSignal();
245 }
246
247 WebView::WebView(Internal::WebView& implementation)
248 : Control(implementation)
249 {
250 }
251
252 WebView::WebView(Dali::Internal::CustomActor* internal)
253 : Control(internal)
254 {
255   VerifyCustomActorPointer<Internal::WebView>(internal);
256 }
257
258 } // namespace Toolkit
259
260 } // namespace Dali