From 5e107006fc541ce919d678785c54b314e7ba6c4e Mon Sep 17 00:00:00 2001 From: "huayong.xu" Date: Wed, 24 Feb 2021 17:40:09 +0800 Subject: [PATCH] Add callbacks for form repost decision and frame rendering. This patch is to add callbacks for form repost decision and frame rendering in web engine. Change-Id: I13ffe21dbcb87d04775f120e4410340d80c7f61e --- .../adaptor-framework/web-engine-cookie-manager.h | 2 +- .../web-engine-form-repost-decision.h | 49 ++++++++++++++++++++++ .../adaptor-framework/web-engine-plugin.h | 26 ++++++++++++ dali/devel-api/adaptor-framework/web-engine.cpp | 12 +++++- dali/devel-api/adaptor-framework/web-engine.h | 16 +++++++ dali/devel-api/file.list | 1 + .../internal/web-engine/common/web-engine-impl.cpp | 10 +++++ dali/internal/web-engine/common/web-engine-impl.h | 10 +++++ 8 files changed, 124 insertions(+), 2 deletions(-) mode change 100644 => 100755 dali/devel-api/adaptor-framework/web-engine-cookie-manager.h create mode 100755 dali/devel-api/adaptor-framework/web-engine-form-repost-decision.h diff --git a/dali/devel-api/adaptor-framework/web-engine-cookie-manager.h b/dali/devel-api/adaptor-framework/web-engine-cookie-manager.h old mode 100644 new mode 100755 index 8400d35..ac3367f --- a/dali/devel-api/adaptor-framework/web-engine-cookie-manager.h +++ b/dali/devel-api/adaptor-framework/web-engine-cookie-manager.h @@ -24,7 +24,7 @@ namespace Dali { /** - * @brief A class WebEngineCookieManager to wrap ewk cookie manager. + * @brief A class WebEngineCookieManager for cookie manager of web engine. */ class WebEngineCookieManager { diff --git a/dali/devel-api/adaptor-framework/web-engine-form-repost-decision.h b/dali/devel-api/adaptor-framework/web-engine-form-repost-decision.h new file mode 100755 index 0000000..68df413 --- /dev/null +++ b/dali/devel-api/adaptor-framework/web-engine-form-repost-decision.h @@ -0,0 +1,49 @@ +#ifndef DALI_WEB_ENGINE_FORM_REPOST_DECISION_H +#define DALI_WEB_ENGINE_FORM_REPOST_DECISION_H + +/* + * 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +namespace Dali +{ +/** + * @brief A class WebEngineFormRepostDecision for form repost decision. + */ +class WebEngineFormRepostDecision +{ +public: + /** + * @brief Constructor. + */ + WebEngineFormRepostDecision() = default; + + /** + * @brief Destructor. + */ + virtual ~WebEngineFormRepostDecision() = default; + + /** + * @brief Reply the result about form repost decision. + * + * @param[in] allowed Whether allow form repost decision request or not + */ + virtual void Reply(bool allowed) = 0; +}; + +} // namespace Dali + +#endif // DALI_WEB_ENGINE_FORM_REPOST_DECISION_H diff --git a/dali/devel-api/adaptor-framework/web-engine-plugin.h b/dali/devel-api/adaptor-framework/web-engine-plugin.h index af1fb35..4adc1fb 100755 --- a/dali/devel-api/adaptor-framework/web-engine-plugin.h +++ b/dali/devel-api/adaptor-framework/web-engine-plugin.h @@ -23,6 +23,7 @@ #include #include #include +#include namespace Dali { @@ -32,6 +33,7 @@ class TouchEvent; class WebEngineBackForwardList; class WebEngineContext; class WebEngineCookieManager; +class WebEngineFormRepostDecision; class WebEngineSettings; class HoverEvent; class WheelEvent; @@ -86,6 +88,16 @@ public: using JavaScriptPromptCallback = std::function; /** + * @brief WebView signal type related with form repost decision. + */ + using WebEngineFormRepostDecisionSignalType = Signal)>; + + /** + * @brief WebView signal type related with frame rendered. + */ + using WebEngineFrameRenderedSignalType = Signal; + + /** * @brief Enumeration for the scroll edge. */ enum class ScrollEdge @@ -469,6 +481,20 @@ public: * @return A signal object to connect with. */ virtual WebEngineUrlChangedSignalType& UrlChangedSignal() = 0; + + /** + * @brief Connects to this signal to be notified when form repost decision is requested. + * + * @return A signal object to connect with. + */ + virtual WebEngineFormRepostDecisionSignalType& FormRepostDecisionSignal() = 0; + + /** + * @brief Connects to this signal to be notified when frame is rendered. + * + * @return A signal object to connect with. + */ + virtual WebEngineFrameRenderedSignalType& FrameRenderedSignal() = 0; }; } // namespace Dali diff --git a/dali/devel-api/adaptor-framework/web-engine.cpp b/dali/devel-api/adaptor-framework/web-engine.cpp index 35eac17..e94bd58 100755 --- a/dali/devel-api/adaptor-framework/web-engine.cpp +++ b/dali/devel-api/adaptor-framework/web-engine.cpp @@ -241,7 +241,7 @@ void WebEngine::JavaScriptPromptReply(const std::string& result) void WebEngine::ClearHistory() { - return GetImplementation(*this).ClearHistory(); + GetImplementation(*this).ClearHistory(); } void WebEngine::ClearAllTilesResources() @@ -364,4 +364,14 @@ Dali::WebEnginePlugin::WebEngineUrlChangedSignalType& WebEngine::UrlChangedSigna return GetImplementation(*this).UrlChangedSignal(); } +Dali::WebEnginePlugin::WebEngineFormRepostDecisionSignalType& WebEngine::FormRepostDecisionSignal() +{ + return GetImplementation(*this).FormRepostDecisionSignal(); +} + +Dali::WebEnginePlugin::WebEngineFrameRenderedSignalType& WebEngine::FrameRenderedSignal() +{ + return GetImplementation(*this).FrameRenderedSignal(); +} + } // namespace Dali diff --git a/dali/devel-api/adaptor-framework/web-engine.h b/dali/devel-api/adaptor-framework/web-engine.h index df639c3..ad49b52 100755 --- a/dali/devel-api/adaptor-framework/web-engine.h +++ b/dali/devel-api/adaptor-framework/web-engine.h @@ -275,6 +275,7 @@ public: /** * @brief Reply for JavaScript confirm. + * @param[in] confirmed True if confirmed, false otherwise. */ void JavaScriptConfirmReply(bool confirmed); @@ -287,6 +288,7 @@ public: /** * @brief Reply for JavaScript prompt. + * @param[in] result The result returned from input-field in prompt popup. */ void JavaScriptPromptReply(const std::string& result); @@ -450,6 +452,20 @@ public: */ Dali::WebEnginePlugin::WebEngineUrlChangedSignalType& UrlChangedSignal(); + /** + * @brief Connects to this signal to be notified when form repost decision is requested. + * + * @return A signal object to connect with. + */ + Dali::WebEnginePlugin::WebEngineFormRepostDecisionSignalType& FormRepostDecisionSignal(); + + /** + * @brief Connects to this signal to be notified when frame is rendered. + * + * @return A signal object to connect with. + */ + Dali::WebEnginePlugin::WebEngineFrameRenderedSignalType& FrameRenderedSignal(); + private: // Not intended for application developers /** * @brief Internal constructor diff --git a/dali/devel-api/file.list b/dali/devel-api/file.list index cd5f869..4633ed9 100755 --- a/dali/devel-api/file.list +++ b/dali/devel-api/file.list @@ -87,6 +87,7 @@ SET( devel_api_adaptor_framework_header_files ${adaptor_devel_api_dir}/adaptor-framework/web-engine-back-forward-list.h ${adaptor_devel_api_dir}/adaptor-framework/web-engine-context.h ${adaptor_devel_api_dir}/adaptor-framework/web-engine-cookie-manager.h + ${adaptor_devel_api_dir}/adaptor-framework/web-engine-form-repost-decision.h ${adaptor_devel_api_dir}/adaptor-framework/web-engine-plugin.h ${adaptor_devel_api_dir}/adaptor-framework/web-engine-settings.h ${adaptor_devel_api_dir}/adaptor-framework/key-extension-plugin.h diff --git a/dali/internal/web-engine/common/web-engine-impl.cpp b/dali/internal/web-engine/common/web-engine-impl.cpp index 2f444bf..257b067 100755 --- a/dali/internal/web-engine/common/web-engine-impl.cpp +++ b/dali/internal/web-engine/common/web-engine-impl.cpp @@ -459,6 +459,16 @@ Dali::WebEnginePlugin::WebEngineUrlChangedSignalType& WebEngine::UrlChangedSigna return mPlugin->UrlChangedSignal(); } +Dali::WebEnginePlugin::WebEngineFormRepostDecisionSignalType& WebEngine::FormRepostDecisionSignal() +{ + return mPlugin->FormRepostDecisionSignal(); +} + +Dali::WebEnginePlugin::WebEngineFrameRenderedSignalType& WebEngine::FrameRenderedSignal() +{ + return mPlugin->FrameRenderedSignal(); +} + } // namespace Adaptor } // namespace Internal } // namespace Dali diff --git a/dali/internal/web-engine/common/web-engine-impl.h b/dali/internal/web-engine/common/web-engine-impl.h index 7b1675d..9e78e72 100644 --- a/dali/internal/web-engine/common/web-engine-impl.h +++ b/dali/internal/web-engine/common/web-engine-impl.h @@ -349,6 +349,16 @@ public: */ Dali::WebEnginePlugin::WebEngineUrlChangedSignalType& UrlChangedSignal(); + /** + * @copydoc Dali::WebEngine::FormRepostDecisionSignal() + */ + Dali::WebEnginePlugin::WebEngineFormRepostDecisionSignalType& FormRepostDecisionSignal(); + + /** + * @copydoc Dali::WebEngine::FrameRenderedSignal() + */ + Dali::WebEnginePlugin::WebEngineFrameRenderedSignalType& FrameRenderedSignal(); + private: /** * @brief Constructor. -- 2.7.4