1 #ifndef DALI_WEB_ENGINE_PLUGIN_H
2 #define DALI_WEB_ENGINE_PLUGIN_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/images/native-image-interface.h>
23 #include <dali/public-api/signals/dali-signal.h>
33 * @brief WebEnginePlugin is an abstract interface, used by dali-adaptor to access WebEngine plugin.
34 * A concrete implementation must be created for each platform and provided as dynamic library.
40 typedef Signal< void( const std::string& ) > WebEngineSignalType;
52 virtual ~WebEnginePlugin()
57 * @brief Creates WebEngine instance.
59 * @param [in] width The width of Web
60 * @param [in] height The height of Web
61 * @param [in] locale The locale of Web
62 * @param [in] timezoneId The timezoneID of Web
64 virtual void Create( int width, int height, const std::string& locale, const std::string& timezoneId ) = 0;
67 * @brief Destroys WebEngine instance.
69 virtual void Destroy() = 0;
72 * @brief Loads a web page based on a given URL.
74 * @param [in] url The URL of the resource to load
76 virtual void LoadUrl( const std::string& url ) = 0;
79 * @brief Gets image to render.
81 virtual NativeImageInterfacePtr GetNativeImageSource() = 0;
84 * @brief Returns the URL of the Web.
86 * @return Url of string type
88 virtual const std::string& GetUrl() = 0;
91 * @brief Loads a given string as web contents.
93 * @param [in] htmlString The string to use as the contents of the web page
95 virtual void LoadHTMLString( const std::string& htmlString ) = 0;
98 * @brief Reloads the Web.
100 virtual void Reload() = 0;
103 * @brief Stops loading web contents on the current page.
105 virtual void StopLoading() = 0;
108 * @brief Returns whether forward is possible.
110 * @return True if forward is possible, false otherwise
112 virtual bool CanGoForward() = 0;
115 * @brief Goes to forward.
117 virtual void GoForward() = 0;
120 * @brief Returns whether backward is possible.
122 * @return True if backward is possible, false otherwise
124 virtual bool CanGoBack() = 0;
127 * @brief Goes to back.
129 virtual void GoBack() = 0;
132 * @brief Evaluates JavaScript code represented as a string.
134 * @param[in] script The JavaScript code
136 virtual void EvaluateJavaScript( const std::string& script ) = 0;
139 * @brief Add a message handler into JavaScript.
141 * @param[in] exposedObjectName The name of exposed object
142 * @param[in] handler The callback function
144 virtual void AddJavaScriptMessageHandler( const std::string& exposedObjectName, std::function< void( const std::string& ) > handler ) = 0;
147 * @brief Clears the history of Web.
149 virtual void ClearHistory() = 0;
152 * @brief Clears the cache of Web.
154 virtual void ClearCache() = 0;
157 * @brief Sets size of Web Page.
159 virtual void SetSize( int width, int height ) = 0;
162 * @brief Sends Touch Events.
164 virtual bool SendTouchEvent( const TouchData& touch ) = 0;
167 * @brief Sends Key Events.
169 virtual bool SendKeyEvent( const KeyEvent& event ) = 0;
172 * @brief Connects to this signal to be notified when page loading is started.
174 * @return A signal object to connect with.
176 virtual WebEngineSignalType& PageLoadStartedSignal() = 0;
179 * @brief Connects to this signal to be notified when page loading is finished.
181 * @return A signal object to connect with.
183 virtual WebEngineSignalType& PageLoadFinishedSignal() = 0;