69c2b791615eca696964ce059bf034698fddf3ed
[platform/core/uifw/dali-adaptor.git] / dali / devel-api / adaptor-framework / web-engine.cpp
1 /*
2  * Copyright (c) 2020 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/devel-api/adaptor-framework/web-engine.h>
20
21 // INTERNAL INCLUDES
22 #include <dali/internal/web-engine/common/web-engine-impl.h>
23
24 namespace Dali
25 {
26 WebEngine::WebEngine()
27 {
28 }
29
30 WebEngine::WebEngine(Internal::Adaptor::WebEngine* internal)
31 : BaseHandle(internal)
32 {
33 }
34
35 WebEngine::~WebEngine()
36 {
37 }
38
39 WebEngine WebEngine::New()
40 {
41   Internal::Adaptor::WebEnginePtr engine = Internal::Adaptor::WebEngine::New();
42
43   return WebEngine(engine.Get());
44 }
45
46 WebEngine::WebEngine(const WebEngine& webEngine)
47 : BaseHandle(webEngine)
48 {
49 }
50
51 WebEngine& WebEngine::operator=(const WebEngine& webEngine)
52 {
53   if(*this != webEngine)
54   {
55     BaseHandle::operator=(webEngine);
56   }
57   return *this;
58 }
59
60 WebEngine WebEngine::DownCast(BaseHandle handle)
61 {
62   return WebEngine(dynamic_cast<Internal::Adaptor::WebEngine*>(handle.GetObjectPtr()));
63 }
64
65 void WebEngine::Create(int width, int height, const std::string& locale, const std::string& timezoneId)
66 {
67   GetImplementation(*this).Create(width, height, locale, timezoneId);
68 }
69
70 void WebEngine::Destroy()
71 {
72   GetImplementation(*this).Destroy();
73 }
74
75 NativeImageInterfacePtr WebEngine::GetNativeImageSource()
76 {
77   return GetImplementation(*this).GetNativeImageSource();
78 }
79
80 void WebEngine::LoadUrl(const std::string& url)
81 {
82   return GetImplementation(*this).LoadUrl(url);
83 }
84
85 const std::string& WebEngine::GetUrl()
86 {
87   return GetImplementation(*this).GetUrl();
88 }
89
90 void WebEngine::LoadHTMLString(const std::string& htmlString)
91 {
92   GetImplementation(*this).LoadHTMLString(htmlString);
93 }
94
95 void WebEngine::Reload()
96 {
97   GetImplementation(*this).Reload();
98 }
99
100 void WebEngine::StopLoading()
101 {
102   GetImplementation(*this).StopLoading();
103 }
104
105 void WebEngine::Suspend()
106 {
107   GetImplementation(*this).Suspend();
108 }
109
110 void WebEngine::Resume()
111 {
112   GetImplementation(*this).Resume();
113 }
114
115 bool WebEngine::CanGoForward()
116 {
117   return GetImplementation(*this).CanGoForward();
118 }
119
120 void WebEngine::GoForward()
121 {
122   GetImplementation(*this).GoForward();
123 }
124
125 bool WebEngine::CanGoBack()
126 {
127   return GetImplementation(*this).CanGoBack();
128 }
129
130 void WebEngine::GoBack()
131 {
132   GetImplementation(*this).GoBack();
133 }
134
135 void WebEngine::EvaluateJavaScript(const std::string& script, std::function<void(const std::string&)> resultHandler)
136 {
137   GetImplementation(*this).EvaluateJavaScript(script, resultHandler);
138 }
139
140 void WebEngine::AddJavaScriptMessageHandler(const std::string& exposedObjectName, std::function<void(const std::string&)> handler)
141 {
142   GetImplementation(*this).AddJavaScriptMessageHandler(exposedObjectName, handler);
143 }
144
145 void WebEngine::ClearHistory()
146 {
147   return GetImplementation(*this).ClearHistory();
148 }
149
150 void WebEngine::ClearCache()
151 {
152   return GetImplementation(*this).ClearCache();
153 }
154
155 void WebEngine::ClearCookies()
156 {
157   return GetImplementation(*this).ClearCookies();
158 }
159
160 Dali::WebEnginePlugin::CacheModel WebEngine::GetCacheModel() const
161 {
162   return GetImplementation(*this).GetCacheModel();
163 }
164
165 void WebEngine::SetCacheModel(Dali::WebEnginePlugin::CacheModel cacheModel)
166 {
167   GetImplementation(*this).SetCacheModel(cacheModel);
168 }
169
170 Dali::WebEnginePlugin::CookieAcceptPolicy WebEngine::GetCookieAcceptPolicy() const
171 {
172   return GetImplementation(*this).GetCookieAcceptPolicy();
173 }
174
175 void WebEngine::SetCookieAcceptPolicy(Dali::WebEnginePlugin::CookieAcceptPolicy policy)
176 {
177   GetImplementation(*this).SetCookieAcceptPolicy(policy);
178 }
179
180 const std::string& WebEngine::GetUserAgent() const
181 {
182   return GetImplementation(*this).GetUserAgent();
183 }
184
185 void WebEngine::SetUserAgent(const std::string& userAgent)
186 {
187   GetImplementation(*this).SetUserAgent(userAgent);
188 }
189
190 bool WebEngine::IsJavaScriptEnabled() const
191 {
192   return GetImplementation(*this).IsJavaScriptEnabled();
193 }
194
195 void WebEngine::EnableJavaScript(bool enabled)
196 {
197   GetImplementation(*this).EnableJavaScript(enabled);
198 }
199
200 bool WebEngine::AreImagesAutomaticallyLoaded() const
201 {
202   return GetImplementation(*this).AreImagesAutomaticallyLoaded();
203 }
204
205 void WebEngine::LoadImagesAutomatically(bool automatic)
206 {
207   GetImplementation(*this).LoadImagesAutomatically(automatic);
208 }
209
210 const std::string& WebEngine::GetDefaultTextEncodingName() const
211 {
212   return GetImplementation(*this).GetDefaultTextEncodingName();
213 }
214
215 void WebEngine::SetDefaultTextEncodingName(const std::string& defaultTextEncodingName)
216 {
217   GetImplementation(*this).SetDefaultTextEncodingName(defaultTextEncodingName);
218 }
219
220 int WebEngine::GetDefaultFontSize() const
221 {
222   return GetImplementation(*this).GetDefaultFontSize();
223 }
224
225 void WebEngine::SetDefaultFontSize(int defaultFontSize)
226 {
227   GetImplementation(*this).SetDefaultFontSize(defaultFontSize);
228 }
229
230 void WebEngine::SetSize(int width, int height)
231 {
232   return GetImplementation(*this).SetSize(width, height);
233 }
234
235 bool WebEngine::SendTouchEvent(const TouchEvent& touch)
236 {
237   return GetImplementation(*this).SendTouchEvent(touch);
238 }
239
240 bool WebEngine::SendKeyEvent(const KeyEvent& event)
241 {
242   return GetImplementation(*this).SendKeyEvent(event);
243 }
244
245 void WebEngine::SetFocus( bool focused )
246 {
247   GetImplementation( *this ).SetFocus( focused );
248 }
249
250 Dali::WebEnginePlugin::WebEnginePageLoadSignalType& WebEngine::PageLoadStartedSignal()
251 {
252   return GetImplementation(*this).PageLoadStartedSignal();
253 }
254
255 Dali::WebEnginePlugin::WebEnginePageLoadSignalType& WebEngine::PageLoadFinishedSignal()
256 {
257   return GetImplementation(*this).PageLoadFinishedSignal();
258 }
259
260 Dali::WebEnginePlugin::WebEnginePageLoadErrorSignalType& WebEngine::PageLoadErrorSignal()
261 {
262   return GetImplementation(*this).PageLoadErrorSignal();
263 }
264
265 } // namespace Dali