Implement some new ewk apis in web view.
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / web-view / web-view-impl.h
old mode 100644 (file)
new mode 100755 (executable)
index 968b742..4769110
  */
 
 // EXTERNAL INCLUDES
+#include <memory>
 #include <dali/devel-api/adaptor-framework/web-engine.h>
 #include <dali/public-api/images/image-operations.h>
 
 // INTERNAL INCLUDES
+#include <dali-toolkit/devel-api/controls/web-view/web-view.h>
 #include <dali-toolkit/devel-api/visual-factory/visual-base.h>
 #include <dali-toolkit/public-api/controls/control-impl.h>
-#include <dali-toolkit/devel-api/controls/web-view/web-view.h>
 
 namespace Dali
 {
@@ -35,6 +36,10 @@ namespace Toolkit
 
 class KeyEvent;
 class TouchEvent;
+class WebBackForwardList;
+class WebContext;
+class WebCookieManager;
+class WebSettings;
 class WebView;
 
 namespace Internal
@@ -63,6 +68,26 @@ public:
   static Toolkit::WebView New( const std::string& locale, const std::string& timezoneId );
 
   /**
+   * @brief Get settings of WebEngine.
+   */
+  Dali::Toolkit::WebSettings* GetSettings() const;
+
+  /**
+   * @brief Get context of WebEngine.
+   */
+  Dali::Toolkit::WebContext* GetContext() const;
+
+  /**
+   * @brief Get cookie manager of WebEngine.
+   */
+  Dali::Toolkit::WebCookieManager* GetCookieManager() const;
+
+  /**
+   * @brief Get WebBackForwardList of WebEngine.
+   */
+  Dali::Toolkit::WebBackForwardList* GetBackForwardList() const;
+
+  /**
    * @copydoc Dali::Toolkit::WebView::LoadUrl()
    */
   void LoadUrl( const std::string& url );
@@ -70,7 +95,7 @@ public:
   /**
    * @copydoc Dali::WebEngine::LoadHTMLString()
    */
-  void LoadHTMLString( const std::string& htmlString );
+  void LoadHtmlString( const std::string& htmlString );
 
   /**
    * @copydoc Dali::Toolkit::WebView::Reload()
@@ -93,6 +118,11 @@ public:
   void Resume();
 
   /**
+   * @copydoc Dali::Toolkit::WebView::ScrollBy()
+   */
+  void ScrollBy( int deltaX, int deltaY );
+
+  /**
    * @copydoc Dali::Toolkit::WebView::CanGoForward()
    */
   bool CanGoForward();
@@ -128,16 +158,6 @@ public:
   void ClearHistory();
 
   /**
-   * @copydoc Dali::Toolkit::WebView::ClearCache()
-   */
-  void ClearCache();
-
-  /**
-   * @copydoc Dali::Toolkit::WebView::ClearCookies()
-   */
-  void ClearCookies();
-
-  /**
    * @copydoc Dali::Toolkit::WebView::PageLoadStartedSignal()
    */
   Dali::Toolkit::WebView::WebViewPageLoadSignalType& PageLoadStartedSignal();
@@ -152,6 +172,11 @@ public:
    */
   Dali::Toolkit::WebView::WebViewPageLoadErrorSignalType& PageLoadErrorSignal();
 
+  /**
+   * @copydoc Dali::Toolkit::WebView::ScrollEdgeReachedSignal()
+   */
+  Dali::Toolkit::WebView::WebViewScrollEdgeReachedSignalType& ScrollEdgeReachedSignal();
+
 public: // Properties
 
   /**
@@ -231,30 +256,32 @@ private:
   WebView& operator=( const WebView& webView );
 
   /**
-   * @brief Get cache model option. The default isToolkit::WebView::CacheModel::DOCUMENT_VIEWER.
-   * @see Toolkit::WebView::CacheModel::Type
+   * @brief Sets an absolute scroll of the given view.
+   * @param[in] x The coordinate x of scroll
+   * @param[in] y The coordinate y of scroll
    */
-  Toolkit::WebView::CacheModel::Type GetCacheModel() const;
+  void SetScrollPosition( int x, int y );
 
   /**
-   * @brief Set cache model option. The default isToolkit::WebView::CacheModel::DOCUMENT_VIEWER.
-   * @param[in] cacheModel The cache model option
-   * @see Toolkit::WebView::CacheModel::Type
+   * @brief Gets the current scroll position of the given view.
+   * @param[out] x The coordinate x of scroll
+   * @param[out] y The coordinate y of scroll
    */
-  void SetCacheModel( Toolkit::WebView::CacheModel::Type cacheModel );
+  void GetScrollPosition( int& x, int& y ) const;
 
   /**
-   * @brief Gets the cookie acceptance policy. The default is Toolkit::WebView::CookieAcceptPolicy::NO_THIRD_PARTY.
-   * @see Toolkit::WebView::CookieAcceptPolicy::Type
+   * @brief Gets the possible scroll size of the given view.
+   * @param[out] width The width of scroll size
+   * @param[out] height The height of scroll size
    */
-  Toolkit::WebView::CookieAcceptPolicy::Type GetCookieAcceptPolicy() const;
+  void GetScrollSize( int& width, int& height ) const;
 
   /**
-   * @brief Sets the cookie acceptance policy. The default is Toolkit::WebView::CookieAcceptPolicy::NO_THIRD_PARTY.
-   * @param[in] policy The cookie acceptance policy
-   * @see Toolkit::WebView::CookieAcceptPolicy::Type
+   * @brief Gets the last known content's size.
+   * @param[out] width The width of content's size
+   * @param[out] height The height of content's size
    */
-  void SetCookieAcceptPolicy( Toolkit::WebView::CookieAcceptPolicy::Type policy );
+  void GetContentSize( int& width, int& height ) const;
 
   /**
    * @brief Get user agent string.
@@ -269,62 +296,6 @@ private:
   void SetUserAgent( const std::string& userAgent );
 
   /**
-   * @brief Returns whether JavaScript can be executable. The default is true.
-   *
-   * @return true if JavaScript executing is enabled, false otherwise
-   */
-  bool IsJavaScriptEnabled() const;
-
-  /**
-   * @brief Enables/disables JavaScript executing. The default is enabled.
-   *
-   * @param[in] enabled True if JavaScript executing is enabled, false otherwise
-   */
-  void EnableJavaScript( bool enabled );
-
-  /**
-   * @brief Returns whether images can be loaded automatically. The default is true.
-   *
-   * @return true if images are loaded automatically, false otherwise
-   */
-  bool AreImagesAutomaticallyLoaded() const;
-
-  /**
-   * @brief Enables/disables auto loading of images. The default is enabled.
-   *
-   * @param[in] automatic True if images are loaded automatically, false otherwise
-   */
-  void LoadImagesAutomatically( bool automatic );
-
-  /**
-   * @brief Gets the default text encoding name (e.g. UTF-8).
-   *
-   * @return The default text encoding name
-   */
-  const std::string& GetDefaultTextEncodingName() const;
-
-  /**
-   * @brief Sets the default text encoding name (e.g. UTF-8).
-   *
-   * @param[in] defaultTextEncodingName The default text encoding name
-   */
-  void SetDefaultTextEncodingName( const std::string& defaultTextEncodingName );
-
-  /**
-   * @brief Returns the default font size in pixel. The default value is 16.
-   *
-   * @return The default font size
-   */
-  int GetDefaultFontSize() const;
-
-  /**
-   * @brief Sets the default font size in pixel. The default value is 16.
-   *
-   * @param[in] defaultFontSize A new default font size to set
-   */
-  void SetDefaultFontSize( int defaultFontSize );
-
-  /**
    * @brief Callback function to be called when page load started.
    * @param[in] url The url currently being loaded
    */
@@ -343,6 +314,12 @@ private:
    */
   void OnPageLoadError( const std::string& url, int errorCode );
 
+  /**
+   * @brief Callback function to be called when scroll edge is reached.
+   * @param[in] e The scroll edge reached.
+   */
+  void OnScrollEdgeReached( Dali::WebEnginePlugin::ScrollEdge edge );
+
 private:
 
   std::string                                            mUrl;
@@ -353,6 +330,12 @@ private:
   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;
 };
 
 } // namespace Internal