Add some new APIs into web engine. 18/250118/4
authorhuayong.xu <huayong.xu@samsung.com>
Fri, 18 Dec 2020 08:08:32 +0000 (16:08 +0800)
committerhuayong.xu <huayong.xu@samsung.com>
Fri, 22 Jan 2021 10:56:43 +0000 (18:56 +0800)
Some new APIs are added, e.g. Create, GetTitle, GetFavicon.

Change-Id: I273cb0ee6fe158674b2af65a7968905a67e4194c

dali/devel-api/adaptor-framework/web-engine-plugin.h
dali/devel-api/adaptor-framework/web-engine.cpp
dali/devel-api/adaptor-framework/web-engine.h
dali/internal/web-engine/common/web-engine-impl.cpp
dali/internal/web-engine/common/web-engine-impl.h

index fbf8d1c..eb4a5fe 100755 (executable)
@@ -26,6 +26,7 @@
 namespace Dali
 {
 class KeyEvent;
+class PixelData;
 class TouchEvent;
 class WebEngineBackForwardList;
 class WebEngineContext;
@@ -89,6 +90,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.
    */
   virtual void Destroy() = 0;
@@ -121,6 +132,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.
    */
   virtual NativeImageInterfacePtr GetNativeImageSource() = 0;
@@ -225,6 +250,11 @@ public:
   virtual void AddJavaScriptMessageHandler(const std::string& exposedObjectName, std::function<void(const std::string&)> handler) = 0;
 
   /**
+   * @brief Clears all tiles resources of Web.
+   */
+  virtual void ClearAllTilesResources() = 0;
+
+  /**
    * @brief Clears the history of Web.
    */
   virtual void ClearHistory() = 0;
index 46130fa..76dfec0 100755 (executable)
@@ -25,6 +25,9 @@
 #include <dali/devel-api/adaptor-framework/web-engine-settings.h>
 #include <dali/internal/web-engine/common/web-engine-impl.h>
 
+// EXTERNAL INCLUDES
+#include <dali/public-api/images/pixel-data.h>
+
 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();
index a01db89..b733353 100755 (executable)
@@ -97,6 +97,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.
    */
   void Destroy();
@@ -134,6 +144,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.
    */
   const std::string& GetUrl();
@@ -231,6 +255,11 @@ public:
   void AddJavaScriptMessageHandler(const std::string& exposedObjectName, std::function<void(const std::string&)> handler);
 
   /**
+   * @brief Clears all tiles resources of Web.
+   */
+  void ClearAllTilesResources();
+
+  /**
    * @brief Clears the history of Web.
    */
   void ClearHistory();
index 3381dac..0943387 100755 (executable)
@@ -32,6 +32,7 @@
 #include <dali/devel-api/adaptor-framework/web-engine-settings.h>
 #include <dali/internal/system/common/environment-variables.h>
 #include <dali/public-api/adaptor-framework/native-image-source.h>
+#include <dali/public-api/images/pixel-data.h>
 
 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()
index 28cedec..a2a6571 100755 (executable)
@@ -64,6 +64,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()
    */
   void Destroy();
@@ -99,11 +104,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()
    */
   void LoadHtmlString( const std::string& htmlString );
@@ -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()