Implement WebEngine::GetPlainTextAsynchronously
[platform/core/uifw/dali-adaptor.git] / dali / devel-api / adaptor-framework / web-engine.h
old mode 100644 (file)
new mode 100755 (executable)
index fee7cfc..4ba8cbf
@@ -56,7 +56,7 @@ public:
   ~WebEngine();
 
   /**
-   * @brief Creates a new instance of a WebEngine.
+   * @brief Create a new instance of a WebEngine.
    */
   static WebEngine New();
 
@@ -94,7 +94,7 @@ public:
    * @param [in] locale The locale of Web
    * @param [in] timezoneId The timezoneID of Web
    */
-  void Create(int width, int height, const std::string& locale, const std::string& timezoneId);
+  void Create(uint32_t width, uint32_t height, const std::string& locale, const std::string& timezoneId);
 
   /**
    * @brief Create WebEngine instance.
@@ -104,7 +104,7 @@ public:
    * @param [in] argc The count of application arguments
    * @param [in] argv The string array of application arguments
    */
-  void Create(int width, int height, int argc, char** argv);
+  void Create(uint32_t width, uint32_t height, uint32_t argc, char** argv);
 
   /**
    * @brief Destroy WebEngine instance.
@@ -160,7 +160,7 @@ public:
   /**
    * @brief Get the url.
    */
-  const std::string& GetUrl();
+  std::string GetUrl() const;
 
   /**
    * @brief Load a given string as web contents.
@@ -269,7 +269,7 @@ public:
    * @param[in] deltaX horizontal offset to scroll
    * @param[in] deltaY vertical offset to scroll
    */
-  void ScrollBy(int deltaX, int deltaY);
+  void ScrollBy(int32_t deltaX, int32_t deltaY);
 
   /**
    * @brief Scroll edge of view by deltaX and deltaY.
@@ -279,12 +279,12 @@ public:
    *
    * @return true if succeeded, false otherwise
    */
-  bool ScrollEdgeBy(int deltaX, int deltaY);
+  bool ScrollEdgeBy(int32_t deltaX, int32_t deltaY);
 
   /**
    * @brief Set an absolute scroll of the given view.
    */
-  void SetScrollPosition(int x, int y);
+  void SetScrollPosition(int32_t x, int32_t y);
 
   /**
    * @brief Get the current scroll position of the given view.
@@ -331,7 +331,7 @@ public:
    * @param[in] script The JavaScript code
    * @param[in] resultHandler The callback function to be called by the JavaScript runtime. This carries evaluation result.
    */
-  void EvaluateJavaScript(const std::string& script, std::function<void(const std::string&)> resultHandler);
+  void EvaluateJavaScript(const std::string& script, Dali::WebEnginePlugin::JavaScriptMessageHandlerCallback resultHandler);
 
   /**
    * @brief Add a message handler into JavaScript.
@@ -339,7 +339,7 @@ public:
    * @param[in] exposedObjectName The name of exposed object
    * @param[in] handler The callback function
    */
-  void AddJavaScriptMessageHandler(const std::string& exposedObjectName, std::function<void(const std::string&)> handler);
+  void AddJavaScriptMessageHandler(const std::string& exposedObjectName, Dali::WebEnginePlugin::JavaScriptMessageHandlerCallback handler);
 
   /**
    * @brief Register a callback for JavaScript alert.
@@ -380,6 +380,29 @@ public:
   void JavaScriptPromptReply(const std::string& result);
 
   /**
+   * @brief Create a new hit test.
+   *
+   * @param[in] x the horizontal position to query
+   * @param[in] y the vertical position to query
+   * @param[in] mode the mode of hit test
+   *
+   * @return a new hit test object
+   */
+  std::unique_ptr<Dali::WebEngineHitTest> CreateHitTest(int32_t x, int32_t y, Dali::WebEngineHitTest::HitTestMode mode);
+
+  /**
+   * @brief create a hit test asynchronously.
+   *
+   * @param[in] x the horizontal position to query
+   * @param[in] y the vertical position to query
+   * @param[in] mode the mode of hit test
+   * @param[in] callback the callback function
+   *
+   * @return true if succeeded, false otherwise
+   */
+  bool CreateHitTestAsynchronously(int32_t x, int32_t y, Dali::WebEngineHitTest::HitTestMode mode, Dali::WebEnginePlugin::WebEngineHitTestCreatedCallback callback);
+
+  /**
    * @brief Clear the history of Web.
    */
   void ClearHistory();
@@ -394,7 +417,7 @@ public:
    *
    * @return The string value of user agent
    */
-  const std::string& GetUserAgent() const;
+  std::string GetUserAgent() const;
 
   /**
    * @brief Set user agent string.
@@ -406,7 +429,7 @@ public:
   /**
    * @brief Set the size of Web Pages.
    */
-  void SetSize(int width, int height);
+  void SetSize(uint32_t width, uint32_t height);
 
   /**
    * @brief Set background color of web page.
@@ -555,7 +578,7 @@ public:
    *
    * @return pixel data of screen shot
    */
-  Dali::PixelData GetScreenshot(Dali::Rect<int> viewArea, float scaleFactor);
+  Dali::PixelData GetScreenshot(Dali::Rect<int32_t> viewArea, float scaleFactor);
 
   /**
    * @brief Request to get snapshot of the specified viewArea of page asynchronously.
@@ -566,7 +589,7 @@ public:
    *
    * @return true if requested successfully, false otherwise
    */
-  bool GetScreenshotAsynchronously(Dali::Rect<int> viewArea, float scaleFactor, Dali::WebEnginePlugin::ScreenshotCapturedCallback callback);
+  bool GetScreenshotAsynchronously(Dali::Rect<int32_t> viewArea, float scaleFactor, Dali::WebEnginePlugin::ScreenshotCapturedCallback callback);
 
   /**
    * @brief Asynchronous request to check if there is a video playing in the given view.
@@ -588,7 +611,7 @@ public:
    * @brief Update display area.
    * @param[in] displayArea The area to display web page
    */
-  void UpdateDisplayArea(Dali::Rect<int> displayArea);
+  void UpdateDisplayArea(Dali::Rect<int32_t> displayArea);
 
   /**
    * @brief Enable video hole.
@@ -609,116 +632,123 @@ public:
   bool SendWheelEvent(const WheelEvent& event);
 
   /**
-   * @brief Connect to this signal to be notified when page loading is started.
+   * @brief Connect to this signal to be notified when frame is rendered.
    *
-   * @return A signal object to connect with
+   * @return A signal object to connect with.
    */
-  Dali::WebEnginePlugin::WebEnginePageLoadSignalType& PageLoadStartedSignal();
+  Dali::WebEnginePlugin::WebEngineFrameRenderedSignalType& FrameRenderedSignal();
 
   /**
-   * @brief Connect to this signal to be notified when page loading is in progress.
+   * @brief Callback to be called when page loading is started.
    *
-   * @return A signal object to connect with
+   * @param[in] callback
    */
-  Dali::WebEnginePlugin::WebEnginePageLoadSignalType& PageLoadInProgressSignal();
+  void RegisterPageLoadStartedCallback(Dali::WebEnginePlugin::WebEnginePageLoadCallback callback);
 
   /**
-   * @brief Connect to this signal to be notified when page loading is finished.
+   * @brief Callback to be called when page loading is in progress.
    *
-   * @return A signal object to connect with
+   * @param[in] callback
    */
-  Dali::WebEnginePlugin::WebEnginePageLoadSignalType& PageLoadFinishedSignal();
+  void RegisterPageLoadInProgressCallback(Dali::WebEnginePlugin::WebEnginePageLoadCallback callback);
 
   /**
-   * @brief Connect to this signal to be notified when an error occurs in page loading.
+   * @brief Callback to be called when page loading is finished.
    *
-   * @return A signal object to connect with
+   * @param[in] callback
    */
-  Dali::WebEnginePlugin::WebEnginePageLoadErrorSignalType& PageLoadErrorSignal();
+  void RegisterPageLoadFinishedCallback(Dali::WebEnginePlugin::WebEnginePageLoadCallback callback);
 
   /**
-   * @brief Connect to this signal to be notified when scroll edge is reached.
+   * @brief Callback to be called when an error occurs in page loading.
    *
-   * @return A signal object to connect with
+   * @param[in] callback
    */
-  Dali::WebEnginePlugin::WebEngineScrollEdgeReachedSignalType& ScrollEdgeReachedSignal();
+  void RegisterPageLoadErrorCallback(Dali::WebEnginePlugin::WebEnginePageLoadErrorCallback callback);
 
   /**
-   * @brief Connect to this signal to be notified when url is changed.
+   * @brief Callback to be called when scroll edge is reached.
    *
-   * @return A signal object to connect with
+   * @param[in] callback
    */
-  Dali::WebEnginePlugin::WebEngineUrlChangedSignalType& UrlChangedSignal();
+  void RegisterScrollEdgeReachedCallback(Dali::WebEnginePlugin::WebEngineScrollEdgeReachedCallback callback);
 
   /**
-   * @brief Connect to this signal to be notified when form repost decision is requested.
+   * @brief Callback to be called when url is changed.
    *
-   * @return A signal object to connect with.
+   * @param[in] callback
    */
-  Dali::WebEnginePlugin::WebEngineFormRepostDecisionSignalType& FormRepostDecisionSignal();
+  void RegisterUrlChangedCallback(Dali::WebEnginePlugin::WebEngineUrlChangedCallback callback);
 
   /**
-   * @brief Connect to this signal to be notified when frame is rendered.
+   * @brief Callback to be called when form repost decision is requested.
    *
-   * @return A signal object to connect with.
+   * @param[in] callback
    */
-  Dali::WebEnginePlugin::WebEngineFrameRenderedSignalType& FrameRenderedSignal();
+  void RegisterFormRepostDecidedCallback(Dali::WebEnginePlugin::WebEngineFormRepostDecidedCallback callback);
 
   /**
-   * @brief Connect to this signal to be notified when http request need be intercepted.
+   * @brief Callback to be called when http request need be intercepted.
    *
-   * @return A signal object to connect with.
+   * @param[in] callback
    */
-  Dali::WebEnginePlugin::WebEngineRequestInterceptorSignalType& RequestInterceptorSignal();
+  void RegisterRequestInterceptorCallback(Dali::WebEnginePlugin::WebEngineRequestInterceptorCallback callback);
 
   /**
-   * @brief Connect to this signal to be notified when console message will be logged.
+   * @brief Callback to be called when console message will be logged.
    *
-   * @return A signal object to connect with.
+   * @param[in] callback
    */
-  Dali::WebEnginePlugin::WebEngineConsoleMessageSignalType& ConsoleMessageSignal();
+  void RegisterConsoleMessageReceivedCallback(Dali::WebEnginePlugin::WebEngineConsoleMessageReceivedCallback callback);
 
   /**
-   * @brief Connect to this signal to be notified when new policy would be decided.
+   * @brief Callback to be called when response policy would be decided.
    *
-   * @return A signal object to connect with.
+   * @param[in] callback
    */
-  Dali::WebEnginePlugin::WebEnginePolicyDecisionSignalType& PolicyDecisionSignal();
+  void RegisterResponsePolicyDecidedCallback(Dali::WebEnginePlugin::WebEngineResponsePolicyDecidedCallback callback);
 
   /**
-   * @brief Connect to this signal to be notified when certificate need be confirmed.
+   * @brief Callback to be called when certificate need be confirmed.
    *
-   * @return A signal object to connect with.
+   * @param[in] callback
    */
-  Dali::WebEnginePlugin::WebEngineCertificateSignalType& CertificateConfirmSignal();
+  void RegisterCertificateConfirmedCallback(Dali::WebEnginePlugin::WebEngineCertificateCallback callback);
 
   /**
-   * @brief Connect to this signal to be notified when ssl certificate is changed.
+   * @brief Callback to be called when ssl certificate is changed.
    *
-   * @return A signal object to connect with.
+   * @param[in] callback
    */
-  Dali::WebEnginePlugin::WebEngineCertificateSignalType& SslCertificateChangedSignal();
+  void RegisterSslCertificateChangedCallback(Dali::WebEnginePlugin::WebEngineCertificateCallback callback);
 
   /**
-   * @brief Connect to this signal to be notified when http authentication need be confirmed.
+   * @brief Callback to be called when http authentication need be confirmed.
    *
-   * @return A signal object to connect with.
+   * @param[in] callback
    */
-  Dali::WebEnginePlugin::WebEngineHttpAuthHandlerSignalType& HttpAuthHandlerSignal();
+  void RegisterHttpAuthHandlerCallback(Dali::WebEnginePlugin::WebEngineHttpAuthHandlerCallback callback);
 
   /**
-   * @brief Connect to this signal to be notified when context menu would be customized.
+   * @brief Callback to be called when context menu would be shown.
    *
-   * @return A signal object to connect with.
+   * @param[in] callback
    */
-  Dali::WebEnginePlugin::WebEngineContextMenuCustomizedSignalType& ContextMenuCustomizedSignal();
+  void RegisterContextMenuShownCallback(Dali::WebEnginePlugin::WebEngineContextMenuShownCallback callback);
 
   /**
-   * @brief Connect to this signal to be notified when context menu item is selected.
+   * @brief Callback to be called when context menu would be hidden.
    *
-   * @return A signal object to connect with.
+   * @param[in] 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.
    */
-  Dali::WebEnginePlugin::WebEngineContextMenuItemSelectedSignalType& ContextMenuItemSelectedSignal();
+  void GetPlainTextAsynchronously(Dali::WebEnginePlugin::PlainTextReceivedCallback callback);
 
 private: // Not intended for application developers
   /**