2 * Copyright (c) 2018 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>
27 WebEngine::WebEngine()
31 WebEngine::WebEngine( Internal::Adaptor::WebEngine* internal )
32 : BaseHandle( internal )
36 WebEngine::~WebEngine()
40 WebEngine WebEngine::New()
42 Internal::Adaptor::WebEnginePtr engine = Internal::Adaptor::WebEngine::New();
44 return WebEngine( engine.Get() );
47 WebEngine::WebEngine( const WebEngine& webEngine )
48 : BaseHandle( webEngine )
52 WebEngine& WebEngine::operator=( const WebEngine& webEngine )
54 if( *this != webEngine )
56 BaseHandle::operator=( webEngine );
61 WebEngine WebEngine::DownCast( BaseHandle handle )
63 return WebEngine( dynamic_cast< Internal::Adaptor::WebEngine* >( handle.GetObjectPtr() ) );
66 void WebEngine::Create( int width, int height, const std::string& locale, const std::string& timezoneId )
68 GetImplementation( *this ).Create( width, height, locale, timezoneId );
71 void WebEngine::Destroy()
73 GetImplementation( *this ).Destroy();
76 NativeImageInterfacePtr WebEngine::GetNativeImageSource()
78 return GetImplementation( *this ).GetNativeImageSource();
81 void WebEngine::LoadUrl( const std::string& url )
83 return GetImplementation( *this ).LoadUrl( url );
86 const std::string& WebEngine::GetUrl()
88 return GetImplementation( *this ).GetUrl();
91 void WebEngine::LoadHTMLString( const std::string& htmlString )
93 GetImplementation( *this ).LoadHTMLString( htmlString );
96 void WebEngine::Reload()
98 GetImplementation( *this ).Reload();
101 void WebEngine::StopLoading()
103 GetImplementation( *this ).StopLoading();
106 void WebEngine::Suspend()
108 GetImplementation( *this ).Suspend();
111 void WebEngine::Resume()
113 GetImplementation( *this ).Resume();
116 bool WebEngine::CanGoForward()
118 return GetImplementation( *this ).CanGoForward();
121 void WebEngine::GoForward()
123 GetImplementation( *this ).GoForward();
126 bool WebEngine::CanGoBack()
128 return GetImplementation( *this ).CanGoBack();
131 void WebEngine::GoBack()
133 GetImplementation( *this ).GoBack();
136 void WebEngine::EvaluateJavaScript( const std::string& script, std::function< void( const std::string& ) > resultHandler )
138 GetImplementation( *this ).EvaluateJavaScript( script, resultHandler );
141 void WebEngine::AddJavaScriptMessageHandler( const std::string& exposedObjectName, std::function< void( const std::string& ) > handler )
143 GetImplementation( *this ).AddJavaScriptMessageHandler( exposedObjectName, handler );
146 void WebEngine::ClearHistory()
148 return GetImplementation( *this ).ClearHistory();
151 void WebEngine::ClearCache()
153 return GetImplementation( *this ).ClearCache();
156 void WebEngine::ClearCookies()
158 return GetImplementation( *this ).ClearCookies();
161 Dali::WebEnginePlugin::CacheModel WebEngine::GetCacheModel() const
163 return GetImplementation( *this ).GetCacheModel();
166 void WebEngine::SetCacheModel( Dali::WebEnginePlugin::CacheModel cacheModel )
168 GetImplementation( *this ).SetCacheModel( cacheModel );
171 Dali::WebEnginePlugin::CookieAcceptPolicy WebEngine::GetCookieAcceptPolicy() const
173 return GetImplementation( *this ).GetCookieAcceptPolicy();
176 void WebEngine::SetCookieAcceptPolicy( Dali::WebEnginePlugin::CookieAcceptPolicy policy )
178 GetImplementation( *this ).SetCookieAcceptPolicy( policy );
181 const std::string& WebEngine::GetUserAgent() const
183 return GetImplementation( *this ).GetUserAgent();
186 void WebEngine::SetUserAgent( const std::string& userAgent )
188 GetImplementation( *this ).SetUserAgent( userAgent );
191 bool WebEngine::IsJavaScriptEnabled() const
193 return GetImplementation( *this ).IsJavaScriptEnabled();
196 void WebEngine::EnableJavaScript( bool enabled )
198 GetImplementation( *this ).EnableJavaScript( enabled );
201 bool WebEngine::AreImagesAutomaticallyLoaded() const
203 return GetImplementation( *this ).AreImagesAutomaticallyLoaded();
206 void WebEngine::LoadImagesAutomatically( bool automatic )
208 GetImplementation( *this ).LoadImagesAutomatically( automatic );
211 const std::string& WebEngine::GetDefaultTextEncodingName() const
213 return GetImplementation( *this ).GetDefaultTextEncodingName();
216 void WebEngine::SetDefaultTextEncodingName( const std::string& defaultTextEncodingName )
218 GetImplementation( *this ).SetDefaultTextEncodingName( defaultTextEncodingName );
221 int WebEngine::GetDefaultFontSize() const
223 return GetImplementation( *this ).GetDefaultFontSize();
226 void WebEngine::SetDefaultFontSize( int defaultFontSize )
228 GetImplementation( *this ).SetDefaultFontSize( defaultFontSize );
231 void WebEngine::SetSize( int width, int height )
233 return GetImplementation( *this ).SetSize( width, height );
236 bool WebEngine::SendTouchEvent( const TouchData& touch )
238 return GetImplementation( *this ).SendTouchEvent( touch );
241 bool WebEngine::SendKeyEvent( const KeyEvent& event )
243 return GetImplementation( *this ).SendKeyEvent( event );
246 Dali::WebEnginePlugin::WebEnginePageLoadSignalType& WebEngine::PageLoadStartedSignal()
248 return GetImplementation( *this ).PageLoadStartedSignal();
251 Dali::WebEnginePlugin::WebEnginePageLoadSignalType& WebEngine::PageLoadFinishedSignal()
253 return GetImplementation( *this ).PageLoadFinishedSignal();
256 Dali::WebEnginePlugin::WebEnginePageLoadErrorSignalType& WebEngine::PageLoadErrorSignal()
258 return GetImplementation( *this ).PageLoadErrorSignal();