#define DALI_WEB_ENGINE_PLUGIN_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/**
* @brief WebEngine signal type related with page loading.
*/
- using WebEnginePageLoadSignalType = Signal< void( const std::string& ) >;
+ using WebEnginePageLoadSignalType = Signal<void(const std::string&)>;
/**
* @brief WebView signal type related with page loading error.
*/
- using WebEnginePageLoadErrorSignalType = Signal< void( const std::string&, int ) >;
+ using WebEnginePageLoadErrorSignalType = Signal<void(const std::string&, int)>;
// forward declaration.
enum class ScrollEdge;
/**
* @brief WebView signal type related with scroll edge reached.
*/
- using WebEngineScrollEdgeReachedSignalType = Signal< void( const ScrollEdge ) >;
+ using WebEngineScrollEdgeReachedSignalType = Signal<void(const ScrollEdge)>;
+
+ /**
+ * @brief WebView signal type related with page url changed.
+ */
+ using WebEngineUrlChangedSignalType = Signal<void(const std::string&)>;
+
+ /**
+ * @brief Alert callback when JavaScript alert is called with a message.
+ * It returns true if a pop-up is created successfully, false otherwise.
+ */
+ using JavaScriptAlertCallback = std::function<bool(const std::string&)>;
+
+ /**
+ * @brief Confirm callback when JavaScript confirm is called with a message.
+ * It returns true if a pop-up is created successfully, false otherwise.
+ */
+ using JavaScriptConfirmCallback = std::function<bool(const std::string&)>;
+
+ /**
+ * @brief Prompt callback when JavaScript prompt is called with a message
+ * and an optional value that is the default value for the input field.
+ * It returns true if a pop-up is created successfully, false otherwise.
+ */
+ using JavaScriptPromptCallback = std::function<bool(const std::string&, const std::string&)>;
/**
* @brief Enumeration for the scroll edge.
* @param [in] argc The count of application arguments
* @param [in] argv The string array of application arguments
*/
- virtual void Create( int width, int height, int argc, char** argv ) = 0;
+ virtual void Create(int width, int height, int argc, char** argv) = 0;
/**
* @brief Destroys WebEngine instance.
/**
* @brief Scrolls the webpage of view by deltaX and deltaY.
*/
- virtual void ScrollBy( int deltaX, int deltaY ) = 0;
+ virtual void ScrollBy(int deltaX, int deltaY) = 0;
/**
* @brief Scroll to the specified position of the given view.
*/
- virtual void SetScrollPosition( int x, int y ) = 0;
+ virtual void SetScrollPosition(int x, int y) = 0;
/**
* @brief Gets the current scroll position of the given view.
virtual void AddJavaScriptMessageHandler(const std::string& exposedObjectName, std::function<void(const std::string&)> handler) = 0;
/**
- * @brief Clears all tiles resources of Web.
+ * @brief Register a callback for JavaScript alert.
+ *
+ * @param[in] callback The callback function
*/
- virtual void ClearAllTilesResources() = 0;
+ virtual void RegisterJavaScriptAlertCallback(JavaScriptAlertCallback callback) = 0;
+
+ /**
+ * @brief Reply for JavaScript alert.
+ */
+ virtual void JavaScriptAlertReply() = 0;
+
+ /**
+ * @brief Register a callback for JavaScript confirm.
+ *
+ * @param[in] callback The callback function
+ */
+ virtual void RegisterJavaScriptConfirmCallback(JavaScriptConfirmCallback callback) = 0;
+
+ /**
+ * @brief Reply for JavaScript confirm.
+ */
+ virtual void JavaScriptConfirmReply( bool confirmed ) = 0;
+
+ /**
+ * @brief Register a callback for JavaScript prompt.
+ *
+ * @param[in] callback The callback function
+ */
+ virtual void RegisterJavaScriptPromptCallback( JavaScriptPromptCallback callback ) = 0;
+
+ /**
+ * @brief Reply for JavaScript prompt.
+ */
+ virtual void JavaScriptPromptReply( const std::string& result ) = 0;
/**
* @brief Clears the history of Web.
virtual void ClearHistory() = 0;
/**
+ * @brief Clears all tiles resources of Web.
+ */
+ virtual void ClearAllTilesResources() = 0;
+
+ /**
* @brief Get user agent string.
*
* @return The string value of user agent
/**
* @brief Sets focus.
*/
- virtual void SetFocus( bool focused ) = 0;
+ virtual void SetFocus(bool focused) = 0;
/**
* @brief Update display area.
* @param[in] displayArea The display area need be updated.
*/
- virtual void UpdateDisplayArea( Dali::Rect< int > displayArea ) = 0;
+ virtual void UpdateDisplayArea(Dali::Rect<int> displayArea) = 0;
/**
* @brief Enable video hole.
* @param[in] enabled True if enabled, false othewise.
*/
- virtual void EnableVideoHole( bool enabled ) = 0;
+ virtual void EnableVideoHole(bool enabled) = 0;
/**
* @brief Connects to this signal to be notified when page loading is started.
virtual WebEnginePageLoadSignalType& PageLoadStartedSignal() = 0;
/**
+ * @brief Connects to this signal to be notified when page loading is in progress.
+ *
+ * @return A signal object to connect with.
+ */
+ virtual WebEnginePageLoadSignalType& PageLoadInProgressSignal() = 0;
+
+ /**
* @brief Connects to this signal to be notified when page loading is finished.
*
* @return A signal object to connect with.
* @return A signal object to connect with.
*/
virtual WebEngineScrollEdgeReachedSignalType& ScrollEdgeReachedSignal() = 0;
+
+ /**
+ * @brief Connects to this signal to be notified when url is changed.
+ *
+ * @return A signal object to connect with.
+ */
+ virtual WebEngineUrlChangedSignalType& UrlChangedSignal() = 0;
+
};
} // namespace Dali