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