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 bool WebEngine::CanGoForward()
108 return GetImplementation( *this ).CanGoForward();
111 void WebEngine::GoForward()
113 GetImplementation( *this ).GoForward();
116 bool WebEngine::CanGoBack()
118 return GetImplementation( *this ).CanGoBack();
121 void WebEngine::GoBack()
123 GetImplementation( *this ).GoBack();
126 void WebEngine::EvaluateJavaScript( const std::string& script )
128 GetImplementation( *this ).EvaluateJavaScript( script );
131 void WebEngine::AddJavaScriptInterface( const std::string& exposedObjectName, const std::string& jsFunctionName, std::function< std::string(const std::string&) > cb )
133 GetImplementation( *this ).AddJavaScriptInterface( exposedObjectName, jsFunctionName, cb );
136 void WebEngine::RemoveJavascriptInterface( const std::string& exposedObjectName, const std::string& jsFunctionName )
138 GetImplementation( *this ).RemoveJavascriptInterface( exposedObjectName, jsFunctionName );
141 void WebEngine::ClearHistory()
143 return GetImplementation( *this ).ClearHistory();
146 void WebEngine::ClearCache()
148 return GetImplementation( *this ).ClearCache();
151 void WebEngine::SetSize( int width, int height )
153 return GetImplementation( *this ).SetSize( width, height );
156 bool WebEngine::SendTouchEvent( const TouchData& touch )
158 return GetImplementation( *this ).SendTouchEvent( touch );
161 bool WebEngine::SendKeyEvent( const KeyEvent& event )
163 return GetImplementation( *this ).SendKeyEvent( event );
166 Dali::WebEnginePlugin::WebEngineSignalType& WebEngine::PageLoadStartedSignal()
168 return GetImplementation( *this ).PageLoadStartedSignal();
171 Dali::WebEnginePlugin::WebEngineSignalType& WebEngine::PageLoadFinishedSignal()
173 return GetImplementation( *this ).PageLoadFinishedSignal();