[Tizen] Add WebView APIs for fullscreen, text found, etc.
authordongsug.song <dongsug.song@samsung.com>
Wed, 31 Jul 2024 00:37:32 +0000 (09:37 +0900)
committerdongsug.song <dongsug.song@samsung.com>
Wed, 31 Jul 2024 00:37:35 +0000 (09:37 +0900)
This reverts commit c88a33a12be50f8f449fbcb87a70903015fbfcab.

Change-Id: I34d106c3c939b41d2d5a163ddadcf79f1098d4df

dali-extension/web-engine-chromium/tizen-web-engine-chromium.cpp
dali-extension/web-engine-chromium/tizen-web-engine-chromium.h
dali-extension/web-engine-lwe/tizen-web-engine-lwe.cpp
dali-extension/web-engine-lwe/tizen-web-engine-lwe.h

index 184598b..9d344cb 100644 (file)
@@ -179,11 +179,15 @@ void TizenWebEngineChromium::InitWebView()
   evas_object_smart_callback_add(mWebView, "form,repost,warning,show", &TizenWebEngineChromium::OnFormRepostDecided, this);
   evas_object_smart_callback_add(mWebView, "policy,response,decide", &TizenWebEngineChromium::OnResponsePolicyDecided, this);
   evas_object_smart_callback_add(mWebView, "policy,navigation,decide", &TizenWebEngineChromium::OnNavigationPolicyDecided, this);
+  evas_object_smart_callback_add(mWebView, "policy,newwindow,decide", &TizenWebEngineChromium::OnNewWindowPolicyDecided, this);
   evas_object_smart_callback_add(mWebView, "create,window", &TizenWebEngineChromium::OnNewWindowCreated, this);
   evas_object_smart_callback_add(mWebView, "request,certificate,confirm", &TizenWebEngineChromium::OnCertificateConfirmed, this);
   evas_object_smart_callback_add(mWebView, "ssl,certificate,changed", &TizenWebEngineChromium::OnSslCertificateChanged, this);
   evas_object_smart_callback_add(mWebView, "contextmenu,show", &TizenWebEngineChromium::OnContextMenuShown, this);
   evas_object_smart_callback_add(mWebView, "contextmenu,hide", &TizenWebEngineChromium::OnContextMenuHidden, this);
+  evas_object_smart_callback_add(mWebView, "fullscreen,enterfullscreen", &TizenWebEngineChromium::OnFullscreenEntered, this);
+  evas_object_smart_callback_add(mWebView, "fullscreen,exitfullscreen", &TizenWebEngineChromium::OnFullscreenExited, this);
+  evas_object_smart_callback_add(mWebView, "text,found", &TizenWebEngineChromium::OnTextFound, this);
 
   evas_object_resize(mWebView, mWidth, mHeight);
   evas_object_show(mWebView);
@@ -692,6 +696,11 @@ bool TizenWebEngineChromium::SendWheelEvent(const Dali::WheelEvent& wheel)
   return false;
 }
 
+void TizenWebEngineChromium::ExitFullscreen()
+{
+  ewk_view_fullscreen_exit(mWebView);
+}
+
 void TizenWebEngineChromium::SetFocus(bool focused)
 {
   ecore_evas_focus_set(WebEngineManager::Get().GetWindow(), focused);
@@ -897,6 +906,11 @@ void TizenWebEngineChromium::RegisterNavigationPolicyDecidedCallback(WebEngineNa
   mNavigationPolicyDecidedCallback = callback;
 }
 
+void TizenWebEngineChromium::RegisterNewWindowPolicyDecidedCallback(WebEngineNewWindowPolicyDecidedCallback callback)
+{
+  mNewWindowPolicyDecidedCallback = callback;
+}
+
 void TizenWebEngineChromium::RegisterNewWindowCreatedCallback(WebEngineNewWindowCreatedCallback callback)
 {
   mNewWindowCreatedCallback = callback;
@@ -935,6 +949,21 @@ void TizenWebEngineChromium::RegisterContextMenuHiddenCallback(WebEngineContextM
   mContextMenuHiddenCallback = callback;
 }
 
+void TizenWebEngineChromium::RegisterFullscreenEnteredCallback(WebEngineFullscreenEnteredCallback callback)
+{
+  mFullscreenEnteredCallback = callback;
+}
+
+void TizenWebEngineChromium::RegisterFullscreenExitedCallback(WebEngineFullscreenExitedCallback callback)
+{
+  mFullscreenExitedCallback = callback;
+}
+
+void TizenWebEngineChromium::RegisterTextFoundCallback(WebEngineTextFoundCallback callback)
+{
+  mTextFoundCallback = callback;
+}
+
 Dali::PixelData TizenWebEngineChromium::ConvertImageColorSpace(Evas_Object* image)
 {
   // color-space is argb8888.
@@ -1090,6 +1119,15 @@ void TizenWebEngineChromium::OnNavigationPolicyDecided(void* data, Evas_Object*,
   ExecuteCallback(pThis->mNavigationPolicyDecidedCallback, std::move(webPolicyDecision));
 }
 
+void TizenWebEngineChromium::OnNewWindowPolicyDecided(void* data, Evas_Object*, void* policy)
+{
+  DALI_LOG_RELEASE_INFO("#NewWindowPolicyDecided.\n");
+  auto                                           pThis          = static_cast<TizenWebEngineChromium*>(data);
+  Ewk_Policy_Decision*                           policyDecision = static_cast<Ewk_Policy_Decision*>(policy);
+  std::unique_ptr<Dali::WebEnginePolicyDecision> webPolicyDecision(new TizenWebEnginePolicyDecision(policyDecision));
+  ExecuteCallback(pThis->mNewWindowPolicyDecidedCallback, std::move(webPolicyDecision));
+}
+
 void TizenWebEngineChromium::OnNewWindowCreated(void* data, Evas_Object*, void* out_view)
 {
   DALI_LOG_RELEASE_INFO("#NewWindowCreated.\n");
@@ -1142,6 +1180,28 @@ void TizenWebEngineChromium::OnContextMenuHidden(void* data, Evas_Object*, void*
   ExecuteCallback(pThis->mContextMenuHiddenCallback, std::move(contextMenu));
 }
 
+void TizenWebEngineChromium::OnFullscreenEntered(void* data, Evas_Object*, void*)
+{
+  auto pThis = static_cast<TizenWebEngineChromium*>(data);
+  DALI_LOG_RELEASE_INFO("#FullscreenEntered.\n");
+  ExecuteCallback(pThis->mFullscreenEnteredCallback);
+}
+
+void TizenWebEngineChromium::OnFullscreenExited(void* data, Evas_Object*, void*)
+{
+  auto pThis = static_cast<TizenWebEngineChromium*>(data);
+  DALI_LOG_RELEASE_INFO("#FullscreenExited.\n");
+  ExecuteCallback(pThis->mFullscreenExitedCallback);
+}
+
+void TizenWebEngineChromium::OnTextFound(void* data, Evas_Object*, void* eventInfo)
+{
+  auto pThis = static_cast<TizenWebEngineChromium*>(data);
+  uint32_t count = *((uint32_t*)(eventInfo));
+  DALI_LOG_RELEASE_INFO("#TextFound, count:%u.\n", count);
+  ExecuteCallback(pThis->mTextFoundCallback, count);
+}
+
 void TizenWebEngineChromium::OnAuthenticationChallenged(Evas_Object*, Ewk_Auth_Challenge* authChallenge, void* data)
 {
   DALI_LOG_RELEASE_INFO("#AuthenticationChallenged.\n");
index b2afb00..6f1dab0 100644 (file)
@@ -448,6 +448,11 @@ public:
   bool SendWheelEvent(const Dali::WheelEvent& event) override;
 
   /**
+   * @copydoc Dali::WebEnginePlugin::ExitFullscreen()
+   */
+  void ExitFullscreen() override;
+
+  /**
    * @copydoc Dali::WebEnginePlugin::RegisterFrameRenderedCallback()
    */
   void RegisterFrameRenderedCallback(WebEngineFrameRenderedCallback callback) override;
@@ -503,6 +508,11 @@ public:
   void RegisterNavigationPolicyDecidedCallback(WebEngineNavigationPolicyDecidedCallback callback) override;
 
   /**
+   * @copydoc Dali::WebEnginePlugin::RegisterNewWindowPolicyDecidedCallback()
+   */
+  void RegisterNewWindowPolicyDecidedCallback(WebEngineNewWindowPolicyDecidedCallback callback) override;
+
+  /**
    * @copydoc Dali::WebEnginePlugin::RegisterNewWindowCreatedCallback()
    */
   void RegisterNewWindowCreatedCallback(WebEngineNewWindowCreatedCallback callback) override;
@@ -538,6 +548,21 @@ public:
   void RegisterContextMenuHiddenCallback(WebEngineContextMenuHiddenCallback callback) override;
 
   /**
+   * @copydoc Dali::WebEnginePlugin::RegisterFullscreenEnteredCallback()
+   */
+  void RegisterFullscreenEnteredCallback(WebEngineFullscreenEnteredCallback callback) override;
+
+  /**
+   * @copydoc Dali::WebEnginePlugin::RegisterFullscreenExitedCallback()
+   */
+  void RegisterFullscreenExitedCallback(WebEngineFullscreenExitedCallback callback) override;
+
+  /**
+   * @copydoc Dali::WebEnginePlugin::RegisterTextFoundCallback()
+   */
+  void RegisterTextFoundCallback(WebEngineTextFoundCallback callback) override;
+
+  /**
    * @copydoc Dali::WebEnginePlugin::GetPlainTextAsynchronously()
    */
   void GetPlainTextAsynchronously(PlainTextReceivedCallback callback) override;
@@ -545,28 +570,32 @@ public:
 private:
   static Dali::PixelData ConvertImageColorSpace(Evas_Object* image);
 
-  static void      OnFrameRendered(void* data, Evas_Object*, void* buffer);
-  static void      OnLoadStarted(void* data, Evas_Object*, void*);
-  static void      OnLoadInProgress(void* data, Evas_Object*, void*);
-  static void      OnLoadFinished(void* data, Evas_Object*, void*);
-  static void      OnLoadError(void* data, Evas_Object*, void* rawError);
-  static void      OnUrlChanged(void* data, Evas_Object*, void* newUrl);
-  static void      OnConsoleMessageReceived(void* data, Evas_Object*, void* eventInfo);
-  static void      OnEdgeLeft(void* data, Evas_Object*, void*);
-  static void      OnEdgeRight(void* data, Evas_Object*, void*);
-  static void      OnEdgeTop(void* data, Evas_Object*, void*);
-  static void      OnEdgeBottom(void* data, Evas_Object*, void*);
-  static void      OnFormRepostDecided(void* data, Evas_Object*, void* eventInfo);
-  static void      OnResponsePolicyDecided(void* data, Evas_Object*, void* policy);
-  static void      OnNavigationPolicyDecided(void* data, Evas_Object*, void* policy);
-  static void      OnNewWindowCreated(void* data, Evas_Object*, void* out_view);
-  static void      OnCertificateConfirmed(void* data, Evas_Object*, void* eventInfo);
-  static void      OnSslCertificateChanged(void* data, Evas_Object*, void* eventInfo);
-  static void      OnContextMenuShown(void* data, Evas_Object*, void* eventInfo);
-  static void      OnContextMenuHidden(void* data, Evas_Object*, void* eventInfo);
-  static void      OnAuthenticationChallenged(Evas_Object*, Ewk_Auth_Challenge* authChallenge, void* data);
-  static void      OnJavaScriptEvaluated(Evas_Object* o, const char* result, void* data);
-  static void      OnJavaScriptInjected(Evas_Object* o, Ewk_Script_Message message);
+  static void OnFrameRendered(void* data, Evas_Object*, void* buffer);
+  static void OnLoadStarted(void* data, Evas_Object*, void*);
+  static void OnLoadInProgress(void* data, Evas_Object*, void*);
+  static void OnLoadFinished(void* data, Evas_Object*, void*);
+  static void OnLoadError(void* data, Evas_Object*, void* rawError);
+  static void OnUrlChanged(void* data, Evas_Object*, void* newUrl);
+  static void OnConsoleMessageReceived(void* data, Evas_Object*, void* eventInfo);
+  static void OnEdgeLeft(void* data, Evas_Object*, void*);
+  static void OnEdgeRight(void* data, Evas_Object*, void*);
+  static void OnEdgeTop(void* data, Evas_Object*, void*);
+  static void OnEdgeBottom(void* data, Evas_Object*, void*);
+  static void OnFormRepostDecided(void* data, Evas_Object*, void* eventInfo);
+  static void OnResponsePolicyDecided(void* data, Evas_Object*, void* policy);
+  static void OnNavigationPolicyDecided(void* data, Evas_Object*, void* policy);
+  static void OnNewWindowPolicyDecided(void* data, Evas_Object*, void* policy);
+  static void OnNewWindowCreated(void* data, Evas_Object*, void* out_view);
+  static void OnCertificateConfirmed(void* data, Evas_Object*, void* eventInfo);
+  static void OnSslCertificateChanged(void* data, Evas_Object*, void* eventInfo);
+  static void OnContextMenuShown(void* data, Evas_Object*, void* eventInfo);
+  static void OnContextMenuHidden(void* data, Evas_Object*, void* eventInfo);
+  static void OnFullscreenEntered(void* data, Evas_Object*, void* eventInfo);
+  static void OnFullscreenExited(void* data, Evas_Object*, void* eventInfo);
+  static void OnTextFound(void* data, Evas_Object*, void* eventInfo);
+  static void OnAuthenticationChallenged(Evas_Object*, Ewk_Auth_Challenge* authChallenge, void* data);
+  static void OnJavaScriptEvaluated(Evas_Object* o, const char* result, void* data);
+  static void OnJavaScriptInjected(Evas_Object* o, Ewk_Script_Message message);
   static Eina_Bool OnJavaScriptAlert(Evas_Object* o, const char* alert_text, void*);
   static Eina_Bool OnJavaScriptConfirm(Evas_Object* o, const char* message, void*);
   static Eina_Bool OnJavaScriptPrompt(Evas_Object* o, const char* message, const char* default_value, void*);
@@ -606,6 +635,7 @@ private:
   WebEngineConsoleMessageReceivedCallback  mConsoleMessageReceivedCallback;
   WebEngineResponsePolicyDecidedCallback   mResponsePolicyDecidedCallback;
   WebEngineNavigationPolicyDecidedCallback mNavigationPolicyDecidedCallback;
+  WebEngineNewWindowPolicyDecidedCallback  mNewWindowPolicyDecidedCallback;
   WebEngineNewWindowCreatedCallback        mNewWindowCreatedCallback;
   WebEngineFrameRenderedCallback           mFrameRenderedCallback;
   WebEngineCertificateCallback             mCertificateConfirmedCallback;
@@ -613,6 +643,9 @@ private:
   WebEngineHttpAuthHandlerCallback         mHttpAuthHandlerCallback;
   WebEngineContextMenuShownCallback        mContextMenuShownCallback;
   WebEngineContextMenuHiddenCallback       mContextMenuHiddenCallback;
+  WebEngineFullscreenEnteredCallback       mFullscreenEnteredCallback;
+  WebEngineFullscreenExitedCallback        mFullscreenExitedCallback;
+  WebEngineTextFoundCallback               mTextFoundCallback;
   WebEngineHitTestCreatedCallback          mHitTestCreatedCallback;
   JavaScriptAlertCallback                  mJavaScriptAlertCallback;
   JavaScriptConfirmCallback                mJavaScriptConfirmCallback;
index b957cda..1a54c43 100755 (executable)
@@ -1278,6 +1278,11 @@ bool TizenWebEngineLWE::SendWheelEvent(const Dali::WheelEvent& event)
   return false;
 }
 
+void TizenWebEngineLWE::ExitFullscreen()
+{
+  // NOT IMPLEMENTED
+}
+
 void TizenWebEngineLWE::RegisterFrameRenderedCallback(WebEngineFrameRenderedCallback callback)
 {
   // NOT IMPLEMENTED
@@ -1333,6 +1338,11 @@ void TizenWebEngineLWE::RegisterNavigationPolicyDecidedCallback(WebEngineNavigat
   // NOT IMPLEMENTED
 }
 
+void TizenWebEngineLWE::RegisterNewWindowPolicyDecidedCallback(WebEngineNewWindowPolicyDecidedCallback callback)
+{
+  // NOT IMPLEMENTED
+}
+
 void TizenWebEngineLWE::RegisterNewWindowCreatedCallback(WebEngineNewWindowCreatedCallback callback)
 {
   // NOT IMPLEMENTED
@@ -1363,6 +1373,21 @@ void TizenWebEngineLWE::RegisterContextMenuHiddenCallback(WebEngineContextMenuHi
   // NOT IMPLEMENTED
 }
 
+void TizenWebEngineLWE::RegisterFullscreenEnteredCallback(WebEngineFullscreenEnteredCallback callback)
+{
+  // NOT IMPLEMENTED
+}
+
+void TizenWebEngineLWE::RegisterFullscreenExitedCallback(WebEngineFullscreenExitedCallback callback)
+{
+  // NOT IMPLEMENTED
+}
+
+void TizenWebEngineLWE::RegisterTextFoundCallback(WebEngineTextFoundCallback callback)
+{
+  // NOT IMPLEMENTED
+}
+
 void TizenWebEngineLWE::GetPlainTextAsynchronously(PlainTextReceivedCallback callback)
 {
   // NOT IMPLEMENTED
index a4adc7e..d48102a 100755 (executable)
@@ -459,6 +459,11 @@ public:
   bool SendWheelEvent(const Dali::WheelEvent& event) override;
 
   /**
+   * @copydoc Dali::WebEnginePlugin::ExitFullscreen()
+   */
+  void ExitFullscreen() override;
+
+  /**
    * @copydoc Dali::WebEnginePlugin::RegisterFrameRenderedCallback()
    */
   void RegisterFrameRenderedCallback(WebEngineFrameRenderedCallback callback) override;
@@ -514,6 +519,11 @@ public:
   void RegisterNavigationPolicyDecidedCallback(WebEngineNavigationPolicyDecidedCallback callback) override;
 
   /**
+   * @copydoc Dali::WebEnginePlugin::RegisterNewWindowPolicyDecidedCallback()
+   */
+  void RegisterNewWindowPolicyDecidedCallback(WebEngineNewWindowPolicyDecidedCallback callback) override;
+
+  /**
    * @copydoc Dali::WebEnginePlugin::RegisterNewWindowCreatedCallback()
    */
   void RegisterNewWindowCreatedCallback(WebEngineNewWindowCreatedCallback callback) override;
@@ -544,6 +554,21 @@ public:
   void RegisterContextMenuHiddenCallback(WebEngineContextMenuHiddenCallback callback) override;
 
   /**
+   * @copydoc Dali::WebEnginePlugin::RegisterFullscreenEnteredCallback()
+   */
+  void RegisterFullscreenEnteredCallback(WebEngineFullscreenEnteredCallback callback) override;
+
+  /**
+   * @copydoc Dali::WebEnginePlugin::RegisterFullscreenExitedCallback()
+   */
+  void RegisterFullscreenExitedCallback(WebEngineFullscreenExitedCallback callback) override;
+
+  /**
+   * @copydoc Dali::WebEnginePlugin::RegisterTextFoundCallback()
+   */
+  void RegisterTextFoundCallback(WebEngineTextFoundCallback callback) override;
+
+  /**
    * @copydoc Dali::WebEnginePlugin::GetPlainTextAsynchronously()
    */
   void GetPlainTextAsynchronously(PlainTextReceivedCallback callback) override;