[Tizen] Add WebView APIs for fullscreen, text found, etc.
[platform/core/uifw/dali-adaptor.git] / dali / devel-api / adaptor-framework / web-engine / web-engine-plugin.h
old mode 100644 (file)
new mode 100755 (executable)
index d4238ce..6d900cb
@@ -2,7 +2,7 @@
 #define DALI_WEB_ENGINE_PLUGIN_H
 
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -21,7 +21,6 @@
 // EXTERNAL INCLUDES
 #include <dali/public-api/images/native-image-interface.h>
 #include <dali/public-api/math/rect.h>
-#include <dali/public-api/signals/dali-signal.h>
 #include <functional>
 #include <memory>
 
@@ -39,9 +38,7 @@ class TouchEvent;
 class WebEngineBackForwardList;
 class WebEngineCertificate;
 class WebEngineConsoleMessage;
-class WebEngineContext;
 class WebEngineContextMenu;
-class WebEngineCookieManager;
 class WebEngineFormRepostDecision;
 class WebEngineHitTest;
 class WebEngineHttpAuthHandler;
@@ -59,11 +56,6 @@ class WebEnginePlugin
 {
 public:
   /**
-   * @brief WebView signal type related with frame rendered.
-   */
-  using WebEngineFrameRenderedSignalType = Signal<void(void)>;
-
-  /**
    * @brief WebEngine callback related with page loading.
    */
   using WebEnginePageLoadCallback = std::function<void(const std::string&)>;
@@ -174,11 +166,36 @@ public:
   using WebEngineNavigationPolicyDecidedCallback = std::function<void(std::unique_ptr<Dali::WebEnginePolicyDecision>)>;
 
   /**
+   * @brief WebView callback related with new window policy would be decided.
+   */
+  using WebEngineNewWindowPolicyDecidedCallback = std::function<void(std::unique_ptr<Dali::WebEnginePolicyDecision>)>;
+
+  /**
+   * @brief WebView callback related with a new window would be created.
+   */
+  using WebEngineNewWindowCreatedCallback = std::function<void(Dali::WebEnginePlugin*&)>;
+
+  /**
    * @brief Hit test callback called after hit test is created asynchronously.
    */
   using WebEngineHitTestCreatedCallback = std::function<bool(std::unique_ptr<Dali::WebEngineHitTest>)>;
 
   /**
+   * @brief WebView callback called after fullscreen is entered.
+   */
+  using WebEngineFullscreenEnteredCallback = std::function<void(void)>;
+
+  /**
+   * @brief WebView callback called after fullscreen is exited.
+   */
+  using WebEngineFullscreenExitedCallback = std::function<void(void)>;
+
+  /**
+   * @brief WebView callback called after text is found.
+   */
+  using WebEngineTextFoundCallback = std::function<void(uint32_t)>;
+
+  /**
    * @brief The callback to be called when the web engine received a plain text of current web page.
    */
   using PlainTextReceivedCallback = std::function<void(const std::string&)>;
@@ -251,16 +268,6 @@ public:
   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;
@@ -327,7 +334,7 @@ public:
    *
    * @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;
+  virtual bool LoadContents(const int8_t* contents, uint32_t contentSize, const std::string& mimeType, const std::string& encoding, const std::string& baseUri) = 0;
 
   /**
    * @brief Reload the Web.
@@ -770,11 +777,16 @@ public:
   virtual bool SendWheelEvent(const WheelEvent& event) = 0;
 
   /**
-   * @brief Connect to this signal to be notified when frame is rendered.
+   * @brief Exit fullscreen.
+   */
+  virtual void ExitFullscreen() = 0;
+
+  /**
+   * @brief Callback to be called when frame would be rendered.
    *
-   * @return A signal object to connect with.
+   * @param[in] callback
    */
-  virtual WebEngineFrameRenderedSignalType& FrameRenderedSignal() = 0;
+  virtual void RegisterFrameRenderedCallback(WebEngineFrameRenderedCallback callback) = 0;
 
   /**
    * @brief Callback to be called when page loading is started.
@@ -847,6 +859,20 @@ 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
+   */
+  virtual void RegisterNewWindowCreatedCallback(WebEngineNewWindowCreatedCallback callback) = 0;
+
+  /**
    * @brief Callback to be called when certificate need be confirmed.
    *
    * @param[in] callback
@@ -882,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.