Update position & size of web view.
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / web-view / web-view-impl.h
index 0769bad..572688b 100755 (executable)
  */
 
 // EXTERNAL INCLUDES
+#include <memory>
 #include <dali/devel-api/adaptor-framework/web-engine.h>
 #include <dali/public-api/images/image-operations.h>
+#include <dali/public-api/object/property-notification.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>
+#include <dali-toolkit/public-api/controls/image-view/image-view.h>
 
 namespace Dali
 {
@@ -35,6 +38,10 @@ namespace Toolkit
 
 class KeyEvent;
 class TouchEvent;
+class WebBackForwardList;
+class WebContext;
+class WebCookieManager;
+class WebSettings;
 class WebView;
 
 namespace Internal
@@ -48,6 +55,8 @@ protected:
 
   WebView( const std::string& locale, const std::string& timezoneId );
 
+  WebView( int argc, char** argv );
+
   virtual ~WebView();
 
 public:
@@ -63,6 +72,38 @@ 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::New( int, char** )
+   */
+  static Toolkit::WebView New( int argc, char** argv );
+
+  /**
+   * @brief Get Favicon of web page.
+   *
+   * @return Handle to a fav icon
+   */
+  Dali::Toolkit::ImageView& GetFavicon();
+
+  /**
    * @copydoc Dali::Toolkit::WebView::LoadUrl()
    */
   void LoadUrl( const std::string& url );
@@ -70,7 +111,7 @@ public:
   /**
    * @copydoc Dali::WebEngine::LoadHTMLString()
    */
-  void LoadHTMLString( const std::string& htmlString );
+  void LoadHtmlString( const std::string& htmlString );
 
   /**
    * @copydoc Dali::Toolkit::WebView::Reload()
@@ -128,19 +169,14 @@ public:
   void AddJavaScriptMessageHandler( const std::string& exposedObjectName, std::function< void( const std::string& ) > handler );
 
   /**
-   * @copydoc Dali::Toolkit::WebView::ClearHistory()
-   */
-  void ClearHistory();
-
-  /**
-   * @copydoc Dali::Toolkit::WebView::ClearCache()
+   * @brief Clears all tiles resources of Web.
    */
-  void ClearCache();
+  void ClearAllTilesResources();
 
   /**
-   * @copydoc Dali::Toolkit::WebView::ClearCookies()
+   * @copydoc Dali::Toolkit::WebView::ClearHistory()
    */
-  void ClearCookies();
+  void ClearHistory();
 
   /**
    * @copydoc Dali::Toolkit::WebView::PageLoadStartedSignal()
@@ -206,11 +242,6 @@ private: // From Control
   Vector3 GetNaturalSize() override;
 
   /**
-   * @copydoc Toolkit::Control::OnRelayout()
-   */
-  void OnRelayout( const Vector2& size, RelayoutContainer& container ) override;
-
-  /**
    * Signal occurs when the Web View has been touched.
    * @param[in] actor The Actor Touched
    * @param[in] touch The Touch Data.
@@ -233,6 +264,11 @@ private: // From Control
    */
   void OnKeyInputFocusLost() override;
 
+  /**
+   * @copydoc Toolkit::Control::OnSceneConnection()
+   */
+  void OnSceneConnection( int depth ) override;
+
 private:
 
   // Undefined
@@ -252,47 +288,28 @@ private:
    * @param[out] x The coordinate x of scroll
    * @param[out] y The coordinate y of scroll
    */
-  void GetScrollPosition( int& x, int& y ) const;
+  Dali::Vector2 GetScrollPosition() const;
 
   /**
    * @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
    */
-  void GetScrollSize( int& width, int& height ) const;
+  Dali::Vector2 GetScrollSize() const;
 
   /**
    * @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 GetContentSize( int& width, int& height ) const;
+  Dali::Vector2 GetContentSize() const;
 
   /**
-   * @brief Get cache model option. The default isToolkit::WebView::CacheModel::DOCUMENT_VIEWER.
-   * @see Toolkit::WebView::CacheModel::Type
-   */
-  Toolkit::WebView::CacheModel::Type GetCacheModel() const;
-
-  /**
-   * @brief Set cache model option. The default isToolkit::WebView::CacheModel::DOCUMENT_VIEWER.
-   * @param[in] cacheModel The cache model option
-   * @see Toolkit::WebView::CacheModel::Type
-   */
-  void SetCacheModel( Toolkit::WebView::CacheModel::Type cacheModel );
-
-  /**
-   * @brief Gets the cookie acceptance policy. The default is Toolkit::WebView::CookieAcceptPolicy::NO_THIRD_PARTY.
-   * @see Toolkit::WebView::CookieAcceptPolicy::Type
-   */
-  Toolkit::WebView::CookieAcceptPolicy::Type GetCookieAcceptPolicy() 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 Returns the title of the Web.
+   *
+   * @return The title of web page
    */
-  void SetCookieAcceptPolicy( Toolkit::WebView::CookieAcceptPolicy::Type policy );
+  std::string GetTitle() const;
 
   /**
    * @brief Get user agent string.
@@ -307,60 +324,22 @@ 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
+   * @brief Updates display area of web view.
+   * @param[in] source The soource triggers Notification.
    */
-  bool AreImagesAutomaticallyLoaded() const;
+  void UpdateDisplayArea( Dali::PropertyNotification& source );
 
   /**
-   * @brief Enables/disables auto loading of images. The default is enabled.
-   *
-   * @param[in] automatic True if images are loaded automatically, false otherwise
+   * @brief Enable/Disable video hole for video playing.
+   * @param[in] enabled True if video hole is enabled, false otherwise.
    */
-  void LoadImagesAutomatically( bool automatic );
+  void EnableVideoHole( bool enabled );
 
   /**
-   * @brief Gets the default text encoding name (e.g. UTF-8).
-   *
-   * @return The default text encoding name
+   * @brief Enable blend mode.
+   * @param[in] blendEnabled True if turn on blend mode, false otherwise.
    */
-  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 );
+  void EnableBlendMode( bool blendEnabled );
 
   /**
    * @brief Callback function to be called when page load started.
@@ -398,6 +377,18 @@ private:
   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::Toolkit::ImageView mFaviconView;
+
+  Dali::PropertyNotification                             mPositionUpdateNotification;
+  Dali::PropertyNotification                             mSizeUpdateNotification;
+  Dali::PropertyNotification                             mScaleUpdateNotification;
+  bool                                                   mVideoHoleEnabled;
+  Dali::Rect< int >                                      mWebViewArea;
 };
 
 } // namespace Internal