[Tizen] Update contents of webview when frame is rendered.
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / web-view / web-view-impl.h
index 9b5f29c..d10a888 100755 (executable)
@@ -97,6 +97,11 @@ public:
   static Toolkit::WebView New( int argc, char** argv );
 
   /**
+   * @copydoc Dali::Toolkit::WebView::GetPlugin()
+   */
+  Dali::WebEnginePlugin* GetPlugin() const;
+
+  /**
    * @brief Get favicon of web page.
    *
    * @return Handle to a favicon
@@ -161,12 +166,12 @@ public:
   /**
    * @copydoc Dali::Toolkit::WebView::EvaluateJavaScript()
    */
-  void EvaluateJavaScript( const std::string& script, std::function< void( const std::string& ) > resultHandler );
+  void EvaluateJavaScript( const std::string& script, Dali::WebEnginePlugin::JavaScriptMessageHandlerCallback resultHandler );
 
   /**
    * @copydoc Dali::Toolkit::WebView::AddJavaScriptMessageHandler()
    */
-  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.
@@ -179,24 +184,49 @@ public:
   void ClearHistory();
 
   /**
-   * @copydoc Dali::Toolkit::WebView::PageLoadStartedSignal()
+   * @copydoc Dali::Toolkit::WebView::SetTtsFocus()
+   */
+  void SetTtsFocus(bool focused);
+
+  /**
+   * @copydoc Dali::Toolkit::WebView::RegisterPageLoadStartedCallback()
+   */
+  void RegisterPageLoadStartedCallback(Dali::WebEnginePlugin::WebEnginePageLoadCallback callback);
+
+  /**
+   * @copydoc Dali::Toolkit::WebView::RegisterPageLoadFinishedCallback()
+   */
+  void RegisterPageLoadFinishedCallback(Dali::WebEnginePlugin::WebEnginePageLoadCallback callback);
+
+  /**
+   * @copydoc Dali::Toolkit::WebView::RegisterPageLoadErrorCallback()
    */
-  Dali::Toolkit::WebView::WebViewPageLoadSignalType& PageLoadStartedSignal();
+  void RegisterPageLoadErrorCallback(Dali::WebEnginePlugin::WebEnginePageLoadErrorCallback callback);
 
   /**
-   * @copydoc Dali::Toolkit::WebView::PageLoadFinishedSignal()
+   * @copydoc Dali::Toolkit::WebView::RegisterScrollEdgeReachedCallback()
    */
-  Dali::Toolkit::WebView::WebViewPageLoadSignalType& PageLoadFinishedSignal();
+  void RegisterScrollEdgeReachedCallback(Dali::WebEnginePlugin::WebEngineScrollEdgeReachedCallback callback);
 
   /**
-   * @copydoc Dali::Toolkit::WebView::PageLoadErrorSignal()
+   * @copydoc Dali::Toolkit::WebView::RegisterUrlChangedCallback()
    */
-  Dali::Toolkit::WebView::WebViewPageLoadErrorSignalType& PageLoadErrorSignal();
+  void RegisterUrlChangedCallback(Dali::WebEnginePlugin::WebEngineUrlChangedCallback callback);
 
   /**
-   * @copydoc Dali::Toolkit::WebView::ScrollEdgeReachedSignal()
+   * @copydoc Dali::Toolkit::WebView::RegisterNavigationPolicyDecidedCallback()
    */
-  Dali::Toolkit::WebView::WebViewScrollEdgeReachedSignalType& ScrollEdgeReachedSignal();
+  void RegisterNavigationPolicyDecidedCallback(Dali::WebEnginePlugin::WebEngineNavigationPolicyDecidedCallback callback);
+
+  /**
+   * @copydoc Dali::Toolkit::WebView::RegisterNewWindowCreatedCallback()
+   */
+  void RegisterNewWindowCreatedCallback(Dali::WebEnginePlugin::WebEngineNewWindowCreatedCallback callback);
+
+  /**
+   * @copydoc Dali::Toolkit::WebView::GetPlainTextAsynchronously()
+   */
+  void GetPlainTextAsynchronously(Dali::WebEnginePlugin::PlainTextReceivedCallback callback);
 
 public: // Properties
 
@@ -218,17 +248,6 @@ public: // Properties
    */
   static Dali::Property::Value GetProperty( Dali::BaseObject* object, Dali::Property::Index propertyIndex );
 
-  /**
-   * Connects a callback function with the object's signals.
-   * @param[in] object The object providing the signal.
-   * @param[in] tracker Used to disconnect the signal.
-   * @param[in] signalName The signal to connect to.
-   * @param[in] functor A newly allocated FunctorDelegate.
-   * @return True if the signal was connected.
-   * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the c
-   */
-  static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor );
-
 private: // From Control
 
   /**
@@ -265,6 +284,17 @@ private: // From Control
   void OnKeyInputFocusLost() override;
 
   /**
+   * @brief Callback for notifying frame rendered.
+   */
+  void OnFrameRendered();
+
+  /**
+   * @brief Callback for updating display area of web view.
+   * @param[in] source The soource triggers Notification.
+   */
+  void OnDisplayAreaUpdated(Dali::PropertyNotification& source);
+
+  /**
    * @copydoc Toolkit::Control::OnSceneConnection()
    */
   void OnSceneConnection( int depth ) override;
@@ -305,6 +335,12 @@ private:
   void GetContentSize( int& width, int& height ) const;
 
   /**
+   * @brief Get current url.
+   * @return The string value of current url
+   */
+  std::string GetUrl() const;
+
+  /**
    * @brief Returns the title of the Web.
    *
    * @return The title of web page
@@ -315,7 +351,7 @@ private:
    * @brief Get user agent string.
    * @return The string value of user agent
    */
-  const std::string& GetUserAgent() const;
+  std::string GetUserAgent() const;
 
   /**
    * @brief Set user agent string.
@@ -324,12 +360,6 @@ private:
   void SetUserAgent( const std::string& userAgent );
 
   /**
-   * @brief Updates display area of web view.
-   * @param[in] source The soource triggers Notification.
-   */
-  void UpdateDisplayArea( Dali::PropertyNotification& source );
-
-  /**
    * @brief Enable/Disable video hole for video playing.
    * @param[in] enabled True if video hole is enabled, false otherwise.
    */
@@ -341,53 +371,22 @@ private:
    */
   void EnableBlendMode( bool blendEnabled );
 
-  /**
-   * @brief Callback function to be called when page load started.
-   * @param[in] url The url currently being loaded
-   */
-  void OnPageLoadStarted( const std::string& url );
-
-  /**
-   * @brief Callback function to be called when page load finished.
-   * @param[in] url The url currently being loaded
-   */
-  void OnPageLoadFinished( const std::string& url );
-
-  /**
-   * @brief Callback function to be called when there is an error in page loading.
-   * @param[in] url The url currently being loaded
-   * @param[in] errorCode The error code
-   */
-  void OnPageLoadError( const std::string& url, int errorCode );
+private:
 
-  /**
-   * @brief Callback function to be called when scroll edge is reached.
-   * @param[in] e The scroll edge reached.
-   */
-  void OnScrollEdgeReached( Dali::WebEnginePlugin::ScrollEdge edge );
+  Dali::Toolkit::Visual::Base                        mVisual;
+  Dali::Size                                         mWebViewSize;
+  Dali::WebEngine                                    mWebEngine;
 
-private:
+  std::unique_ptr<Dali::Toolkit::WebContext>         mWebContext;
+  std::unique_ptr<Dali::Toolkit::WebCookieManager>   mWebCookieManager;
+  std::unique_ptr<Dali::Toolkit::WebSettings>        mWebSettings;
+  std::unique_ptr<Dali::Toolkit::WebBackForwardList> mWebBackForwardList;
 
-  std::string                                            mUrl;
-  Dali::Toolkit::Visual::Base                            mVisual;
-  Dali::Size                                             mWebViewSize;
-  Dali::WebEngine                                        mWebEngine;
-
-  Dali::Toolkit::WebView::WebViewPageLoadSignalType      mPageLoadStartedSignal;
-  Dali::Toolkit::WebView::WebViewPageLoadSignalType      mPageLoadFinishedSignal;
-  Dali::Toolkit::WebView::WebViewPageLoadErrorSignalType mPageLoadErrorSignal;
-  Dali::Toolkit::WebView::WebViewScrollEdgeReachedSignalType mScrollEdgeReachedSignal;
-
-  std::unique_ptr<Dali::Toolkit::WebContext>             mWebContext;
-  std::unique_ptr<Dali::Toolkit::WebCookieManager>       mWebCookieManager;
-  std::unique_ptr<Dali::Toolkit::WebSettings>            mWebSettings;
-  std::unique_ptr<Dali::Toolkit::WebBackForwardList>     mWebBackForwardList;
-
-  Dali::PropertyNotification                             mPositionUpdateNotification;
-  Dali::PropertyNotification                             mSizeUpdateNotification;
-  Dali::PropertyNotification                             mScaleUpdateNotification;
-  bool                                                   mVideoHoleEnabled;
-  Dali::Rect< int >                                      mWebViewArea;
+  Dali::PropertyNotification                         mPositionUpdateNotification;
+  Dali::PropertyNotification                         mSizeUpdateNotification;
+  Dali::PropertyNotification                         mScaleUpdateNotification;
+  bool                                               mVideoHoleEnabled;
+  Dali::Rect< int >                                  mWebViewArea;
 };
 
 } // namespace Internal