From: huayong.xu Date: Tue, 10 Oct 2023 12:19:45 +0000 (+0800) Subject: [Tizen] Add WebView APIs for fullscreen, text found, etc. X-Git-Tag: accepted/tizen/unified/20240731.160125~14 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c0b0b9dbdc84279796d65599553d681c86f30678;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git [Tizen] Add WebView APIs for fullscreen, text found, etc. Change-Id: I2f82cccfce5fbdb6c699291069e3b428b88a5145 --- diff --git a/dali/devel-api/adaptor-framework/web-engine/web-engine-plugin.h b/dali/devel-api/adaptor-framework/web-engine/web-engine-plugin.h index 4c631bf..6d900cb 100755 --- a/dali/devel-api/adaptor-framework/web-engine/web-engine-plugin.h +++ b/dali/devel-api/adaptor-framework/web-engine/web-engine-plugin.h @@ -166,6 +166,11 @@ public: using WebEngineNavigationPolicyDecidedCallback = std::function)>; /** + * @brief WebView callback related with new window policy would be decided. + */ + using WebEngineNewWindowPolicyDecidedCallback = std::function)>; + + /** * @brief WebView callback related with a new window would be created. */ using WebEngineNewWindowCreatedCallback = std::function; @@ -176,6 +181,21 @@ public: using WebEngineHitTestCreatedCallback = std::function)>; /** + * @brief WebView callback called after fullscreen is entered. + */ + using WebEngineFullscreenEnteredCallback = std::function; + + /** + * @brief WebView callback called after fullscreen is exited. + */ + using WebEngineFullscreenExitedCallback = std::function; + + /** + * @brief WebView callback called after text is found. + */ + using WebEngineTextFoundCallback = std::function; + + /** * @brief The callback to be called when the web engine received a plain text of current web page. */ using PlainTextReceivedCallback = std::function; @@ -757,6 +777,11 @@ public: virtual bool SendWheelEvent(const WheelEvent& event) = 0; /** + * @brief Exit fullscreen. + */ + virtual void ExitFullscreen() = 0; + + /** * @brief Callback to be called when frame would be rendered. * * @param[in] callback @@ -834,6 +859,13 @@ public: virtual void RegisterNavigationPolicyDecidedCallback(WebEngineNavigationPolicyDecidedCallback callback) = 0; /** + * @brief Callback to be called when new window policy would be decided. + * + * @param[in] callback + */ + virtual void RegisterNewWindowPolicyDecidedCallback(WebEngineNewWindowPolicyDecidedCallback callback) = 0; + + /** * @brief Callback to be called when a new window would be created. * * @param[in] callback @@ -876,6 +908,27 @@ public: virtual void RegisterContextMenuHiddenCallback(WebEngineContextMenuHiddenCallback callback) = 0; /** + * @brief Callback to be called when fullscreen would be entered. + * + * @param[in] callback + */ + virtual void RegisterFullscreenEnteredCallback(WebEngineFullscreenEnteredCallback callback) = 0; + + /** + * @brief Callback to be called when fullscreen would be exited. + * + * @param[in] callback + */ + virtual void RegisterFullscreenExitedCallback(WebEngineFullscreenExitedCallback callback) = 0; + + /** + * @brief Callback to be called when text would be found. + * + * @param[in] callback + */ + virtual void RegisterTextFoundCallback(WebEngineTextFoundCallback callback) = 0; + + /** * @brief Get a plain text of current web page asynchronously. * * @param[in] callback The callback function called asynchronously. diff --git a/dali/devel-api/adaptor-framework/web-engine/web-engine.cpp b/dali/devel-api/adaptor-framework/web-engine/web-engine.cpp index 97b70c1..7f07ca0 100755 --- a/dali/devel-api/adaptor-framework/web-engine/web-engine.cpp +++ b/dali/devel-api/adaptor-framework/web-engine/web-engine.cpp @@ -375,6 +375,11 @@ bool WebEngine::SendWheelEvent(const WheelEvent& event) return GetImplementation(*this).SendWheelEvent(event); } +void WebEngine::ExitFullscreen() +{ + GetImplementation(*this).ExitFullscreen(); +} + void WebEngine::SetFocus(bool focused) { GetImplementation(*this).SetFocus(focused); @@ -535,6 +540,11 @@ void WebEngine::RegisterNavigationPolicyDecidedCallback(Dali::WebEnginePlugin::W GetImplementation(*this).RegisterNavigationPolicyDecidedCallback(callback); } +void WebEngine::RegisterNewWindowPolicyDecidedCallback(Dali::WebEnginePlugin::WebEngineNewWindowPolicyDecidedCallback callback) +{ + GetImplementation(*this).RegisterNewWindowPolicyDecidedCallback(callback); +} + void WebEngine::RegisterNewWindowCreatedCallback(Dali::WebEnginePlugin::WebEngineNewWindowCreatedCallback callback) { GetImplementation(*this).RegisterNewWindowCreatedCallback(callback); @@ -565,6 +575,21 @@ void WebEngine::RegisterContextMenuHiddenCallback(Dali::WebEnginePlugin::WebEngi GetImplementation(*this).RegisterContextMenuHiddenCallback(callback); } +void WebEngine::RegisterFullscreenEnteredCallback(Dali::WebEnginePlugin::WebEngineFullscreenEnteredCallback callback) +{ + GetImplementation(*this).RegisterFullscreenEnteredCallback(callback); +} + +void WebEngine::RegisterFullscreenExitedCallback(Dali::WebEnginePlugin::WebEngineFullscreenExitedCallback callback) +{ + GetImplementation(*this).RegisterFullscreenExitedCallback(callback); +} + +void WebEngine::RegisterTextFoundCallback(Dali::WebEnginePlugin::WebEngineTextFoundCallback callback) +{ + GetImplementation(*this).RegisterTextFoundCallback(callback); +} + void WebEngine::GetPlainTextAsynchronously(Dali::WebEnginePlugin::PlainTextReceivedCallback callback) { GetImplementation(*this).GetPlainTextAsynchronously(callback); diff --git a/dali/devel-api/adaptor-framework/web-engine/web-engine.h b/dali/devel-api/adaptor-framework/web-engine/web-engine.h index 1515c76..f8e3298 100755 --- a/dali/devel-api/adaptor-framework/web-engine/web-engine.h +++ b/dali/devel-api/adaptor-framework/web-engine/web-engine.h @@ -662,6 +662,11 @@ public: bool SendWheelEvent(const WheelEvent& event); /** + * @brief Exit full-screen. + */ + void ExitFullscreen(); + + /** * @brief Callback to be called when frame would be rendered. * * @param[in] callback @@ -739,6 +744,13 @@ public: void RegisterNavigationPolicyDecidedCallback(Dali::WebEnginePlugin::WebEngineNavigationPolicyDecidedCallback callback); /** + * @brief Callback to be called when new window policy would be decided. + * + * @param[in] callback + */ + void RegisterNewWindowPolicyDecidedCallback(Dali::WebEnginePlugin::WebEngineNewWindowPolicyDecidedCallback callback); + + /** * @brief Callback to be called when a new window would be created. * * @param[in] callback @@ -781,6 +793,27 @@ public: void RegisterContextMenuHiddenCallback(Dali::WebEnginePlugin::WebEngineContextMenuHiddenCallback callback); /** + * @brief Callback to be called when fullscreen would be entered. + * + * @param[in] callback + */ + void RegisterFullscreenEnteredCallback(Dali::WebEnginePlugin::WebEngineFullscreenEnteredCallback callback); + + /** + * @brief Callback to be called when fullscreen would be exited. + * + * @param[in] callback + */ + void RegisterFullscreenExitedCallback(Dali::WebEnginePlugin::WebEngineFullscreenExitedCallback callback); + + /** + * @brief Callback to be called when text would be found. + * + * @param[in] callback + */ + void RegisterTextFoundCallback(Dali::WebEnginePlugin::WebEngineTextFoundCallback callback); + + /** * @brief Get a plain text of current web page asynchronously. * * @param[in] callback The callback function called asynchronously. diff --git a/dali/internal/web-engine/common/web-engine-impl.cpp b/dali/internal/web-engine/common/web-engine-impl.cpp index 87e1f6e..71b69ea 100644 --- a/dali/internal/web-engine/common/web-engine-impl.cpp +++ b/dali/internal/web-engine/common/web-engine-impl.cpp @@ -690,6 +690,11 @@ bool WebEngine::SendWheelEvent(const Dali::WheelEvent& event) return mPlugin->SendWheelEvent(event); } +void WebEngine::ExitFullscreen() +{ + mPlugin->ExitFullscreen(); +} + void WebEngine::RegisterFrameRenderedCallback(Dali::WebEnginePlugin::WebEngineFrameRenderedCallback callback) { mPlugin->RegisterFrameRenderedCallback(callback); @@ -745,6 +750,11 @@ void WebEngine::RegisterNavigationPolicyDecidedCallback(Dali::WebEnginePlugin::W mPlugin->RegisterNavigationPolicyDecidedCallback(callback); } +void WebEngine::RegisterNewWindowPolicyDecidedCallback(Dali::WebEnginePlugin::WebEngineNewWindowPolicyDecidedCallback callback) +{ + mPlugin->RegisterNewWindowPolicyDecidedCallback(callback); +} + void WebEngine::RegisterNewWindowCreatedCallback(Dali::WebEnginePlugin::WebEngineNewWindowCreatedCallback callback) { mPlugin->RegisterNewWindowCreatedCallback(callback); @@ -775,6 +785,21 @@ void WebEngine::RegisterContextMenuHiddenCallback(Dali::WebEnginePlugin::WebEngi mPlugin->RegisterContextMenuHiddenCallback(callback); } +void WebEngine::RegisterFullscreenEnteredCallback(Dali::WebEnginePlugin::WebEngineFullscreenEnteredCallback callback) +{ + mPlugin->RegisterFullscreenEnteredCallback(callback); +} + +void WebEngine::RegisterFullscreenExitedCallback(Dali::WebEnginePlugin::WebEngineFullscreenExitedCallback callback) +{ + mPlugin->RegisterFullscreenExitedCallback(callback); +} + +void WebEngine::RegisterTextFoundCallback(Dali::WebEnginePlugin::WebEngineTextFoundCallback callback) +{ + mPlugin->RegisterTextFoundCallback(callback); +} + void WebEngine::GetPlainTextAsynchronously(Dali::WebEnginePlugin::PlainTextReceivedCallback callback) { mPlugin->GetPlainTextAsynchronously(callback); diff --git a/dali/internal/web-engine/common/web-engine-impl.h b/dali/internal/web-engine/common/web-engine-impl.h index 1a35dc9..b3ef060 100755 --- a/dali/internal/web-engine/common/web-engine-impl.h +++ b/dali/internal/web-engine/common/web-engine-impl.h @@ -468,6 +468,11 @@ public: bool SendWheelEvent(const Dali::WheelEvent& event); /** + * @copydoc Dali::WebEngine::ExitFullscreen() + */ + void ExitFullscreen(); + + /** @copydoc Dali::WebEngine::RegisterFrameRenderedCallback() */ void RegisterFrameRenderedCallback(Dali::WebEnginePlugin::WebEngineFrameRenderedCallback callback); @@ -523,6 +528,11 @@ public: void RegisterNavigationPolicyDecidedCallback(Dali::WebEnginePlugin::WebEngineNavigationPolicyDecidedCallback callback); /** + @copydoc Dali::WebEngine::RegisterNewWindowPolicyDecidedCallback() + */ + void RegisterNewWindowPolicyDecidedCallback(Dali::WebEnginePlugin::WebEngineNewWindowPolicyDecidedCallback callback); + + /** @copydoc Dali::WebEngine::RegisterNewWindowCreatedCallback() */ void RegisterNewWindowCreatedCallback(Dali::WebEnginePlugin::WebEngineNewWindowCreatedCallback callback); @@ -553,6 +563,21 @@ public: void RegisterContextMenuHiddenCallback(Dali::WebEnginePlugin::WebEngineContextMenuHiddenCallback callback); /** + * @copydoc Dali::WebEngine::RegisterFullscreenEnteredCallback() + */ + void RegisterFullscreenEnteredCallback(Dali::WebEnginePlugin::WebEngineFullscreenEnteredCallback callback); + + /** + * @copydoc Dali::WebEngine::RegisterFullscreenExitedCallback() + */ + void RegisterFullscreenExitedCallback(Dali::WebEnginePlugin::WebEngineFullscreenExitedCallback callback); + + /** + * @copydoc Dali::WebEngine::RegisterTextFoundCallback() + */ + void RegisterTextFoundCallback(Dali::WebEnginePlugin::WebEngineTextFoundCallback callback); + + /** * @copydoc Dali::WebEngine::GetPlainTextAsynchronously() */ void GetPlainTextAsynchronously(Dali::WebEnginePlugin::PlainTextReceivedCallback callback);