[Tizen] Add an API for 'create,window' event. 85/285285/1
authorhuayong.xu <huayong.xu@samsung.com>
Wed, 7 Dec 2022 09:03:50 +0000 (17:03 +0800)
committerhuayong.xu <huayong.xu@samsung.com>
Wed, 7 Dec 2022 09:03:50 +0000 (17:03 +0800)
Change-Id: I57a6cbdd88c539b1742fd380b28e11ba9874e27b

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 ad72e6ea4c0480c38fbd717a80661bc11b6553d1..b203a30c53025b363e21293d8f37add56f7a4d93 100755 (executable)
@@ -82,6 +82,11 @@ public:
    */
   using WebEngineNavigationPolicyDecidedCallback = std::function<void(std::unique_ptr<Dali::WebEnginePolicyDecision>)>;
 
+  /**
+   * @brief WebView callback related with a new window would be created.
+   */
+  using WebEngineNewWindowCreatedCallback = std::function<void(Dali::WebEnginePlugin*&)>;
+
   /**
    * @brief Enumeration for the scroll edge.
    */
@@ -179,7 +184,7 @@ public:
    *
    * @return Url of string type
    */
-  virtual const std::string& GetUrl() = 0;
+  virtual std::string GetUrl() const = 0;
 
   /**
    * @brief Loads a given string as web contents.
@@ -288,7 +293,7 @@ public:
    *
    * @return The string value of user agent
    */
-  virtual const std::string& GetUserAgent() const = 0;
+  virtual std::string GetUserAgent() const = 0;
 
   /**
    * @brief Set user agent string.
@@ -371,6 +376,13 @@ public:
    */
   virtual void RegisterNavigationPolicyDecidedCallback(WebEngineNavigationPolicyDecidedCallback callback) = 0;
 
+  /**
+   * @brief Callback to be called when a new window would be created.
+   *
+   * @param[in] callback
+   */
+  virtual void RegisterNewWindowCreatedCallback(WebEngineNewWindowCreatedCallback callback) = 0;
+
   /**
    * @brief Get a plain text of current web page asynchronously.
    *
index c00723e4f4e5e4388fe93a7f500d1f8e4178b4bf..3f8f9270c54b929b21f2fd1a41aa3d0b46cbc2d0 100755 (executable)
@@ -85,6 +85,11 @@ void WebEngine::Destroy()
   GetImplementation(*this).Destroy();
 }
 
+WebEnginePlugin* WebEngine::GetPlugin() const
+{
+  return GetImplementation(*this).GetPlugin();
+}
+
 NativeImageInterfacePtr WebEngine::GetNativeImageSource()
 {
   return GetImplementation(*this).GetNativeImageSource();
@@ -125,7 +130,7 @@ Dali::PixelData WebEngine::GetFavicon() const
   return GetImplementation(*this).GetFavicon();
 }
 
-const std::string& WebEngine::GetUrl()
+std::string WebEngine::GetUrl() const
 {
   return GetImplementation(*this).GetUrl();
 }
@@ -220,7 +225,7 @@ void WebEngine::ClearHistory()
   return GetImplementation(*this).ClearHistory();
 }
 
-const std::string& WebEngine::GetUserAgent() const
+std::string WebEngine::GetUserAgent() const
 {
   return GetImplementation(*this).GetUserAgent();
 }
@@ -290,6 +295,11 @@ void WebEngine::RegisterNavigationPolicyDecidedCallback(Dali::WebEnginePlugin::W
   GetImplementation(*this).RegisterNavigationPolicyDecidedCallback(callback);
 }
 
+void WebEngine::RegisterNewWindowCreatedCallback(Dali::WebEnginePlugin::WebEngineNewWindowCreatedCallback callback)
+{
+  GetImplementation(*this).RegisterNewWindowCreatedCallback(callback);
+}
+
 void WebEngine::GetPlainTextAsynchronously(Dali::WebEnginePlugin::PlainTextReceivedCallback callback)
 {
   GetImplementation(*this).GetPlainTextAsynchronously(callback);
index 83fbb84ea824ec1537ba419ca1f31724a7469058..2f26b732bc66ec2b9c181452eb50d8c3f892f4a8 100755 (executable)
@@ -111,6 +111,11 @@ public:
    */
   void Destroy();
 
+  /**
+   * @brief Gets web engine plugin.
+   */
+  Dali::WebEnginePlugin* GetPlugin() const;
+
   /**
    * @brief Gets native image source to render.
    */
@@ -160,7 +165,7 @@ public:
   /**
    * @brief Gets the url.
    */
-  const std::string& GetUrl();
+  std::string GetUrl() const;
 
   /**
    * @brief Loads a given string as web contents.
@@ -269,7 +274,7 @@ public:
    *
    * @return The string value of user agent
    */
-  const std::string& GetUserAgent() const;
+  std::string GetUserAgent() const;
 
   /**
    * @brief Set user agent string.
@@ -353,6 +358,13 @@ public:
    */
   void RegisterNavigationPolicyDecidedCallback(Dali::WebEnginePlugin::WebEngineNavigationPolicyDecidedCallback callback);
 
+  /**
+   * @brief Callback to be called when a new window would be created.
+   *
+   * @param[in] callback
+   */
+  void RegisterNewWindowCreatedCallback(Dali::WebEnginePlugin::WebEngineNewWindowCreatedCallback callback);
+
   /**
    * @brief Get a plain text of current web page asynchronously.
    *
index 9bd7399802d06dd4e7f3d25c1c028723bf78c401..83a2fd0a711e84e741ea821f3a7e266fdacb72ca 100755 (executable)
@@ -175,6 +175,11 @@ void WebEngine::Create(int width, int height, int argc, char** argv)
   mPlugin->Create(width, height, argc, argv);
 }
 
+Dali::WebEnginePlugin* WebEngine::GetPlugin() const
+{
+  return mPlugin;
+}
+
 void WebEngine::Destroy()
 {
   mPlugin->Destroy();
@@ -220,12 +225,12 @@ Dali::PixelData WebEngine::GetFavicon() const
   return mPlugin->GetFavicon();
 }
 
-const std::string& WebEngine::GetUrl()
+std::string WebEngine::GetUrl() const
 {
   return mPlugin->GetUrl();
 }
 
-const std::string& WebEngine::GetUserAgent() const
+std::string WebEngine::GetUserAgent() const
 {
   return mPlugin->GetUserAgent();
 }
@@ -385,6 +390,11 @@ void WebEngine::RegisterNavigationPolicyDecidedCallback(Dali::WebEnginePlugin::W
   mPlugin->RegisterNavigationPolicyDecidedCallback(callback);
 }
 
+void WebEngine::RegisterNewWindowCreatedCallback(Dali::WebEnginePlugin::WebEngineNewWindowCreatedCallback callback)
+{
+  mPlugin->RegisterNewWindowCreatedCallback(callback);
+}
+
 void WebEngine::GetPlainTextAsynchronously(Dali::WebEnginePlugin::PlainTextReceivedCallback callback)
 {
   mPlugin->GetPlainTextAsynchronously(callback);
index 1d7f1ca38a59c16c76611125c87eb4f9f9c11952..4f3acab6ad39dc935d9266c32b582254b8382f7b 100755 (executable)
@@ -69,6 +69,11 @@ public:
    */
   void Destroy();
 
+  /**
+   * @copydoc Dali::WebEngine::GetPlugin()
+   */
+  Dali::WebEnginePlugin* GetPlugin() const;
+
   /**
    * @copydoc Dali::WebEngine::GetNativeImageSource()
    */
@@ -112,12 +117,12 @@ public:
   /**
    * @copydoc Dali::WebEngine::GetUrl()
    */
-  const std::string& GetUrl();
+  std::string GetUrl() const;
 
   /**
    * @copydoc Dali::WebEngine::GetUserAgent()
    */
-  const std::string& GetUserAgent() const;
+  std::string GetUserAgent() const;
 
   /**
    * @copydoc Dali::WebEngine::SetUserAgent()
@@ -274,6 +279,11 @@ public:
    */
   void RegisterNavigationPolicyDecidedCallback(Dali::WebEnginePlugin::WebEngineNavigationPolicyDecidedCallback callback);
 
+  /**
+   @copydoc Dali::WebEngine::RegisterNewWindowCreatedCallback()
+   */
+  void RegisterNewWindowCreatedCallback(Dali::WebEnginePlugin::WebEngineNewWindowCreatedCallback callback);
+
   /**
    * @copydoc Dali::WebEngine::GetPlainTextAsynchronously()
    */