From 3e3cbc8f86561512eca7b370c0633a640474256e Mon Sep 17 00:00:00 2001 From: "huayong.xu" Date: Thu, 4 Mar 2021 17:38:39 +0800 Subject: [PATCH] Add some APIs into web engine. This patch is to add some APIs into web engine, such as GetScreenshot, GetScreenshotAsynchronously, FindText, etc. Change-Id: I7bc7738853c302e543cbf26760dd86f8ab71dac0 --- .../adaptor-framework/web-engine-plugin.h | 242 ++++++++++++++++++++- dali/devel-api/adaptor-framework/web-engine.cpp | 125 +++++++++++ dali/devel-api/adaptor-framework/web-engine.h | 214 +++++++++++++++++- .../internal/web-engine/common/web-engine-impl.cpp | 125 +++++++++++ dali/internal/web-engine/common/web-engine-impl.h | 129 ++++++++++- 5 files changed, 824 insertions(+), 11 deletions(-) diff --git a/dali/devel-api/adaptor-framework/web-engine-plugin.h b/dali/devel-api/adaptor-framework/web-engine-plugin.h index 4adc1fb..3432996 100755 --- a/dali/devel-api/adaptor-framework/web-engine-plugin.h +++ b/dali/devel-api/adaptor-framework/web-engine-plugin.h @@ -19,6 +19,7 @@ */ // EXTERNAL INCLUDES +#include #include #include #include @@ -69,6 +70,24 @@ public: using WebEngineUrlChangedSignalType = Signal; /** + * @brief WebView signal type related with screen captured. + */ + using ScreenshotCapturedCallback = std::function; + + /** + * @brief WebView signal type related with geolocation permission. + * Host and protocol of security origin will be provided when requesting + * geolocation permission. + * It returns true if a pop-up is created successfully, false otherwise. + */ + using GeolocationPermissionCallback = std::function; + + /** + * @brief WebView signal type related with video playing. + */ + using VideoPlayingCallback = std::function; + + /** * @brief Alert callback when JavaScript alert is called with a message. * It returns true if a pop-up is created successfully, false otherwise. */ @@ -109,6 +128,22 @@ public: }; /** + * @brief Enumeration that provides the option to find text. + */ + enum class FindOption + { + NONE = 0, ///< No search flags, this means a case sensitive, no wrap, forward only search + CASE_INSENSITIVE = 1 << 0, ///< Case insensitive search + AT_WORD_STARTS = 1 << 1, ///< Search text only at the beginning of the words + TREAT_MEDIAL_CAPITAL_AS_WORD_START = 1 << 2, ///< Treat capital letters in the middle of words as word start + BACKWARDS = 1 << 3, ///< Search backwards + WRAP_AROUND = 1 << 4, ///< If not present the search stops at the end of the document + SHOW_OVERLAY = 1 << 5, ///< Show overlay + SHOW_FIND_INDICATOR = 1 << 6, ///< Show indicator + SHOW_HIGHLIGHT = 1 << 7, ///< Show highlight + }; + + /** * @brief Constructor. */ WebEnginePlugin() = default; @@ -204,11 +239,40 @@ public: virtual void LoadHtmlString(const std::string& htmlString) = 0; /** + * @brief Load the specified html string as the content of the view overriding current history entry + * + * @param[in] html HTML data to load + * @param[in] basicUri Base URL used for relative paths to external objects + * @param[in] unreachableUrl URL that could not be reached + * + * @return true if successfully loaded, false otherwise + */ + virtual bool LoadHtmlStringOverrideCurrentEntry(const std::string& html, const std::string& basicUri, const std::string& unreachableUrl) = 0; + + /** + * @brief Requests loading the given contents by MIME type into the view object + * + * @param[in] contents The content to load + * @param[in] contentSize The size of contents (in bytes) + * @param[in] mimeType The type of contents, if 0 is given "text/html" is assumed + * @param[in] encoding The encoding for contents, if 0 is given "UTF-8" is assumed + * @param[in] baseUri The base URI to use for relative resources + * + * @return true if successfully request, false otherwise + */ + virtual bool LoadContents(const std::string& contents, uint32_t contentSize, const std::string& mimeType, const std::string& encoding, const std::string& baseUri) = 0; + + /** * @brief Reloads the Web. */ virtual void Reload() = 0; /** + * @brief Reloads the current page's document without cache + */ + virtual bool ReloadWithoutCache() = 0; + + /** * @brief Stops loading web contents on the current page. */ virtual void StopLoading() = 0; @@ -224,11 +288,69 @@ public: virtual void Resume() = 0; /** - * @brief Scrolls the webpage of view by deltaX and deltaY. + * @brief To suspend all url loading + */ + virtual void SuspendNetworkLoading() = 0; + + /** + * @brief To resume new url network loading + */ + virtual void ResumeNetworkLoading() = 0; + + /** + * @brief Add custom header + * + * @param[in] name custom header name to add the custom header + * @param[in] value custom header value to add the custom header + * + * @return true if succeeded, false otherwise + */ + virtual bool AddCustomHeader(const std::string& name, const std::string& value) = 0; + + /** + * @brief Remove custom header + * + * @param[in] name custom header name to remove the custom header + * + * @return true if succeeded, false otherwise + */ + virtual bool RemoveCustomHeader(const std::string& name) = 0; + + /** + * @brief Start the inspector server + * + * @param[in] port port number + * + * @return the port number + */ + virtual uint32_t StartInspectorServer(uint32_t port) = 0; + + /** + * @brief Stop the inspector server + * + * @return true if succeeded, false otherwise + */ + virtual bool StopInspectorServer() = 0; + + /** + * @brief Scrolls web page of view by deltaX and deltaY. + * + * @param[in] deltaX horizontal offset to scroll + * @param[in] deltaY vertical offset to scroll */ virtual void ScrollBy(int deltaX, int deltaY) = 0; /** + * @brief Scrolls edge of view by deltaX and deltaY. + * + * @param[in] deltaX horizontal offset to scroll + * @param[in] deltaY vertical offset to scroll + * + * @return true if succeeded, false otherwise + */ + virtual bool ScrollEdgeBy(int deltaX, int deltaY) = 0; + + /** * @brief Scroll to the specified position of the given view. */ virtual void SetScrollPosition(int x, int y) = 0; @@ -417,6 +539,117 @@ public: virtual void SetFocus(bool focused) = 0; /** + * @brief Sets zoom factor of the current page. + * @param[in] zoomFactor a new factor to be set. + */ + virtual void SetPageZoomFactor(float zoomFactor) = 0; + + /** + * @brief Queries the current zoom factor of the page。 + * @return The current page zoom factor. + */ + virtual float GetPageZoomFactor() const = 0; + + /** + * @brief Sets the current text zoom level。. + * @param[in] zoomFactor a new factor to be set. + */ + virtual void SetTextZoomFactor(float zoomFactor) = 0; + + /** + * @brief Gets the current text zoom level. + * @return The current text zoom factor. + */ + virtual float GetTextZoomFactor() const = 0; + + /** + * @brief Gets the current load progress of the page. + * @return The load progress of the page. + */ + virtual float GetLoadProgressPercentage() const = 0; + + /** + * @brief Scales the current page, centered at the given point. + * @param[in] scaleFactor a new factor to be scaled. + * @param[in] point a center coordinate. + */ + virtual void SetScaleFactor(float scaleFactor, Dali::Vector2 point) = 0; + + /** + * @brief Gets the current scale factor of the page. + * @return The current scale factor. + */ + virtual float GetScaleFactor() const = 0; + + /** + * @brief Request to activate/deactivate the accessibility usage set by web app. + * @param[in] activated Activate accessibility or not. + */ + virtual void ActivateAccessibility(bool activated) = 0; + + /** + * @brief Request to set the current page's visibility. + * @param[in] visible Visible or not. + * + * @return true if succeeded, false otherwise + */ + virtual bool SetVisibility(bool visible) = 0; + + /** + * @brief Searches and highlights the given string in the document. + * @param[in] text The text to find + * @param[in] options The options to find + * @param[in] maxMatchCount The maximum match count to find + * + * @return true if found & highlighted, false otherwise + */ + virtual bool HighlightText(const std::string& text, FindOption options, uint32_t maxMatchCount) = 0; + + /** + * @brief Add dynamic certificate path. + * @param[in] host host that required client authentication + * @param[in] certPath the file path stored certificate + */ + virtual void AddDynamicCertificatePath(const std::string& host, const std::string& certPath) = 0; + + /** + * @brief Get snapshot of the specified viewArea of page. + * + * @param[in] viewArea The rectangle of screen shot + * @param[in] scaleFactor The scale factor + * + * @return pixel data of screen shot + */ + virtual Dali::PixelData GetScreenshot(Dali::Rect viewArea, float scaleFactor) = 0; + + /** + * @brief Request to get snapshot of the specified viewArea of page asynchronously. + * + * @param[in] viewArea The rectangle of screen shot + * @param[in] scaleFactor The scale factor + * @param[in] callback The callback for screen shot + * + * @return true if requested successfully, false otherwise + */ + virtual bool GetScreenshotAsynchronously(Dali::Rect viewArea, float scaleFactor, ScreenshotCapturedCallback callback) = 0; + + /** + * @brief Asynchronously request to check if there is a video playing in the given view. + * + * @param[in] callback The callback called after checking if video is playing or not + * + * @return true if requested successfully, false otherwise + */ + virtual bool CheckVideoPlayingAsynchronously(VideoPlayingCallback callback) = 0; + + /** + * @brief Sets callback which will be called upon geolocation permission request. + * + * @param[in] callback The callback for requesting geolocation permission + */ + virtual void RegisterGeolocationPermissionCallback(GeolocationPermissionCallback callback) = 0; + + /** * @brief Update display area. * @param[in] displayArea The display area need be updated. */ @@ -497,6 +730,13 @@ public: virtual WebEngineFrameRenderedSignalType& FrameRenderedSignal() = 0; }; +// specialization has to be done in the same namespace +template<> +struct EnableBitMaskOperators +{ + static const bool ENABLE = true; +}; + } // namespace Dali #endif diff --git a/dali/devel-api/adaptor-framework/web-engine.cpp b/dali/devel-api/adaptor-framework/web-engine.cpp index e94bd58..d5c7c96 100755 --- a/dali/devel-api/adaptor-framework/web-engine.cpp +++ b/dali/devel-api/adaptor-framework/web-engine.cpp @@ -134,11 +134,26 @@ void WebEngine::LoadHtmlString(const std::string& htmlString) GetImplementation(*this).LoadHtmlString(htmlString); } +bool WebEngine::LoadHtmlStringOverrideCurrentEntry(const std::string& html, const std::string& basicUri, const std::string& unreachableUrl) +{ + return GetImplementation(*this).LoadHtmlStringOverrideCurrentEntry(html, basicUri, unreachableUrl); +} + +bool WebEngine::LoadContents(const std::string& contents, uint32_t contentSize, const std::string& mimeType, const std::string& encoding, const std::string& baseUri) +{ + return GetImplementation(*this).LoadContents(contents, contentSize, mimeType, encoding, baseUri); +} + void WebEngine::Reload() { GetImplementation(*this).Reload(); } +bool WebEngine::ReloadWithoutCache() +{ + return GetImplementation(*this).ReloadWithoutCache(); +} + void WebEngine::StopLoading() { GetImplementation(*this).StopLoading(); @@ -154,11 +169,46 @@ void WebEngine::Resume() GetImplementation(*this).Resume(); } +void WebEngine::SuspendNetworkLoading() +{ + GetImplementation(*this).SuspendNetworkLoading(); +} + +void WebEngine::ResumeNetworkLoading() +{ + GetImplementation(*this).ResumeNetworkLoading(); +} + +bool WebEngine::AddCustomHeader(const std::string& name, const std::string& value) +{ + return GetImplementation(*this).AddCustomHeader(name, value); +} + +bool WebEngine::RemoveCustomHeader(const std::string& name) +{ + return GetImplementation(*this).RemoveCustomHeader(name); +} + +uint32_t WebEngine::StartInspectorServer(uint32_t port) +{ + return GetImplementation(*this).StartInspectorServer(port); +} + +bool WebEngine::StopInspectorServer() +{ + return GetImplementation(*this).StopInspectorServer(); +} + void WebEngine::ScrollBy(int deltaX, int deltaY) { GetImplementation(*this).ScrollBy(deltaX, deltaY); } +bool WebEngine::ScrollEdgeBy(int deltaX, int deltaY) +{ + return GetImplementation(*this).ScrollEdgeBy(deltaX, deltaY); +} + void WebEngine::SetScrollPosition(int x, int y) { GetImplementation(*this).SetScrollPosition(x, y); @@ -314,6 +364,81 @@ void WebEngine::SetFocus(bool focused) GetImplementation(*this).SetFocus(focused); } +void WebEngine::SetPageZoomFactor(float zoomFactor) +{ + GetImplementation(*this).SetPageZoomFactor(zoomFactor); +} + +float WebEngine::GetPageZoomFactor() const +{ + return GetImplementation(*this).GetPageZoomFactor(); +} + +void WebEngine::SetTextZoomFactor(float zoomFactor) +{ + GetImplementation(*this).SetTextZoomFactor(zoomFactor); +} + +float WebEngine::GetTextZoomFactor() const +{ + return GetImplementation(*this).GetTextZoomFactor(); +} + +float WebEngine::GetLoadProgressPercentage() const +{ + return GetImplementation(*this).GetLoadProgressPercentage(); +} + +void WebEngine::SetScaleFactor(float scaleFactor, Dali::Vector2 point) +{ + GetImplementation(*this).SetScaleFactor(scaleFactor, point); +} + +float WebEngine::GetScaleFactor() const +{ + return GetImplementation(*this).GetScaleFactor(); +} + +void WebEngine::ActivateAccessibility(bool activated) +{ + GetImplementation(*this).ActivateAccessibility(activated); +} + +bool WebEngine::SetVisibility(bool visible) +{ + return GetImplementation(*this).SetVisibility(visible); +} + +bool WebEngine::HighlightText(const std::string& text, Dali::WebEnginePlugin::FindOption options, uint32_t maxMatchCount) +{ + return GetImplementation(*this).HighlightText(text, options, maxMatchCount); +} + +void WebEngine::AddDynamicCertificatePath(const std::string& host, const std::string& certPath) +{ + GetImplementation(*this).AddDynamicCertificatePath(host, certPath); +} + +Dali::PixelData WebEngine::GetScreenshot(Dali::Rect viewArea, float scaleFactor) +{ + return GetImplementation(*this).GetScreenshot(viewArea, scaleFactor); +} + +bool WebEngine::GetScreenshotAsynchronously(Dali::Rect viewArea, float scaleFactor, Dali::WebEnginePlugin::ScreenshotCapturedCallback callback) +{ + return GetImplementation(*this).GetScreenshotAsynchronously(viewArea, scaleFactor, callback); +} + +bool WebEngine::CheckVideoPlayingAsynchronously(Dali::WebEnginePlugin::VideoPlayingCallback callback) +{ + return GetImplementation(*this).CheckVideoPlayingAsynchronously(callback); +} + +void WebEngine::RegisterGeolocationPermissionCallback(Dali::WebEnginePlugin::GeolocationPermissionCallback callback) +{ + GetImplementation(*this).RegisterGeolocationPermissionCallback(callback); +} + void WebEngine::UpdateDisplayArea(Dali::Rect displayArea) { GetImplementation(*this).UpdateDisplayArea(displayArea); diff --git a/dali/devel-api/adaptor-framework/web-engine.h b/dali/devel-api/adaptor-framework/web-engine.h index ad49b52..b4b997e 100755 --- a/dali/devel-api/adaptor-framework/web-engine.h +++ b/dali/devel-api/adaptor-framework/web-engine.h @@ -170,11 +170,40 @@ public: void LoadHtmlString(const std::string& htmlString); /** + * @brief Load the specified html string as the content of the view overriding current history entry + * + * @param[in] html HTML data to load + * @param[in] basicUri Base URL used for relative paths to external objects + * @param[in] unreachableUrl URL that could not be reached + * + * @return true if successfully loaded, false otherwise + */ + bool LoadHtmlStringOverrideCurrentEntry(const std::string& html, const std::string& basicUri, const std::string& unreachableUrl); + + /** + * @brief Requests loading the given contents by MIME type into the view object + * + * @param[in] contents The content to load + * @param[in] contentSize The size of contents (in bytes) + * @param[in] mimeType The type of contents, if 0 is given "text/html" is assumed + * @param[in] encoding The encoding for contents, if 0 is given "UTF-8" is assumed + * @param[in] baseUri The base URI to use for relative resources + * + * @return true if successfully request, false otherwise + */ + bool LoadContents(const std::string& contents, uint32_t contentSize, const std::string& mimeType, const std::string& encoding, const std::string& baseUri); + + /** * @brief Reloads the Web. */ void Reload(); /** + * @brief Reloads the current page's document without cache + */ + bool ReloadWithoutCache(); + + /** * @brief Stops loading web contents on the current page. */ void StopLoading(); @@ -190,11 +219,69 @@ public: void Resume(); /** - * @brief Scrolls the webpage of view by deltaX and deltaY. + * @brief To suspend all url loading + */ + void SuspendNetworkLoading(); + + /** + * @brief To resume new url network loading + */ + void ResumeNetworkLoading(); + + /** + * @brief Add custom header + * + * @param[in] name custom header name to add the custom header + * @param[in] value custom header value to add the custom header + * + * @return true if succeeded, false otherwise + */ + bool AddCustomHeader(const std::string& name, const std::string& value); + + /** + * @brief Remove custom header + * + * @param[in] name custom header name to remove the custom header + * + * @return true if succeeded, false otherwise + */ + bool RemoveCustomHeader(const std::string& name); + + /** + * @brief Start the inspector server + * + * @param[in] port port number + * + * @return the port number + */ + uint32_t StartInspectorServer(uint32_t port); + + /** + * @brief Stop the inspector server + * + * @return true if succeeded, false otherwise + */ + bool StopInspectorServer(); + + /** + * @brief Scrolls web page of view by deltaX and deltaY. + * + * @param[in] deltaX horizontal offset to scroll + * @param[in] deltaY vertical offset to scroll */ void ScrollBy(int deltaX, int deltaY); /** + * @brief Scrolls edge of view by deltaX and deltaY. + * + * @param[in] deltaX horizontal offset to scroll + * @param[in] deltaY vertical offset to scroll + * + * @return true if succeeded, false otherwise + */ + bool ScrollEdgeBy(int deltaX, int deltaY); + + /** * @brief Sets an absolute scroll of the given view. */ void SetScrollPosition(int x, int y); @@ -387,8 +474,119 @@ public: void EnableKeyEvents( bool enabled ); /** + * @brief Sets zoom factor of the current page. + * @param[in] zoomFactor a new factor to be set. + */ + void SetPageZoomFactor(float zoomFactor); + + /** + * @brief Queries the current zoom factor of the page。 + * @return The current page zoom factor. + */ + float GetPageZoomFactor() const; + + /** + * @brief Sets the current text zoom level。. + * @param[in] zoomFactor a new factor to be set. + */ + void SetTextZoomFactor(float zoomFactor); + + /** + * @brief Gets the current text zoom level. + * @return The current text zoom factor. + */ + float GetTextZoomFactor() const; + + /** + * @brief Gets the current load progress of the page. + * @return The load progress of the page. + */ + float GetLoadProgressPercentage() const; + + /** + * @brief Scales the current page, centered at the given point. + * @param[in] scaleFactor a new factor to be scaled. + * @param[in] point a center coordinate. + */ + void SetScaleFactor(float scaleFactor, Dali::Vector2 point); + + /** + * @brief Gets the current scale factor of the page. + * @return The current scale factor. + */ + float GetScaleFactor() const; + + /** + * @brief Request to activate/deactivate the accessibility usage set by web app. + * @param[in] activated Activate accessibility or not. + */ + void ActivateAccessibility(bool activated); + + /** + * @brief Request to set the current page's visibility. + * @param[in] visible Visible or not. + * + * @return true if changed successfully, false otherwise + */ + bool SetVisibility(bool visible); + + /** + * @brief Searches and highlights the given string in the document. + * @param[in] text The text to find + * @param[in] options The options to find + * @param[in] maxMatchCount The maximum match count to find + * + * @return true if found & highlighted, false otherwise + */ + bool HighlightText(const std::string& text, Dali::WebEnginePlugin::FindOption options, uint32_t maxMatchCount); + + /** + * @brief Add dynamic certificate path. + * @param[in] host host that required client authentication + * @param[in] certPath the file path stored certificate + */ + void AddDynamicCertificatePath(const std::string& host, const std::string& certPath); + + /** + * @brief Get snapshot of the specified viewArea of page. + * + * @param[in] viewArea The rectangle of screen shot + * @param[in] scaleFactor The scale factor + * + * @return pixel data of screen shot + */ + Dali::PixelData GetScreenshot(Dali::Rect viewArea, float scaleFactor); + + /** + * @brief Request to get snapshot of the specified viewArea of page asynchronously. + * + * @param[in] viewArea The rectangle of screen shot + * @param[in] scaleFactor The scale factor + * @param[in] callback The callback for screen shot + * + * @return true if requested successfully, false otherwise + */ + bool GetScreenshotAsynchronously(Dali::Rect viewArea, float scaleFactor, Dali::WebEnginePlugin::ScreenshotCapturedCallback callback); + + /** + * @brief Asynchronous request to check if there is a video playing in the given view. + * + * @param[in] callback The callback called after checking if video is playing or not + * + * @return true if requested successfully, false otherwise + */ + bool CheckVideoPlayingAsynchronously(Dali::WebEnginePlugin::VideoPlayingCallback callback); + + /** + * @brief Sets callback which alled upon geolocation permission request. + * + * @param[in] callback The callback for requesting geolocation permission + */ + void RegisterGeolocationPermissionCallback(Dali::WebEnginePlugin::GeolocationPermissionCallback callback); + + /** * @brief Update display area. - * @param[in] displayArea The area to display web page. + * @param[in] displayArea The area to display web page */ void UpdateDisplayArea(Dali::Rect displayArea); @@ -413,42 +611,42 @@ public: /** * @brief Connects to this signal to be notified when page loading is started. * - * @return A signal object to connect with. + * @return A signal object to connect with */ Dali::WebEnginePlugin::WebEnginePageLoadSignalType& PageLoadStartedSignal(); /** * @brief Connects to this signal to be notified when page loading is in progress. * - * @return A signal object to connect with. + * @return A signal object to connect with */ Dali::WebEnginePlugin::WebEnginePageLoadSignalType& PageLoadInProgressSignal(); /** * @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 */ Dali::WebEnginePlugin::WebEnginePageLoadSignalType& PageLoadFinishedSignal(); /** * @brief Connects to this signal to be notified when an error occurs in page loading. * - * @return A signal object to connect with. + * @return A signal object to connect with */ Dali::WebEnginePlugin::WebEnginePageLoadErrorSignalType& PageLoadErrorSignal(); /** * @brief Connects to this signal to be notified when scroll edge is reached. * - * @return A signal object to connect with. + * @return A signal object to connect with */ Dali::WebEnginePlugin::WebEngineScrollEdgeReachedSignalType& ScrollEdgeReachedSignal(); /** * @brief Connects to this signal to be notified when url is changed. * - * @return A signal object to connect with. + * @return A signal object to connect with */ Dali::WebEnginePlugin::WebEngineUrlChangedSignalType& UrlChangedSignal(); diff --git a/dali/internal/web-engine/common/web-engine-impl.cpp b/dali/internal/web-engine/common/web-engine-impl.cpp index 257b067..c4eab0d 100755 --- a/dali/internal/web-engine/common/web-engine-impl.cpp +++ b/dali/internal/web-engine/common/web-engine-impl.cpp @@ -239,11 +239,26 @@ void WebEngine::LoadHtmlString(const std::string& htmlString) mPlugin->LoadHtmlString(htmlString); } +bool WebEngine::LoadHtmlStringOverrideCurrentEntry(const std::string& html, const std::string& basicUri, const std::string& unreachableUrl) +{ + return mPlugin->LoadHtmlStringOverrideCurrentEntry(html, basicUri, unreachableUrl); +} + +bool WebEngine::LoadContents(const std::string& contents, uint32_t contentSize, const std::string& mimeType, const std::string& encoding, const std::string& baseUri) +{ + return mPlugin->LoadContents(contents, contentSize, mimeType, encoding, baseUri); +} + void WebEngine::Reload() { mPlugin->Reload(); } +bool WebEngine::ReloadWithoutCache() +{ + return mPlugin->ReloadWithoutCache(); +} + void WebEngine::StopLoading() { mPlugin->StopLoading(); @@ -259,11 +274,46 @@ void WebEngine::Resume() mPlugin->Resume(); } +void WebEngine::SuspendNetworkLoading() +{ + mPlugin->SuspendNetworkLoading(); +} + +void WebEngine::ResumeNetworkLoading() +{ + mPlugin->ResumeNetworkLoading(); +} + +bool WebEngine::AddCustomHeader(const std::string& name, const std::string& value) +{ + return mPlugin->AddCustomHeader(name, value); +} + +bool WebEngine::RemoveCustomHeader(const std::string& name) +{ + return mPlugin->RemoveCustomHeader(name); +} + +uint32_t WebEngine::StartInspectorServer(uint32_t port) +{ + return mPlugin->StartInspectorServer(port); +} + +bool WebEngine::StopInspectorServer() +{ + return mPlugin->StopInspectorServer(); +} + void WebEngine::ScrollBy(int deltaX, int deltaY) { mPlugin->ScrollBy(deltaX, deltaY); } +bool WebEngine::ScrollEdgeBy(int deltaX, int deltaY) +{ + return mPlugin->ScrollEdgeBy(deltaX, deltaY); +} + void WebEngine::SetScrollPosition(int x, int y) { mPlugin->SetScrollPosition(x, y); @@ -409,6 +459,81 @@ std::string WebEngine::GetSelectedText() const return mPlugin->GetSelectedText(); } +void WebEngine::SetPageZoomFactor(float zoomFactor) +{ + mPlugin->SetPageZoomFactor(zoomFactor); +} + +float WebEngine::GetPageZoomFactor() const +{ + return mPlugin->GetPageZoomFactor(); +} + +void WebEngine::SetTextZoomFactor(float zoomFactor) +{ + mPlugin->SetTextZoomFactor(zoomFactor); +} + +float WebEngine::GetTextZoomFactor() const +{ + return mPlugin->GetTextZoomFactor(); +} + +float WebEngine::GetLoadProgressPercentage() const +{ + return mPlugin->GetLoadProgressPercentage(); +} + +void WebEngine::SetScaleFactor(float scaleFactor, Dali::Vector2 point) +{ + mPlugin->SetScaleFactor(scaleFactor, point); +} + +float WebEngine::GetScaleFactor() const +{ + return mPlugin->GetScaleFactor(); +} + +void WebEngine::ActivateAccessibility(bool activated) +{ + mPlugin->ActivateAccessibility(activated); +} + +bool WebEngine::SetVisibility(bool visible) +{ + return mPlugin->SetVisibility(visible); +} + +bool WebEngine::HighlightText(const std::string& text, Dali::WebEnginePlugin::FindOption options, uint32_t maxMatchCount) +{ + return mPlugin->HighlightText(text, options, maxMatchCount); +} + +void WebEngine::AddDynamicCertificatePath(const std::string& host, const std::string& certPath) +{ + mPlugin->AddDynamicCertificatePath(host, certPath); +} + +Dali::PixelData WebEngine::GetScreenshot(Dali::Rect viewArea, float scaleFactor) +{ + return mPlugin->GetScreenshot(viewArea, scaleFactor); +} + +bool WebEngine::GetScreenshotAsynchronously(Dali::Rect viewArea, float scaleFactor, Dali::WebEnginePlugin::ScreenshotCapturedCallback callback) +{ + return mPlugin->GetScreenshotAsynchronously(viewArea, scaleFactor, callback); +} + +bool WebEngine::CheckVideoPlayingAsynchronously(Dali::WebEnginePlugin::VideoPlayingCallback callback) +{ + return mPlugin->CheckVideoPlayingAsynchronously(callback); +} + +void WebEngine::RegisterGeolocationPermissionCallback(Dali::WebEnginePlugin::GeolocationPermissionCallback callback) +{ + mPlugin->RegisterGeolocationPermissionCallback(callback); +} + void WebEngine::UpdateDisplayArea(Dali::Rect displayArea) { mPlugin->UpdateDisplayArea(displayArea); diff --git a/dali/internal/web-engine/common/web-engine-impl.h b/dali/internal/web-engine/common/web-engine-impl.h index 9e78e72..88834f1 100644 --- a/dali/internal/web-engine/common/web-engine-impl.h +++ b/dali/internal/web-engine/common/web-engine-impl.h @@ -130,11 +130,26 @@ public: void LoadHtmlString(const std::string& htmlString); /** + * @copydoc Dali::WebEngine::LoadHtmlStringOverrideCurrentEntry() + */ + bool LoadHtmlStringOverrideCurrentEntry(const std::string& html, const std::string& basicUri, const std::string& unreachableUrl); + + /** + * @copydoc Dali::WebEngine::LoadContents() + */ + bool LoadContents(const std::string& contents, uint32_t contentSize, const std::string& mimeType, const std::string& encoding, const std::string& baseUri); + + /** * @copydoc Dali::WebEngine::Reload() */ void Reload(); /** + * @copydoc Dali::WebEngine::ReloadWithoutCache() + */ + bool ReloadWithoutCache(); + + /** * @copydoc Dali::WebEngine::StopLoading() */ void StopLoading(); @@ -150,11 +165,46 @@ public: void Resume(); /** + * @copydoc Dali::WebEngine::SuspendNetworkLoading() + */ + void SuspendNetworkLoading(); + + /** + * @copydoc Dali::WebEngine::ResumeNetworkLoading() + */ + void ResumeNetworkLoading(); + + /** + * @copydoc Dali::WebEngine::AddCustomHeader() + */ + bool AddCustomHeader(const std::string& name, const std::string& value); + + /** + * @copydoc Dali::WebEngine::RemoveCustomHeader() + */ + bool RemoveCustomHeader(const std::string& name); + + /** + * @copydoc Dali::WebEngine::StartInspectorServer() + */ + uint32_t StartInspectorServer(uint32_t port); + + /** + * @copydoc Dali::WebEngine::StopInspectorServer() + */ + bool StopInspectorServer(); + + /** * @copydoc Dali::WebEngine::ScrollBy() */ void ScrollBy(int deltaX, int deltaY); /** + * @copydoc Dali::WebEngine::ScrollEdgeBy() + */ + bool ScrollEdgeBy(int deltaX, int deltaY); + + /** * @copydoc Dali::WebEngine::SetScrollPosition() */ void SetScrollPosition(int x, int y); @@ -175,8 +225,8 @@ public: Dali::Vector2 GetContentSize() const; /** - * @copydoc Dali::WebEngine::RegisterJavaScriptAlertCallback() - */ + * @copydoc Dali::WebEngine::RegisterJavaScriptAlertCallback() + */ void RegisterJavaScriptAlertCallback(Dali::WebEnginePlugin::JavaScriptAlertCallback callback); /** @@ -300,6 +350,81 @@ public: void SetFocus(bool focused); /** + * @copydoc Dali::WebEngine::SetPageZoomFactor() + */ + void SetPageZoomFactor(float zoomFactor); + + /** + * @copydoc Dali::WebEngine::GetPageZoomFactor() + */ + float GetPageZoomFactor() const; + + /** + * @copydoc Dali::WebEngine::SetTextZoomFactor() + */ + void SetTextZoomFactor(float zoomFactor); + + /** + * @copydoc Dali::WebEngine::GetTextZoomFactor() + */ + float GetTextZoomFactor() const; + + /** + * @copydoc Dali::WebEngine::GetLoadProgressPercentage() + */ + float GetLoadProgressPercentage() const; + + /** + * @copydoc Dali::WebEngine::SetScaleFactor() + */ + void SetScaleFactor(float scaleFactor, Dali::Vector2 point); + + /** + * @copydoc Dali::WebEngine::GetScaleFactor() + */ + float GetScaleFactor() const; + + /** + * @copydoc Dali::WebEngine::ActivateAccessibility() + */ + void ActivateAccessibility(bool activated); + + /** + * @copydoc Dali::WebEngine::SetVisibility() + */ + bool SetVisibility(bool visible); + + /** + * @copydoc Dali::WebEngine::HighlightText() + */ + bool HighlightText(const std::string& text, Dali::WebEnginePlugin::FindOption options, uint32_t maxMatchCount); + + /** + * @copydoc Dali::WebEngine::AddDynamicCertificatePath() + */ + void AddDynamicCertificatePath(const std::string& host, const std::string& certPath); + + /** + * @copydoc Dali::WebEngine::GetScreenshot() + */ + Dali::PixelData GetScreenshot(Dali::Rect viewArea, float scaleFactor); + + /** + * @copydoc Dali::WebEngine::GetScreenshotAsync() + */ + bool GetScreenshotAsynchronously(Dali::Rect viewArea, float scaleFactor, Dali::WebEnginePlugin::ScreenshotCapturedCallback callback); + + /** + * @copydoc Dali::WebEngine::IsVideoPlaying() + */ + bool CheckVideoPlayingAsynchronously(Dali::WebEnginePlugin::VideoPlayingCallback callback); + + /** + * @copydoc Dali::WebEngine::RegisterGeolocationPermissionCallback() + */ + void RegisterGeolocationPermissionCallback(Dali::WebEnginePlugin::GeolocationPermissionCallback callback); + + /** * @copydoc Dali::WebEngine::UpdateDisplayArea() */ void UpdateDisplayArea(Dali::Rect displayArea); -- 2.7.4