From: huayong.xu Date: Fri, 18 Dec 2020 08:08:32 +0000 (+0800) Subject: Add some new APIs into web engine. X-Git-Tag: dali_2.0.11~5^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8d56551c7f8808b20aa3f3140e4b932b633d237c;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git Add some new APIs into web engine. Some new APIs are added, e.g. Create, GetTitle, GetFavicon. Change-Id: I273cb0ee6fe158674b2af65a7968905a67e4194c --- diff --git a/dali/devel-api/adaptor-framework/web-engine-plugin.h b/dali/devel-api/adaptor-framework/web-engine-plugin.h index fbf8d1ce2..eb4a5fe8d 100755 --- a/dali/devel-api/adaptor-framework/web-engine-plugin.h +++ b/dali/devel-api/adaptor-framework/web-engine-plugin.h @@ -26,6 +26,7 @@ namespace Dali { class KeyEvent; +class PixelData; class TouchEvent; class WebEngineBackForwardList; class WebEngineContext; @@ -88,6 +89,16 @@ public: */ virtual void Create(int width, int height, const std::string& locale, const std::string& timezoneId) = 0; + /** + * @brief Creates WebEngine instance. + * + * @param [in] width The width of Web + * @param [in] height The height of Web + * @param [in] argc The count of application arguments + * @param [in] argv The string array of application arguments + */ + virtual void Create( int width, int height, int argc, char** argv ) = 0; + /** * @brief Destroys WebEngine instance. */ @@ -120,6 +131,20 @@ public: */ virtual void LoadUrl(const std::string& url) = 0; + /** + * @brief Returns the title of the Web. + * + * @return The title of web page + */ + virtual std::string GetTitle() const = 0; + + /** + * @brief Returns the Favicon of the Web. + * + * @return Favicon of Dali::PixelData& type + */ + virtual Dali::PixelData GetFavicon() const = 0; + /** * @brief Gets image to render. */ @@ -224,6 +249,11 @@ public: */ virtual void AddJavaScriptMessageHandler(const std::string& exposedObjectName, std::function handler) = 0; + /** + * @brief Clears all tiles resources of Web. + */ + virtual void ClearAllTilesResources() = 0; + /** * @brief Clears the history of Web. */ diff --git a/dali/devel-api/adaptor-framework/web-engine.cpp b/dali/devel-api/adaptor-framework/web-engine.cpp index 46130fac9..76dfec0f3 100755 --- a/dali/devel-api/adaptor-framework/web-engine.cpp +++ b/dali/devel-api/adaptor-framework/web-engine.cpp @@ -25,6 +25,9 @@ #include #include +// EXTERNAL INCLUDES +#include + namespace Dali { WebEngine::WebEngine() @@ -71,6 +74,11 @@ void WebEngine::Create(int width, int height, const std::string& locale, const s GetImplementation(*this).Create(width, height, locale, timezoneId); } +void WebEngine::Create( int width, int height, int argc, char** argv ) +{ + GetImplementation( *this ).Create( width, height, argc, argv ); +} + void WebEngine::Destroy() { GetImplementation(*this).Destroy(); @@ -106,6 +114,16 @@ void WebEngine::LoadUrl(const std::string& url) return GetImplementation(*this).LoadUrl(url); } +std::string WebEngine::GetTitle() const +{ + return GetImplementation( *this ).GetTitle(); +} + +Dali::PixelData WebEngine::GetFavicon() const +{ + return GetImplementation( *this ).GetFavicon(); +} + const std::string& WebEngine::GetUrl() { return GetImplementation(*this).GetUrl(); @@ -191,6 +209,11 @@ void WebEngine::AddJavaScriptMessageHandler(const std::string& exposedObjectName GetImplementation(*this).AddJavaScriptMessageHandler(exposedObjectName, handler); } +void WebEngine::ClearAllTilesResources() +{ + GetImplementation( *this ).ClearAllTilesResources(); +} + void WebEngine::ClearHistory() { return GetImplementation(*this).ClearHistory(); diff --git a/dali/devel-api/adaptor-framework/web-engine.h b/dali/devel-api/adaptor-framework/web-engine.h index a01db8987..b733353ca 100755 --- a/dali/devel-api/adaptor-framework/web-engine.h +++ b/dali/devel-api/adaptor-framework/web-engine.h @@ -96,6 +96,16 @@ public: */ void Create(int width, int height, const std::string& locale, const std::string& timezoneId); + /** + * @brief Creates WebEngine instance. + * + * @param [in] width The width of Web + * @param [in] height The height of Web + * @param [in] argc The count of application arguments + * @param [in] argv The string array of application arguments + */ + void Create( int width, int height, int argc, char** argv ); + /** * @brief Destroys WebEngine instance. */ @@ -133,6 +143,20 @@ public: */ void LoadUrl(const std::string& url); + /** + * @brief Returns the title of the Web. + * + * @return The title of web page + */ + std::string GetTitle() const; + + /** + * @brief Returns the Favicon of the Web. + * + * @return FavIcon of Dali::PixelData& type + */ + Dali::PixelData GetFavicon() const; + /** * @brief Gets the url. */ @@ -230,6 +254,11 @@ public: */ void AddJavaScriptMessageHandler(const std::string& exposedObjectName, std::function handler); + /** + * @brief Clears all tiles resources of Web. + */ + void ClearAllTilesResources(); + /** * @brief Clears the history of Web. */ diff --git a/dali/internal/web-engine/common/web-engine-impl.cpp b/dali/internal/web-engine/common/web-engine-impl.cpp index 3381dac7b..09433876e 100755 --- a/dali/internal/web-engine/common/web-engine-impl.cpp +++ b/dali/internal/web-engine/common/web-engine-impl.cpp @@ -32,6 +32,7 @@ #include #include #include +#include namespace Dali { @@ -172,6 +173,11 @@ void WebEngine::Create( int width, int height, const std::string& locale, const mPlugin->Create( width, height, locale, timezoneId ); } +void WebEngine::Create( int width, int height, int argc, char** argv ) +{ + mPlugin->Create( width, height, argc, argv ); +} + void WebEngine::Destroy() { mPlugin->Destroy(); @@ -207,11 +213,31 @@ void WebEngine::LoadUrl( const std::string& url ) mPlugin->LoadUrl( url ); } +std::string WebEngine::GetTitle() const +{ + return mPlugin->GetTitle(); +} + +Dali::PixelData WebEngine::GetFavicon() const +{ + return mPlugin->GetFavicon(); +} + const std::string& WebEngine::GetUrl() { return mPlugin->GetUrl(); } +const std::string& WebEngine::GetUserAgent() const +{ + return mPlugin->GetUserAgent(); +} + +void WebEngine::SetUserAgent( const std::string& userAgent ) +{ + mPlugin->SetUserAgent( userAgent ); +} + void WebEngine::LoadHtmlString( const std::string& htmlString ) { mPlugin->LoadHtmlString( htmlString ); @@ -292,14 +318,9 @@ void WebEngine::AddJavaScriptMessageHandler( const std::string& exposedObjectNam mPlugin->AddJavaScriptMessageHandler( exposedObjectName, handler ); } -const std::string& WebEngine::GetUserAgent() const +void WebEngine::ClearAllTilesResources() { - return mPlugin->GetUserAgent(); -} - -void WebEngine::SetUserAgent( const std::string& userAgent ) -{ - mPlugin->SetUserAgent( userAgent ); + mPlugin->ClearAllTilesResources(); } void WebEngine::ClearHistory() diff --git a/dali/internal/web-engine/common/web-engine-impl.h b/dali/internal/web-engine/common/web-engine-impl.h index 28cedec0a..a2a657139 100755 --- a/dali/internal/web-engine/common/web-engine-impl.h +++ b/dali/internal/web-engine/common/web-engine-impl.h @@ -63,6 +63,11 @@ public: */ void Create( int width, int height, const std::string& locale, const std::string& timezoneId ); + /** + * @copydoc Dali::WebEngine::Create() + */ + void Create( int width, int height, int argc, char** argv ); + /** * @copydoc Dali::WebEngine::Destroy() */ @@ -98,11 +103,31 @@ public: */ void LoadUrl( const std::string& url ); + /** + * @copydoc Dali::WebEngine::GetTitle() + */ + std::string GetTitle() const; + + /** + * @copydoc Dali::WebEngine::GetFavicon() + */ + Dali::PixelData GetFavicon() const; + /** * @copydoc Dali::WebEngine::GetUrl() */ const std::string& GetUrl(); + /** + * @copydoc Dali::WebEngine::GetUserAgent() + */ + const std::string& GetUserAgent() const; + + /** + * @copydoc Dali::WebEngine::SetUserAgent() + */ + void SetUserAgent( const std::string& userAgent ); + /** * @copydoc Dali::WebEngine::LoadHtmlString() */ @@ -184,14 +209,9 @@ public: void AddJavaScriptMessageHandler( const std::string& exposedObjectName, std::function< void(const std::string&) > handler ); /** - * @copydoc Dali::WebEngine::GetUserAgent() + * @copydoc Dali::WebEngine::ClearAllTilesResources() */ - const std::string& GetUserAgent() const; - - /** - * @copydoc Dali::WebEngine::SetUserAgent() - */ - void SetUserAgent( const std::string& userAgent ); + void ClearAllTilesResources(); /** * @copydoc Dali::WebEngine::ClearHistory()