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 bool WebEngine::CanGoForward()
117 return GetImplementation(*this).CanGoForward();
120 void WebEngine::GoForward()
122 GetImplementation(*this).GoForward();
125 bool WebEngine::CanGoBack()
127 return GetImplementation(*this).CanGoBack();
130 void WebEngine::GoBack()
132 GetImplementation(*this).GoBack();
135 void WebEngine::EvaluateJavaScript(const std::string& script, std::function<void(const std::string&)> resultHandler)
137 GetImplementation(*this).EvaluateJavaScript(script, resultHandler);
140 void WebEngine::AddJavaScriptMessageHandler(const std::string& exposedObjectName, std::function<void(const std::string&)> handler)
142 GetImplementation(*this).AddJavaScriptMessageHandler(exposedObjectName, handler);
145 void WebEngine::ClearHistory()
147 return GetImplementation(*this).ClearHistory();
150 void WebEngine::ClearCache()
152 return GetImplementation(*this).ClearCache();
155 void WebEngine::ClearCookies()
157 return GetImplementation(*this).ClearCookies();
160 Dali::WebEnginePlugin::CacheModel WebEngine::GetCacheModel() const
162 return GetImplementation(*this).GetCacheModel();
165 void WebEngine::SetCacheModel(Dali::WebEnginePlugin::CacheModel cacheModel)
167 GetImplementation(*this).SetCacheModel(cacheModel);
170 Dali::WebEnginePlugin::CookieAcceptPolicy WebEngine::GetCookieAcceptPolicy() const
172 return GetImplementation(*this).GetCookieAcceptPolicy();
175 void WebEngine::SetCookieAcceptPolicy(Dali::WebEnginePlugin::CookieAcceptPolicy policy)
177 GetImplementation(*this).SetCookieAcceptPolicy(policy);
180 const std::string& WebEngine::GetUserAgent() const
182 return GetImplementation(*this).GetUserAgent();
185 void WebEngine::SetUserAgent(const std::string& userAgent)
187 GetImplementation(*this).SetUserAgent(userAgent);
190 bool WebEngine::IsJavaScriptEnabled() const
192 return GetImplementation(*this).IsJavaScriptEnabled();
195 void WebEngine::EnableJavaScript(bool enabled)
197 GetImplementation(*this).EnableJavaScript(enabled);
200 bool WebEngine::AreImagesAutomaticallyLoaded() const
202 return GetImplementation(*this).AreImagesAutomaticallyLoaded();
205 void WebEngine::LoadImagesAutomatically(bool automatic)
207 GetImplementation(*this).LoadImagesAutomatically(automatic);
210 const std::string& WebEngine::GetDefaultTextEncodingName() const
212 return GetImplementation(*this).GetDefaultTextEncodingName();
215 void WebEngine::SetDefaultTextEncodingName(const std::string& defaultTextEncodingName)
217 GetImplementation(*this).SetDefaultTextEncodingName(defaultTextEncodingName);
220 int WebEngine::GetDefaultFontSize() const
222 return GetImplementation(*this).GetDefaultFontSize();
225 void WebEngine::SetDefaultFontSize(int defaultFontSize)
227 GetImplementation(*this).SetDefaultFontSize(defaultFontSize);
230 void WebEngine::SetSize(int width, int height)
232 return GetImplementation(*this).SetSize(width, height);
235 bool WebEngine::SendTouchEvent(const TouchEvent& touch)
237 return GetImplementation(*this).SendTouchEvent(touch);
240 bool WebEngine::SendKeyEvent(const KeyEvent& event)
242 return GetImplementation(*this).SendKeyEvent(event);
245 Dali::WebEnginePlugin::WebEnginePageLoadSignalType& WebEngine::PageLoadStartedSignal()
247 return GetImplementation(*this).PageLoadStartedSignal();
250 Dali::WebEnginePlugin::WebEnginePageLoadSignalType& WebEngine::PageLoadFinishedSignal()
252 return GetImplementation(*this).PageLoadFinishedSignal();
255 Dali::WebEnginePlugin::WebEnginePageLoadErrorSignalType& WebEngine::PageLoadErrorSignal()
257 return GetImplementation(*this).PageLoadErrorSignal();