This patch is to add policy decision feature in web engine.
Change-Id: I5ce01683303a139a64d5e7f8e4c83e624542796b
--- /dev/null
+#ifndef DALI_WEB_ENGINE_FRAME_H
+#define DALI_WEB_ENGINE_FRAME_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.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <string>
+
+namespace Dali
+{
+/**
+ * @brief A class WebEngineFrame for frame of web engine.
+ */
+class WebEngineFrame
+{
+public:
+ /**
+ * @brief Constructor.
+ */
+ WebEngineFrame() = default;
+
+ /**
+ * @brief Destructor.
+ */
+ virtual ~WebEngineFrame() = default;
+
+ /**
+ * @brief Check whether the frame is main frame.
+ * @return true if the frame is main frame, false otherwise
+ */
+ virtual bool IsMainFrame() const = 0;
+};
+
+} // namespace Dali
+
+#endif // DALI_WEB_ENGINE_FRAME_H
class WebEngineContext;
class WebEngineCookieManager;
class WebEngineFormRepostDecision;
-class WebEngineRequestInterceptor;
class WebEngineLoadError;
+class WebEnginePolicyDecision;
+class WebEngineRequestInterceptor;
class WebEngineSettings;
class HoverEvent;
class WheelEvent;
using WebEngineFrameRenderedSignalType = Signal<void(void)>;
/**
+ * @brief WebView signal type related with policy would be decided.
+ */
+ using WebEnginePolicyDecisionSignalType = Signal<void(std::shared_ptr<Dali::WebEnginePolicyDecision>)>;
+
+ /**
* @brief Enumeration for the scroll edge.
*/
enum class ScrollEdge
* @return A signal object to connect with.
*/
virtual WebEngineConsoleMessageSignalType& ConsoleMessageSignal() = 0;
+
+ /**
+ * @brief Connects to this signal to be notified when new policy would be decided.
+ *
+ * @return A signal object to connect with.
+ */
+ virtual WebEnginePolicyDecisionSignalType& PolicyDecisionSignal() = 0;
};
// specialization has to be done in the same namespace
--- /dev/null
+#ifndef DALI_WEB_ENGINE_POLICY_DECISION_H
+#define DALI_WEB_ENGINE_POLICY_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.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <string>
+
+namespace Dali
+{
+class WebEngineFrame;
+
+/**
+ * @brief A class WebBackForwardList for back forward list of web engine.
+ */
+class WebEnginePolicyDecision
+{
+public:
+ /**
+ * @brief Enumeration that provides an option to policy decision types.
+ */
+ enum class DecisionType
+ {
+ USE, ///< Use.
+ DOWNLOAD, ///< Download.
+ IGNORE, ///< Ignore.
+ };
+
+ /**
+ * @brief Enumeration that provides an option to policy navigation types.
+ */
+ enum class NavigationType
+ {
+ LINK_CLICKED, ///< Link clicked.
+ FORM_SUBMITTED, ///< Form submitted.
+ BACK_FORWARD, ///< Back forward.
+ RELOAD, ///< Reload.
+ FORM_RESUBMITTED, ///< Form resubmitted.
+ OTHER, ///< Other.
+ };
+
+ /**
+ * @brief Constructor.
+ */
+ WebEnginePolicyDecision() = default;
+
+ /**
+ * @brief Destructor.
+ */
+ virtual ~WebEnginePolicyDecision() = default;
+
+ /**
+ * @brief Returns the url that request policy decision.
+ * @return The url that request policy decision
+ */
+ virtual std::string GetUrl() const = 0;
+
+ /**
+ * @brief Returns a cookie that web page has.
+ * @return The cookie string if successfully
+ */
+ virtual std::string GetCookie() const = 0;
+
+ /**
+ * @brief Returns a decision type.
+ * @return The decision type
+ */
+ virtual DecisionType GetDecisionType() const = 0;
+
+ /**
+ * @brief Returns a MIME type for response data.
+ * @return The MIME type string
+ */
+ virtual std::string GetResponseMime() const = 0;
+
+ /**
+ * @brief Returns an HTTP status code.
+ * @return The HTTP status code number
+ */
+ virtual int32_t GetResponseStatusCode() const = 0;
+
+ /**
+ * @brief Returns a navigation type.
+ * @return The navigation type
+ */
+ virtual NavigationType GetNavigationType() const = 0;
+
+ /**
+ * @brief Gets frame.
+ * @return The frame of policy decision
+ */
+ virtual WebEngineFrame& GetFrame() const = 0;
+
+ /**
+ * @brief Gets a scheme from the Policy Decision.
+ * @return The scheme if succeeded, empty otherwise
+ */
+ virtual std::string GetScheme() const = 0;
+
+ /**
+ * @brief Accepts the action which triggers this decision.
+ * @return True if successfully, false otherwise
+ */
+ virtual bool Use() = 0;
+
+ /**
+ * @brief Ignores the action which triggers this decision.
+ * @return True if successfully, false otherwise
+ */
+ virtual bool Ignore() = 0;
+
+ /**
+ * @brief Suspend the operation for policy decision.
+ * @return True if successfully, false otherwise
+ */
+ virtual bool Suspend() = 0;
+};
+
+} // namespace Dali
+
+#endif // DALI_WEB_ENGINE_POLICY_DECISION_H
#include <dali/devel-api/adaptor-framework/web-engine-console-message.h>
#include <dali/devel-api/adaptor-framework/web-engine-context.h>
#include <dali/devel-api/adaptor-framework/web-engine-cookie-manager.h>
-#include <dali/devel-api/adaptor-framework/web-engine-request-interceptor.h>
#include <dali/devel-api/adaptor-framework/web-engine-load-error.h>
+#include <dali/devel-api/adaptor-framework/web-engine-policy-decision.h>
+#include <dali/devel-api/adaptor-framework/web-engine-request-interceptor.h>
#include <dali/devel-api/adaptor-framework/web-engine-settings.h>
#include <dali/internal/web-engine/common/web-engine-impl.h>
return GetImplementation(*this).ConsoleMessageSignal();
}
+Dali::WebEnginePlugin::WebEnginePolicyDecisionSignalType& WebEngine::PolicyDecisionSignal()
+{
+ return GetImplementation(*this).PolicyDecisionSignal();
+}
+
} // namespace Dali
*/
Dali::WebEnginePlugin::WebEngineConsoleMessageSignalType& ConsoleMessageSignal();
+ /**
+ * @brief Connects to this signal to be notified when new policy would be decided.
+ *
+ * @return A signal object to connect with.
+ */
+ Dali::WebEnginePlugin::WebEnginePolicyDecisionSignalType& PolicyDecisionSignal();
+
private: // Not intended for application developers
/**
* @brief Internal constructor
${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-frame.h
${adaptor_devel_api_dir}/adaptor-framework/web-engine-load-error.h
${adaptor_devel_api_dir}/adaptor-framework/web-engine-plugin.h
+ ${adaptor_devel_api_dir}/adaptor-framework/web-engine-policy-decision.h
${adaptor_devel_api_dir}/adaptor-framework/web-engine-request-interceptor.h
${adaptor_devel_api_dir}/adaptor-framework/web-engine-settings.h
${adaptor_devel_api_dir}/adaptor-framework/key-extension-plugin.h
#include <dali/devel-api/adaptor-framework/web-engine-cookie-manager.h>
#include <dali/devel-api/adaptor-framework/web-engine-request-interceptor.h>
#include <dali/devel-api/adaptor-framework/web-engine-load-error.h>
+#include <dali/devel-api/adaptor-framework/web-engine-policy-decision.h>
#include <dali/devel-api/adaptor-framework/web-engine-settings.h>
#include <dali/internal/system/common/environment-variables.h>
#include <dali/public-api/adaptor-framework/native-image-source.h>
return mPlugin->ConsoleMessageSignal();
}
+Dali::WebEnginePlugin::WebEnginePolicyDecisionSignalType& WebEngine::PolicyDecisionSignal()
+{
+ return mPlugin->PolicyDecisionSignal();
+}
+
} // namespace Adaptor
} // namespace Internal
} // namespace Dali
*/
Dali::WebEnginePlugin::WebEngineConsoleMessageSignalType& ConsoleMessageSignal();
+ /**
+ @copydoc Dali::WebEngine::PolicyDecisionSignal()
+ */
+ Dali::WebEnginePlugin::WebEnginePolicyDecisionSignalType& PolicyDecisionSignal();
+
private:
/**
* @brief Constructor.