Implement WebEngine::GetPlainTextAsynchronously 88/261688/1
authorJiyun Yang <ji.yang@samsung.com>
Thu, 22 Jul 2021 13:06:09 +0000 (22:06 +0900)
committerJiyun Yang <ji.yang@samsung.com>
Thu, 22 Jul 2021 13:06:26 +0000 (22:06 +0900)
Change-Id: Id85c001698789c9ac9e9f444ebdca3f067df7af6
Signed-off-by: Jiyun Yang <ji.yang@samsung.com>
dali/devel-api/adaptor-framework/web-engine-plugin.h
dali/devel-api/adaptor-framework/web-engine.cpp
dali/devel-api/adaptor-framework/web-engine.h
dali/internal/web-engine/common/web-engine-impl.cpp
dali/internal/web-engine/common/web-engine-impl.h

index 69027c2..07daee3 100755 (executable)
@@ -178,6 +178,11 @@ public:
   using WebEngineHitTestCreatedCallback = std::function<bool(std::unique_ptr<Dali::WebEngineHitTest>)>;
 
   /**
   using WebEngineHitTestCreatedCallback = std::function<bool(std::unique_ptr<Dali::WebEngineHitTest>)>;
 
   /**
+   * @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&)>;
+
+  /**
    * @brief Enumeration for the scroll edge.
    */
   enum class ScrollEdge
    * @brief Enumeration for the scroll edge.
    */
   enum class ScrollEdge
@@ -868,6 +873,13 @@ public:
    * @param[in] callback
    */
   virtual void RegisterContextMenuHiddenCallback(WebEngineContextMenuHiddenCallback callback) = 0;
    * @param[in] callback
    */
   virtual void RegisterContextMenuHiddenCallback(WebEngineContextMenuHiddenCallback callback) = 0;
+
+  /**
+   * @brief Get a plain text of current web page asynchronously.
+   *
+   * @param[in] callback The callback function called asynchronously.
+   */
+  virtual void GetPlainTextAsynchronously(PlainTextReceivedCallback callback) = 0;
 };
 
 // specialization has to be done in the same namespace
 };
 
 // specialization has to be done in the same namespace
index 0161ba6..86f67f1 100755 (executable)
@@ -557,4 +557,9 @@ void WebEngine::RegisterContextMenuHiddenCallback(Dali::WebEnginePlugin::WebEngi
   GetImplementation(*this).RegisterContextMenuHiddenCallback(callback);
 }
 
   GetImplementation(*this).RegisterContextMenuHiddenCallback(callback);
 }
 
+void WebEngine::GetPlainTextAsynchronously(Dali::WebEnginePlugin::PlainTextReceivedCallback callback)
+{
+  GetImplementation(*this).GetPlainTextAsynchronously(callback);
+}
+
 } // namespace Dali
 } // namespace Dali
index d3b5017..4ba8cbf 100755 (executable)
@@ -743,6 +743,13 @@ public:
    */
   void RegisterContextMenuHiddenCallback(Dali::WebEnginePlugin::WebEngineContextMenuHiddenCallback callback);
 
    */
   void RegisterContextMenuHiddenCallback(Dali::WebEnginePlugin::WebEngineContextMenuHiddenCallback callback);
 
+  /**
+   * @brief Get a plain text of current web page asynchronously.
+   *
+   * @param[in] callback The callback function called asynchronously.
+   */
+  void GetPlainTextAsynchronously(Dali::WebEnginePlugin::PlainTextReceivedCallback callback);
+
 private: // Not intended for application developers
   /**
    * @brief Internal constructor
 private: // Not intended for application developers
   /**
    * @brief Internal constructor
index 1c83af7..f4753f0 100755 (executable)
@@ -651,6 +651,11 @@ void WebEngine::RegisterContextMenuHiddenCallback(Dali::WebEnginePlugin::WebEngi
   mPlugin->RegisterContextMenuHiddenCallback(callback);
 }
 
   mPlugin->RegisterContextMenuHiddenCallback(callback);
 }
 
+void WebEngine::GetPlainTextAsynchronously(Dali::WebEnginePlugin::PlainTextReceivedCallback callback)
+{
+  mPlugin->GetPlainTextAsynchronously(callback);
+}
+
 } // namespace Adaptor
 } // namespace Internal
 } // namespace Dali
 } // namespace Adaptor
 } // namespace Internal
 } // namespace Dali
index 4f621a6..c3ad4d0 100755 (executable)
@@ -534,6 +534,11 @@ public:
    */
   void RegisterContextMenuHiddenCallback(Dali::WebEnginePlugin::WebEngineContextMenuHiddenCallback callback);
 
    */
   void RegisterContextMenuHiddenCallback(Dali::WebEnginePlugin::WebEngineContextMenuHiddenCallback callback);
 
+  /**
+   * @copydoc Dali::WebEngine::GetPlainTextAsynchronously()
+   */
+  void GetPlainTextAsynchronously(Dali::WebEnginePlugin::PlainTextReceivedCallback callback);
+
 private:
   /**
    * @brief Constructor.
 private:
   /**
    * @brief Constructor.