1 #ifndef DALI_WEB_ENGINE_IMPL_H
2 #define DALI_WEB_ENGINE_IMPL_H
5 * Copyright (c) 2018 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali/public-api/object/base-object.h>
25 #include <dali/devel-api/adaptor-framework/web-engine.h>
26 #include <dali/devel-api/adaptor-framework/web-engine-plugin.h>
39 typedef IntrusivePtr< WebEngine > WebEnginePtr;
42 * @brief WebEngine class is used for Web.
44 class WebEngine : public Dali::BaseObject
49 * @brief Creates a new WebEngine handle
51 * @return WebEngine pointer
53 static WebEnginePtr New();
56 * @copydoc Dali::WebEngine::Create()
58 void Create( int width, int height, const std::string& locale, const std::string& timezoneId );
61 * @copydoc Dali::WebEngine::Destroy()
66 * @copydoc Dali::WebEngine::GetNativeImageSource()
68 Dali::NativeImageInterfacePtr GetNativeImageSource();
71 * @copydoc Dali::WebEngine::LoadUrl()
73 void LoadUrl( const std::string& url );
76 * @copydoc Dali::WebEngine::GetUrl()
78 const std::string& GetUrl();
81 * @copydoc Dali::WebEngine::LoadHTMLString()
83 void LoadHTMLString( const std::string& htmlString );
86 * @copydoc Dali::WebEngine::Reload()
91 * @copydoc Dali::WebEngine::StopLoading()
96 * @copydoc Dali::WebEngine::CanGoForward()
101 * @copydoc Dali::WebEngine::GoForward()
106 * @copydoc Dali::WebEngine::CanGoBack()
111 * @copydoc Dali::WebEngine::GoBack()
116 * @copydoc Dali::WebEngine::EvaluateJavaScript()
118 void EvaluateJavaScript( const std::string& script );
121 * @copydoc Dali::WebEngine::AddJavaScriptInterface()
123 void AddJavaScriptInterface( const std::string& exposedObjectName, const std::string& jsFunctionName, std::function< std::string(const std::string&) > cb );
126 * @copydoc Dali::WebEngine::RemoveJavascriptInterface()
128 void RemoveJavascriptInterface( const std::string& exposedObjectName, const std::string& jsFunctionName );
131 * @copydoc Dali::WebEngine::ClearHistory()
136 * @copydoc Dali::WebEngine::ClearCache()
141 * @copydoc Dali::WebEngine::SetSize()
143 void SetSize( int width, int height );
146 * @copydoc Dali::WebEngine::SendTouchEvent()
148 bool SendTouchEvent( const Dali::TouchData& touch );
151 * @copydoc Dali::WebEngine::SendKeyEvent()
153 bool SendKeyEvent( const Dali::KeyEvent& event );
156 * @copydoc Dali::WebEngine::PageLoadStartedSignal()
158 Dali::WebEnginePlugin::WebEngineSignalType& PageLoadStartedSignal();
161 * @copydoc Dali::WebEngine::PageLoadFinishedSignal()
163 Dali::WebEnginePlugin::WebEngineSignalType& PageLoadFinishedSignal();
168 * @brief Constructor.
175 virtual ~WebEngine();
177 // Undefined copy constructor
178 WebEngine( const WebEngine& WebEngine );
180 // Undefined assignment operator
181 WebEngine& operator=( const WebEngine& WebEngine );
184 * @brief Initializes member data.
186 * @return Whether the initialization succeed or not.
192 Dali::WebEnginePlugin* mPlugin; ///< WebEngine plugin handle
193 void* mHandle; ///< Handle for the loaded library
195 typedef Dali::WebEnginePlugin* (*CreateWebEngineFunction)();
196 typedef void (*DestroyWebEngineFunction)( Dali::WebEnginePlugin* plugin );
198 CreateWebEngineFunction mCreateWebEnginePtr;
199 DestroyWebEngineFunction mDestroyWebEnginePtr;
202 } // namespace Adaptor
203 } // namespace Internal
205 inline static Internal::Adaptor::WebEngine& GetImplementation( Dali::WebEngine& webEngine )
207 DALI_ASSERT_ALWAYS( webEngine && "WebEngine handle is empty." );
209 BaseObject& handle = webEngine.GetBaseObject();
211 return static_cast< Internal::Adaptor::WebEngine& >( handle );
214 inline static const Internal::Adaptor::WebEngine& GetImplementation( const Dali::WebEngine& webEngine )
216 DALI_ASSERT_ALWAYS( webEngine && "WebEngine handle is empty." );
218 const BaseObject& handle = webEngine.GetBaseObject();
220 return static_cast< const Internal::Adaptor::WebEngine& >( handle );