2 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 #include <dali-toolkit/devel-api/controls/web-view/web-view.h>
22 #include <dali-toolkit/internal/controls/web-view/web-view-impl.h>
23 #include <dali-toolkit/public-api/controls/image-view/image-view.h>
33 WebView::WebView(const WebView& WebView)
38 WebView& WebView::operator=(const WebView& view)
42 Control::operator=(view);
52 WebView WebView::New()
54 return Internal::WebView::New();
57 WebView WebView::New(const std::string& locale, const std::string& timezoneId)
59 return Internal::WebView::New(locale, timezoneId);
62 WebView WebView::New(int argc, char** argv)
64 return Internal::WebView::New(argc, argv);
67 WebView WebView::DownCast(BaseHandle handle)
69 return Control::DownCast<WebView, Internal::WebView>(handle);
72 Dali::Toolkit::WebSettings* WebView::GetSettings() const
74 return Dali::Toolkit::GetImpl(*this).GetSettings();
77 Dali::Toolkit::WebContext* WebView::GetContext() const
79 return Dali::Toolkit::GetImpl(*this).GetContext();
82 Dali::Toolkit::WebCookieManager* WebView::GetCookieManager() const
84 return Dali::Toolkit::GetImpl(*this).GetCookieManager();
87 Dali::Toolkit::WebBackForwardList* WebView::GetBackForwardList() const
89 return Dali::Toolkit::GetImpl(*this).GetBackForwardList();
92 Dali::Toolkit::ImageView& WebView::GetFavicon()
94 return Dali::Toolkit::GetImpl(*this).GetFavicon();
97 void WebView::LoadUrl(const std::string& url)
99 Dali::Toolkit::GetImpl(*this).LoadUrl(url);
102 void WebView::LoadHtmlString(const std::string& htmlString)
104 Dali::Toolkit::GetImpl(*this).LoadHtmlString(htmlString);
107 void WebView::Reload()
109 Dali::Toolkit::GetImpl(*this).Reload();
112 void WebView::StopLoading()
114 Dali::Toolkit::GetImpl(*this).StopLoading();
117 void WebView::Suspend()
119 Dali::Toolkit::GetImpl(*this).Suspend();
122 void WebView::Resume()
124 Dali::Toolkit::GetImpl(*this).Resume();
127 void WebView::ScrollBy(int deltaX, int deltaY)
129 Dali::Toolkit::GetImpl(*this).ScrollBy(deltaX, deltaY);
132 bool WebView::CanGoForward()
134 return Dali::Toolkit::GetImpl(*this).CanGoForward();
137 void WebView::GoForward()
139 Dali::Toolkit::GetImpl(*this).GoForward();
142 bool WebView::CanGoBack()
144 return Dali::Toolkit::GetImpl(*this).CanGoBack();
147 void WebView::GoBack()
149 Dali::Toolkit::GetImpl(*this).GoBack();
152 void WebView::EvaluateJavaScript(const std::string& script, std::function<void(const std::string&)> resultHandler)
154 Dali::Toolkit::GetImpl(*this).EvaluateJavaScript(script, resultHandler);
157 void WebView::EvaluateJavaScript(const std::string& script)
159 Dali::Toolkit::GetImpl(*this).EvaluateJavaScript(script, nullptr);
162 void WebView::AddJavaScriptMessageHandler(const std::string& exposedObjectName, std::function<void(const std::string&)> handler)
164 Dali::Toolkit::GetImpl(*this).AddJavaScriptMessageHandler(exposedObjectName, handler);
167 void WebView::RegisterJavaScriptAlertCallback( Dali::WebEnginePlugin::JavaScriptAlertCallback callback )
169 Dali::Toolkit::GetImpl( *this ).RegisterJavaScriptAlertCallback( callback );
172 void WebView::JavaScriptAlertReply()
174 Dali::Toolkit::GetImpl( *this ).JavaScriptAlertReply();
177 void WebView::RegisterJavaScriptConfirmCallback( Dali::WebEnginePlugin::JavaScriptConfirmCallback callback )
179 Dali::Toolkit::GetImpl( *this ).RegisterJavaScriptConfirmCallback( callback );
182 void WebView::JavaScriptConfirmReply( bool confirmed )
184 Dali::Toolkit::GetImpl( *this ).JavaScriptConfirmReply( confirmed );
187 void WebView::RegisterJavaScriptPromptCallback( Dali::WebEnginePlugin::JavaScriptPromptCallback callback )
189 Dali::Toolkit::GetImpl( *this ).RegisterJavaScriptPromptCallback( callback );
192 void WebView::JavaScriptPromptReply( const std::string& result )
194 Dali::Toolkit::GetImpl( *this ).JavaScriptPromptReply( result );
197 void WebView::ClearHistory()
199 Dali::Toolkit::GetImpl(*this).ClearHistory();
202 void WebView::ClearAllTilesResources()
204 Dali::Toolkit::GetImpl( *this ).ClearAllTilesResources();
207 WebView::WebViewPageLoadSignalType& WebView::PageLoadStartedSignal()
209 return Dali::Toolkit::GetImpl(*this).PageLoadStartedSignal();
212 WebView::WebViewPageLoadSignalType& WebView::PageLoadInProgressSignal()
214 return Dali::Toolkit::GetImpl( *this ).PageLoadInProgressSignal();
217 WebView::WebViewPageLoadSignalType& WebView::PageLoadFinishedSignal()
219 return Dali::Toolkit::GetImpl(*this).PageLoadFinishedSignal();
222 WebView::WebViewPageLoadErrorSignalType& WebView::PageLoadErrorSignal()
224 return Dali::Toolkit::GetImpl(*this).PageLoadErrorSignal();
227 WebView::WebViewScrollEdgeReachedSignalType& WebView::ScrollEdgeReachedSignal()
229 return Dali::Toolkit::GetImpl(*this).ScrollEdgeReachedSignal();
232 WebView::WebViewUrlChangedSignalType& WebView::UrlChangedSignal()
234 return Dali::Toolkit::GetImpl( *this ).UrlChangedSignal();
237 WebView::WebView(Internal::WebView& implementation)
238 : Control(implementation)
242 WebView::WebView(Dali::Internal::CustomActor* internal)
245 VerifyCustomActorPointer<Internal::WebView>(internal);
248 } // namespace Toolkit