2 * Copyright (c) 2020 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/devel-api/adaptor-framework/web-engine.h>
22 #include <dali/internal/web-engine/common/web-engine-impl.h>
26 WebEngine::WebEngine()
30 WebEngine::WebEngine(Internal::Adaptor::WebEngine* internal)
31 : BaseHandle(internal)
35 WebEngine::~WebEngine()
39 WebEngine WebEngine::New()
41 Internal::Adaptor::WebEnginePtr engine = Internal::Adaptor::WebEngine::New();
43 return WebEngine(engine.Get());
46 WebEngine::WebEngine(const WebEngine& webEngine)
47 : BaseHandle(webEngine)
51 WebEngine& WebEngine::operator=(const WebEngine& webEngine)
53 if(*this != webEngine)
55 BaseHandle::operator=(webEngine);
60 WebEngine WebEngine::DownCast(BaseHandle handle)
62 return WebEngine(dynamic_cast<Internal::Adaptor::WebEngine*>(handle.GetObjectPtr()));
65 void WebEngine::Create(int width, int height, const std::string& locale, const std::string& timezoneId)
67 GetImplementation(*this).Create(width, height, locale, timezoneId);
70 void WebEngine::Destroy()
72 GetImplementation(*this).Destroy();
75 NativeImageInterfacePtr WebEngine::GetNativeImageSource()
77 return GetImplementation(*this).GetNativeImageSource();
80 void WebEngine::LoadUrl(const std::string& url)
82 return GetImplementation(*this).LoadUrl(url);
85 const std::string& WebEngine::GetUrl()
87 return GetImplementation(*this).GetUrl();
90 void WebEngine::LoadHTMLString(const std::string& htmlString)
92 GetImplementation(*this).LoadHTMLString(htmlString);
95 void WebEngine::Reload()
97 GetImplementation(*this).Reload();
100 void WebEngine::StopLoading()
102 GetImplementation(*this).StopLoading();
105 void WebEngine::Suspend()
107 GetImplementation(*this).Suspend();
110 void WebEngine::Resume()
112 GetImplementation(*this).Resume();
115 void WebEngine::ScrollBy( int deltaX, int deltaY )
117 GetImplementation( *this ).ScrollBy( deltaX, deltaY );
120 void WebEngine::SetScrollPosition( int x, int y )
122 GetImplementation( *this ).SetScrollPosition( x, y );
125 void WebEngine::GetScrollPosition( int& x, int& y ) const
127 GetImplementation( *this ).GetScrollPosition( x, y );
130 void WebEngine::GetScrollSize( int& width, int& height ) const
132 GetImplementation( *this ).GetScrollSize( width, height );
135 void WebEngine::GetContentSize( int& width, int& height ) const
137 GetImplementation( *this ).GetContentSize( width, height );
140 bool WebEngine::CanGoForward()
142 return GetImplementation(*this).CanGoForward();
145 void WebEngine::GoForward()
147 GetImplementation(*this).GoForward();
150 bool WebEngine::CanGoBack()
152 return GetImplementation(*this).CanGoBack();
155 void WebEngine::GoBack()
157 GetImplementation(*this).GoBack();
160 void WebEngine::EvaluateJavaScript(const std::string& script, std::function<void(const std::string&)> resultHandler)
162 GetImplementation(*this).EvaluateJavaScript(script, resultHandler);
165 void WebEngine::AddJavaScriptMessageHandler(const std::string& exposedObjectName, std::function<void(const std::string&)> handler)
167 GetImplementation(*this).AddJavaScriptMessageHandler(exposedObjectName, handler);
170 void WebEngine::ClearHistory()
172 return GetImplementation(*this).ClearHistory();
175 void WebEngine::ClearCache()
177 return GetImplementation(*this).ClearCache();
180 void WebEngine::ClearCookies()
182 return GetImplementation(*this).ClearCookies();
185 Dali::WebEnginePlugin::CacheModel WebEngine::GetCacheModel() const
187 return GetImplementation(*this).GetCacheModel();
190 void WebEngine::SetCacheModel(Dali::WebEnginePlugin::CacheModel cacheModel)
192 GetImplementation(*this).SetCacheModel(cacheModel);
195 Dali::WebEnginePlugin::CookieAcceptPolicy WebEngine::GetCookieAcceptPolicy() const
197 return GetImplementation(*this).GetCookieAcceptPolicy();
200 void WebEngine::SetCookieAcceptPolicy(Dali::WebEnginePlugin::CookieAcceptPolicy policy)
202 GetImplementation(*this).SetCookieAcceptPolicy(policy);
205 const std::string& WebEngine::GetUserAgent() const
207 return GetImplementation(*this).GetUserAgent();
210 void WebEngine::SetUserAgent(const std::string& userAgent)
212 GetImplementation(*this).SetUserAgent(userAgent);
215 bool WebEngine::IsJavaScriptEnabled() const
217 return GetImplementation(*this).IsJavaScriptEnabled();
220 void WebEngine::EnableJavaScript(bool enabled)
222 GetImplementation(*this).EnableJavaScript(enabled);
225 bool WebEngine::AreImagesAutomaticallyLoaded() const
227 return GetImplementation(*this).AreImagesAutomaticallyLoaded();
230 void WebEngine::LoadImagesAutomatically(bool automatic)
232 GetImplementation(*this).LoadImagesAutomatically(automatic);
235 const std::string& WebEngine::GetDefaultTextEncodingName() const
237 return GetImplementation(*this).GetDefaultTextEncodingName();
240 void WebEngine::SetDefaultTextEncodingName(const std::string& defaultTextEncodingName)
242 GetImplementation(*this).SetDefaultTextEncodingName(defaultTextEncodingName);
245 int WebEngine::GetDefaultFontSize() const
247 return GetImplementation(*this).GetDefaultFontSize();
250 void WebEngine::SetDefaultFontSize(int defaultFontSize)
252 GetImplementation(*this).SetDefaultFontSize(defaultFontSize);
255 void WebEngine::SetSize(int width, int height)
257 return GetImplementation(*this).SetSize(width, height);
260 bool WebEngine::SendTouchEvent(const TouchEvent& touch)
262 return GetImplementation(*this).SendTouchEvent(touch);
265 bool WebEngine::SendKeyEvent(const KeyEvent& event)
267 return GetImplementation(*this).SendKeyEvent(event);
270 void WebEngine::SetFocus( bool focused )
272 GetImplementation( *this ).SetFocus( focused );
275 Dali::WebEnginePlugin::WebEnginePageLoadSignalType& WebEngine::PageLoadStartedSignal()
277 return GetImplementation(*this).PageLoadStartedSignal();
280 Dali::WebEnginePlugin::WebEnginePageLoadSignalType& WebEngine::PageLoadFinishedSignal()
282 return GetImplementation(*this).PageLoadFinishedSignal();
285 Dali::WebEnginePlugin::WebEnginePageLoadErrorSignalType& WebEngine::PageLoadErrorSignal()
287 return GetImplementation(*this).PageLoadErrorSignal();
290 Dali::WebEnginePlugin::WebEngineScrollEdgeReachedSignalType& WebEngine::ScrollEdgeReachedSignal()
292 return GetImplementation( *this ).ScrollEdgeReachedSignal();