X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Fweb-view%2Fweb-view-impl.h;h=e3e61b3211a46d582c1f786f8fab2f77db21aa20;hp=bce288d5dc23f86ac147212be9c68981bfb429ae;hb=cf5f3348fac583716248323ab040f384f856e39a;hpb=e5d379064ba0e9a68d1d2680906952dbde263f34 diff --git a/dali-toolkit/internal/controls/web-view/web-view-impl.h b/dali-toolkit/internal/controls/web-view/web-view-impl.h old mode 100644 new mode 100755 index bce288d..e3e61b3 --- a/dali-toolkit/internal/controls/web-view/web-view-impl.h +++ b/dali-toolkit/internal/controls/web-view/web-view-impl.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_INTERNAL_WEB_VIEW_H /* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,13 +19,15 @@ */ // EXTERNAL INCLUDES +#include #include #include // INTERNAL INCLUDES +#include #include #include -#include +#include namespace Dali { @@ -34,7 +36,11 @@ namespace Toolkit { class KeyEvent; -class TouchData; +class TouchEvent; +class WebBackForwardList; +class WebContext; +class WebCookieManager; +class WebSettings; class WebView; namespace Internal @@ -48,6 +54,8 @@ protected: WebView( const std::string& locale, const std::string& timezoneId ); + WebView( int argc, char** argv ); + virtual ~WebView(); public: @@ -63,6 +71,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 +110,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 +133,11 @@ public: void Resume(); /** + * @copydoc Dali::Toolkit::WebView::ScrollBy() + */ + void ScrollBy( int deltaX, int deltaY ); + + /** * @copydoc Dali::Toolkit::WebView::CanGoForward() */ bool CanGoForward(); @@ -123,19 +168,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() @@ -152,6 +192,11 @@ public: */ Dali::Toolkit::WebView::WebViewPageLoadErrorSignalType& PageLoadErrorSignal(); + /** + * @copydoc Dali::Toolkit::WebView::ScrollEdgeReachedSignal() + */ + Dali::Toolkit::WebView::WebViewScrollEdgeReachedSignalType& ScrollEdgeReachedSignal(); + public: // Properties /** @@ -188,17 +233,17 @@ private: // From Control /** * @copydoc Toolkit::Control::OnInitialize() */ - virtual void OnInitialize(); + void OnInitialize() override; /** * @copydoc Toolkit::Control::GetNaturalSize */ - virtual Vector3 GetNaturalSize(); + Vector3 GetNaturalSize() override; /** * @copydoc Toolkit::Control::OnRelayout() */ - virtual void OnRelayout( const Vector2& size, RelayoutContainer& container ); + void OnRelayout( const Vector2& size, RelayoutContainer& container ) override; /** * Signal occurs when the Web View has been touched. @@ -206,113 +251,76 @@ private: // From Control * @param[in] touch The Touch Data. * @return Whether to consume event or not. */ - bool OnTouchEvent( Actor actor, const Dali::TouchData& touch ); + bool OnTouchEvent( Actor actor, const Dali::TouchEvent& touch ); /** * @copydoc Toolkit::Control::OnKeyEvent() */ - virtual bool OnKeyEvent( const Dali::KeyEvent& event ); - -private: - - // Undefined - WebView( const WebView& webView ); - - WebView& operator=( const WebView& webView ); - - /** - * @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 ); + bool OnKeyEvent( const Dali::KeyEvent& event ) override; /** - * @brief Gets the cookie acceptance policy. The default is Toolkit::WebView::CookieAcceptPolicy::NO_THIRD_PARTY. - * @see Toolkit::WebView::CookieAcceptPolicy::Type + * @copydoc Toolkit::Control::OnKeyInputFocusGained() */ - Toolkit::WebView::CookieAcceptPolicy::Type GetCookieAcceptPolicy() const; + void OnKeyInputFocusGained() override; /** - * @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 + * @copydoc Toolkit::Control::OnKeyInputFocusLost() */ - void SetCookieAcceptPolicy( Toolkit::WebView::CookieAcceptPolicy::Type policy ); + void OnKeyInputFocusLost() override; - /** - * @brief Get user agent string. - * @return The string value of user agent - */ - const std::string& GetUserAgent() const; +private: - /** - * @brief Set user agent string. - * @param[in] userAgent The string value of user agent - */ - void SetUserAgent( const std::string& userAgent ); + // Undefined + WebView( const WebView& webView ); - /** - * @brief Returns whether JavaScript can be executable. The default is true. - * - * @return true if JavaScript executing is enabled, false otherwise - */ - bool IsJavaScriptEnabled() const; + WebView& operator=( const WebView& webView ); /** - * @brief Enables/disables JavaScript executing. The default is enabled. - * - * @param[in] enabled True if JavaScript executing is enabled, false otherwise + * @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 */ - void EnableJavaScript( bool enabled ); + void SetScrollPosition( int x, int y ); /** - * @brief Returns whether images can be loaded automatically. The default is true. - * - * @return true if images are loaded automatically, false otherwise + * @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 */ - bool AreImagesAutomaticallyLoaded() const; + void GetScrollPosition( int& x, int& y ) const; /** - * @brief Enables/disables auto loading of images. The default is enabled. - * - * @param[in] automatic True if images are loaded automatically, false otherwise + * @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 LoadImagesAutomatically( bool automatic ); + void GetScrollSize( int& width, int& height ) const; /** - * @brief Gets the default text encoding name (e.g. UTF-8). - * - * @return The default text encoding name + * @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 */ - const std::string& GetDefaultTextEncodingName() const; + void GetContentSize( int& width, int& height ) const; /** - * @brief Sets the default text encoding name (e.g. UTF-8). + * @brief Returns the title of the Web. * - * @param[in] defaultTextEncodingName The default text encoding name + * @return The title of web page */ - void SetDefaultTextEncodingName( const std::string& defaultTextEncodingName ); + std::string GetTitle() const; /** - * @brief Returns the default font size in pixel. The default value is 16. - * - * @return The default font size + * @brief Get user agent string. + * @return The string value of user agent */ - int GetDefaultFontSize() const; + const std::string& GetUserAgent() const; /** - * @brief Sets the default font size in pixel. The default value is 16. - * - * @param[in] defaultFontSize A new default font size to set + * @brief Set user agent string. + * @param[in] userAgent The string value of user agent */ - void SetDefaultFontSize( int defaultFontSize ); + void SetUserAgent( const std::string& userAgent ); /** * @brief Callback function to be called when page load started. @@ -333,6 +341,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; @@ -343,6 +357,13 @@ private: Dali::Toolkit::WebView::WebViewPageLoadSignalType mPageLoadStartedSignal; Dali::Toolkit::WebView::WebViewPageLoadSignalType mPageLoadFinishedSignal; Dali::Toolkit::WebView::WebViewPageLoadErrorSignalType mPageLoadErrorSignal; + Dali::Toolkit::WebView::WebViewScrollEdgeReachedSignalType mScrollEdgeReachedSignal; + + std::unique_ptr mWebContext; + std::unique_ptr mWebCookieManager; + std::unique_ptr mWebSettings; + std::unique_ptr mWebBackForwardList; + Dali::Toolkit::ImageView mFaviconView; }; } // namespace Internal