[Tizen] Add an API for 'create,window' event.
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / devel-api / controls / web-view / web-view.h
index 53dfb5a..c65e412 100755 (executable)
@@ -81,34 +81,43 @@ public:
 
       /**
        * @brief The user agent string.
-       * @details Name "userAgent", type Property::STRING.
+       * @details name "userAgent", type Property::STRING.
        */
       USER_AGENT,
 
       /**
        * @brief The current position of scroll.
-       * @details Name "scrollPosition", type Property::VECTOR2.
+       * @details name "scrollPosition", type Property::VECTOR2.
        */
       SCROLL_POSITION,
 
       /**
-       * @brief The current position of scroll.
-       * @details Name "scrollSize", type Property::VECTOR2. Read-only.
+       * @brief The current size of scroll.
+       * @details name "scrollSize", type Property::VECTOR2.
+       * @note The value is read-only.
        */
       SCROLL_SIZE,
 
       /**
-       * @brief The current position of scroll.
-       * @details Name "contentSize", type Property::VECTOR2. Read-only.
+       * @brief The current size of content.
+       * @details name "contentSize", type Property::VECTOR2.
+       * @note The value is read-only.
        */
       CONTENT_SIZE,
 
       /**
        * @brief The title of web page.
-       * @details Name "title", type Property::STRING.
+       * @details name "title", type Property::STRING.
        * @note The value is read-only.
        */
       TITLE,
+
+      /**
+       * @brief Whether video hole is enabled or not.
+       * @details name "videoHoleEnabled", type Property::BOOLEAN.
+       * @note The value is read-only.
+       */
+      VIDEO_HOLE_ENABLED,
     };
   };
 
@@ -117,97 +126,23 @@ public:
    */
   enum class LoadErrorCode
   {
-    /**
-     * @brief Unknown.
-     */
-    UNKNOWN = 0,
-
-    /**
-     * @brief User canceled.
-     */
-    CANCELED,
-
-    /**
-     * @brief Can't show the page for this MIME type.
-     */
-    CANT_SUPPORT_MIMETYPE,
-
-    /**
-     * @brief File IO error.
-     */
-    FAILED_FILE_IO,
-
-    /**
-     * @brief Cannot connect to the network.
-     */
-    CANT_CONNECT,
-
-    /**
-     * @brief Fail to look up host from the DNS.
-     */
-    CANT_LOOKUP_HOST,
-
-    /**
-     * @brief Fail to SSL/TLS handshake.
-     */
-    FAILED_TLS_HANDSHAKE,
-
-    /**
-     * @brief Received certificate is invalid.
-     */
-    INVALID_CERTIFICATE,
-
-    /**
-     * @brief Connection timeout.
-     */
-    REQUEST_TIMEOUT,
-
-    /**
-     * @brief Too many redirects.
-     */
-    TOO_MANY_REDIRECTS,
-
-    /**
-     * @brief Too many requests during this load.
-     */
-    TOO_MANY_REQUESTS,
-
-    /**
-     * @brief Malformed URL.
-     */
-    BAD_URL,
-
-    /**
-     * @brief Unsupported scheme.
-     */
-    UNSUPPORTED_SCHEME,
-
-    /**
-     * @brief User authentication failed on the server.
-     */
-    AUTHENTICATION,
-
-    /**
-     * @brief Web server has an internal server error.
-     */
-    INTERNAL_SERVER
+    UNKNOWN = 0,            ///< Unknown.
+    CANCELED,               ///< User canceled.
+    CANT_SUPPORT_MIMETYPE,  ///< Can't show the page for this MIME type.
+    FAILED_FILE_IO,         ///< File IO error.
+    CANT_CONNECT,           ///< Cannot connect to the network.
+    CANT_LOOKUP_HOST,       ///< Fail to look up host from the DNS.
+    FAILED_TLS_HANDSHAKE,   ///< Fail to SSL/TLS handshake.
+    INVALID_CERTIFICATE,    ///< Received certificate is invalid.
+    REQUEST_TIMEOUT,        ///< Connection timeout.
+    TOO_MANY_REDIRECTS,     ///< Too many redirects.
+    TOO_MANY_REQUESTS,      ///< Too many requests during this load.
+    BAD_URL,                ///< Malformed URL.
+    UNSUPPORTED_SCHEME,     ///< Unsupported scheme.
+    AUTHENTICATION,         ///< User authentication failed on the server.
+    INTERNAL_SERVER         ///< Web server has an internal server error.
   };
 
-  /**
-   * @brief WebView signal type related with page loading.
-   */
-  typedef Signal<void(WebView, const std::string&)> WebViewPageLoadSignalType;
-
-  /**
-   * @brief WebView signal type related with page loading error.
-   */
-  typedef Signal<void(WebView, const std::string&, LoadErrorCode)> WebViewPageLoadErrorSignalType;
-
-  /**
-   * @brief WebView signal type related with scroll edge reached.
-   */
-  typedef Signal<void(WebView, Dali::WebEnginePlugin::ScrollEdge)> WebViewScrollEdgeReachedSignalType;
-
 public:
   /**
    * @brief Creates an initialized WebView.
@@ -292,11 +227,16 @@ public:
   Dali::Toolkit::WebBackForwardList* GetBackForwardList() const;
 
   /**
-   * @brief Get Favicon of web page.
+   * @brief Gets web engine plugin.
+   */
+  Dali::WebEnginePlugin* GetPlugin() const;
+
+  /**
+   * @brief Get favicon of web page.
    *
-   * @return Handle to a fav icon
+   * @return Handle to a favicon
    */
-  Dali::Toolkit::ImageView& GetFavicon();
+  Dali::Toolkit::ImageView GetFavicon() const;
 
   /**
    * @brief Loads a web page based on a given URL.
@@ -369,7 +309,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 Evaluates JavaScript code represented as a string.
@@ -402,7 +342,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 Clears all tiles resources of Web.
@@ -415,32 +355,67 @@ public:
   void ClearHistory();
 
   /**
-   * @brief Connects to this signal to be notified when page loading is started.
+   * @brief Set or unset TTS focus of the webview.
+   * @param[in] focused True if it is gained, false lost.
+   * @note It only works when the webview does not have keyinput focus. If it has keyinput focus, the TTS focus is set automatically.
+   */
+  void SetTtsFocus(bool focused);
+
+  /**
+   * @brief Callback to be called when page loading is started.
+   *
+   * @param[in] callback
+   */
+  void RegisterPageLoadStartedCallback(Dali::WebEnginePlugin::WebEnginePageLoadCallback callback);
+
+  /**
+   * @brief Callback to be called when page loading is finished.
+   *
+   * @param[in] callback
+   */
+  void RegisterPageLoadFinishedCallback(Dali::WebEnginePlugin::WebEnginePageLoadCallback callback);
+
+  /**
+   * @brief Callback to be called when an error occurs in page loading.
+   *
+   * @param[in] callback
+   */
+  void RegisterPageLoadErrorCallback(Dali::WebEnginePlugin::WebEnginePageLoadErrorCallback callback);
+
+  /**
+   * @brief Callback to be called when scroll edge is reached.
+   *
+   * @param[in] callback
+   */
+  void RegisterScrollEdgeReachedCallback(Dali::WebEnginePlugin::WebEngineScrollEdgeReachedCallback callback);
+
+  /**
+   * @brief Callback to be called when url is changed.
    *
-   * @return A signal object to connect with
+   * @param[in] callback
    */
-  WebViewPageLoadSignalType& PageLoadStartedSignal();
+  void RegisterUrlChangedCallback(Dali::WebEnginePlugin::WebEngineUrlChangedCallback callback);
 
   /**
-   * @brief Connects to this signal to be notified when page loading is finished.
+   * @brief Callback to be called when navigation policy would be decided.
    *
-   * @return A signal object to connect with
+   * @param[in] callback
    */
-  WebViewPageLoadSignalType& PageLoadFinishedSignal();
+  void RegisterNavigationPolicyDecidedCallback(Dali::WebEnginePlugin::WebEngineNavigationPolicyDecidedCallback callback);
 
   /**
-   * @brief Connects to this signal to be notified when an error occurs in page loading.
+   * @brief Callback to be called when a new window would be created.
    *
-   * @return A signal object to connect with.
+   * @param[in] callback
    */
-  WebViewPageLoadErrorSignalType& PageLoadErrorSignal();
+  void RegisterNewWindowCreatedCallback(Dali::WebEnginePlugin::WebEngineNewWindowCreatedCallback callback);
 
   /**
-   * @brief Connects to this signal to be notified when scroll edge is reached.
+   * @brief Get a plain text of current web page asynchronously.
    *
-   * @return A signal object to connect with.
+   * @param[in] callback The callback function called asynchronously.
    */
-  WebViewScrollEdgeReachedSignalType& ScrollEdgeReachedSignal();
+  void GetPlainTextAsynchronously(Dali::WebEnginePlugin::PlainTextReceivedCallback callback);
 
 public: // Not intended for application developers
   /// @cond internal