X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Fdevel-api%2Fadaptor-framework%2Fweb-engine-plugin.h;h=373b59da7dfb9b2baf92b75ec82bfddb546406b0;hb=72384c0ecf89fb0623ffbc55f49dd6b6b298170b;hp=215ea0d17c0c4d6a92c916f936102c80b23165d6;hpb=fadf01debf4e60ce5cd14a60ce08b93c92a66e29;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git diff --git a/dali/devel-api/adaptor-framework/web-engine-plugin.h b/dali/devel-api/adaptor-framework/web-engine-plugin.h index 215ea0d..373b59d 100644 --- a/dali/devel-api/adaptor-framework/web-engine-plugin.h +++ b/dali/devel-api/adaptor-framework/web-engine-plugin.h @@ -2,7 +2,7 @@ #define DALI_WEB_ENGINE_PLUGIN_H /* - * Copyright (c) 2018 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. @@ -20,14 +20,19 @@ // EXTERNAL INCLUDES #include +#include #include #include namespace Dali { - class KeyEvent; -class TouchData; +class PixelData; +class TouchEvent; +class WebEngineBackForwardList; +class WebEngineContext; +class WebEngineCookieManager; +class WebEngineSettings; /** * @brief WebEnginePlugin is an abstract interface, used by dali-adaptor to access WebEngine plugin. @@ -36,22 +41,68 @@ class TouchData; class WebEnginePlugin { public: + /** + * @brief WebEngine signal type related with page loading. + */ + using WebEnginePageLoadSignalType = Signal; - typedef Signal< void( const std::string& ) > WebEngineSignalType; + /** + * @brief WebView signal type related with page loading error. + */ + using WebEnginePageLoadErrorSignalType = Signal; + + // forward declaration. + enum class ScrollEdge; /** - * @brief Constructor. + * @brief WebView signal type related with scroll edge reached. + */ + using WebEngineScrollEdgeReachedSignalType = Signal; + + /** + * @brief WebView signal type related with page url changed. + */ + using WebEngineUrlChangedSignalType = Signal; + + /** + * @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; + + /** + * @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; + + /** + * @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; + + /** + * @brief Enumeration for the scroll edge. */ - WebEnginePlugin() + enum class ScrollEdge { - } + LEFT, ///< Left edge reached. + RIGHT, ///< Right edge reached. + TOP, ///< Top edge reached. + BOTTOM, ///< Bottom edge reached. + }; + + /** + * @brief Constructor. + */ + WebEnginePlugin() = default; /** * @brief Destructor. */ - virtual ~WebEnginePlugin() - { - } + virtual ~WebEnginePlugin() = default; /** * @brief Creates WebEngine instance. @@ -61,7 +112,17 @@ public: * @param [in] locale The locale of Web * @param [in] timezoneId The timezoneID of Web */ - virtual void Create( int width, int height, const std::string& locale, const std::string& timezoneId ) = 0; + virtual void Create(int width, int height, const std::string& locale, const std::string& timezoneId) = 0; + + /** + * @brief Creates WebEngine instance. + * + * @param [in] width The width of Web + * @param [in] height The height of Web + * @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; /** * @brief Destroys WebEngine instance. @@ -69,11 +130,45 @@ public: virtual void Destroy() = 0; /** + * @brief Get settings of WebEngine. + */ + virtual WebEngineSettings& GetSettings() const = 0; + + /** + * @brief Get context of WebEngine. + */ + virtual WebEngineContext& GetContext() const = 0; + + /** + * @brief Get cookie manager of WebEngine. + */ + virtual WebEngineCookieManager& GetCookieManager() const = 0; + + /** + * @brief Get back-forward list of WebEngine. + */ + virtual WebEngineBackForwardList& GetBackForwardList() const = 0; + + /** * @brief Loads a web page based on a given URL. * * @param [in] url The URL of the resource to load */ - virtual void LoadUrl( const std::string& url ) = 0; + virtual void LoadUrl(const std::string& url) = 0; + + /** + * @brief Returns the title of the Web. + * + * @return The title of web page + */ + virtual std::string GetTitle() const = 0; + + /** + * @brief Returns the Favicon of the Web. + * + * @return Favicon of Dali::PixelData& type + */ + virtual Dali::PixelData GetFavicon() const = 0; /** * @brief Gets image to render. @@ -92,7 +187,7 @@ public: * * @param [in] htmlString The string to use as the contents of the web page */ - virtual void LoadHTMLString( const std::string& htmlString ) = 0; + virtual void LoadHtmlString(const std::string& htmlString) = 0; /** * @brief Reloads the Web. @@ -105,6 +200,41 @@ public: virtual void StopLoading() = 0; /** + * @brief Suspends the operation associated with the view. + */ + virtual void Suspend() = 0; + + /** + * @brief Resumes the operation associated with the view object after calling Suspend(). + */ + virtual void Resume() = 0; + + /** + * @brief Scrolls the webpage of view by deltaX and deltaY. + */ + 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; + + /** + * @brief Gets the current scroll position of the given view. + */ + virtual Dali::Vector2 GetScrollPosition() const = 0; + + /** + * @brief Gets the possible scroll size of the given view. + */ + virtual Dali::Vector2 GetScrollSize() const = 0; + + /** + * @brief Gets the last known content's size. + */ + virtual Dali::Vector2 GetContentSize() const = 0; + + /** * @brief Returns whether forward is possible. * * @return True if forward is possible, false otherwise @@ -129,28 +259,56 @@ public: virtual void GoBack() = 0; /** - * @brief Evaluates JavaScript code represented as a string. - * - * @param[in] script The JavaScript code - */ - virtual void EvaluateJavaScript( const std::string& script ) = 0; + * @brief Evaluates JavaScript code represented as a string. + * + * @param[in] script The JavaScript code + * @param[in] resultHandler The callback function to be called by the JavaScript runtime. This carries evaluation result. + */ + virtual void EvaluateJavaScript(const std::string& script, std::function resultHandler) = 0; + + /** + * @brief Add a message handler into JavaScript. + * + * @param[in] exposedObjectName The name of exposed object + * @param[in] handler The callback function + */ + virtual void AddJavaScriptMessageHandler(const std::string& exposedObjectName, std::function handler) = 0; + + /** + * @brief Register a callback for JavaScript alert. + * + * @param[in] callback The callback function + */ + virtual void RegisterJavaScriptAlertCallback(JavaScriptAlertCallback callback) = 0; + + /** + * @brief Reply for JavaScript alert. + */ + virtual void JavaScriptAlertReply() = 0; /** - * @brief Adds a JavaScript interface. - * - * @param[in] exposedObjectName The name of exposed object - * @param[in] jsFunctionName The name of JavaScript function - * @param[in] cb The callback function - */ - virtual void AddJavaScriptInterface( const std::string& exposedObjectName, const std::string& jsFunctionName, std::function< std::string(const std::string&) > cb ) = 0; + * @brief Register a callback for JavaScript confirm. + * + * @param[in] callback The callback function + */ + virtual void RegisterJavaScriptConfirmCallback(JavaScriptConfirmCallback callback) = 0; /** - * @brief Removes a JavaScript interface. - * - * @param[in] exposedObjectName The name of exposed object - * @param[in] jsFunctionName The name of JavaScript function - */ - virtual void RemoveJavascriptInterface( const std::string& exposedObjectName, const std::string& jsFunctionName ) = 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. @@ -158,41 +316,100 @@ public: virtual void ClearHistory() = 0; /** - * @brief Clears the cache of Web. + * @brief Clears all tiles resources of Web. + */ + virtual void ClearAllTilesResources() = 0; + + /** + * @brief Get user agent string. + * + * @return The string value of user agent */ - virtual void ClearCache() = 0; + virtual const std::string& GetUserAgent() const = 0; + + /** + * @brief Set user agent string. + * + * @param[in] userAgent The string value of user agent + */ + virtual void SetUserAgent(const std::string& userAgent) = 0; /** * @brief Sets size of Web Page. */ - virtual void SetSize( int width, int height ) = 0; + virtual void SetSize(int width, int height) = 0; /** * @brief Sends Touch Events. */ - virtual bool SendTouchEvent( const TouchData& touch ) = 0; + virtual bool SendTouchEvent(const TouchEvent& touch) = 0; /** * @brief Sends Key Events. */ - virtual bool SendKeyEvent( const KeyEvent& event ) = 0; + virtual bool SendKeyEvent(const KeyEvent& event) = 0; + + /** + * @brief Sets focus. + */ + virtual void SetFocus(bool focused) = 0; + + /** + * @brief Update display area. + * @param[in] displayArea The display area need be updated. + */ + virtual void UpdateDisplayArea(Dali::Rect displayArea) = 0; + + /** + * @brief Enable video hole. + * @param[in] enabled True if enabled, false othewise. + */ + virtual void EnableVideoHole(bool enabled) = 0; /** * @brief Connects to this signal to be notified when page loading is started. * * @return A signal object to connect with. */ - virtual WebEngineSignalType& PageLoadStartedSignal() = 0; + 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. */ - virtual WebEngineSignalType& PageLoadFinishedSignal() = 0; + virtual WebEnginePageLoadSignalType& PageLoadFinishedSignal() = 0; + + /** + * @brief Connects to this signal to be notified when an error occurs in page loading. + * + * @return A signal object to connect with. + */ + virtual WebEnginePageLoadErrorSignalType& PageLoadErrorSignal() = 0; + + /** + * @brief Connects to this signal to be notified when scroll edge is reached. + * + * @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; +} // namespace Dali #endif