Merge WebContentsViewEflDelegate to WebContentsEflDelegate 78/285978/6
authorBakka Uday Kiran <b.kiran@samsung.com>
Fri, 23 Dec 2022 09:49:09 +0000 (15:19 +0530)
committerDae-Hyun Ko <dhyuna.ko@samsung.com>
Tue, 27 Dec 2022 02:26:50 +0000 (02:26 +0000)
For AURA, WebContentsViewEfl is not used as it is replaced by WebContentsViewAura,
hence its delegate WebContentsViewEflDelegate cannot be instantiated without it.
So this patch moves the interfaces from WebContentsViewEflDelegate to WebContentsEflDelegate,
and called via WebContentsImplEfl::GetDelegate().

As there are many delegate classes under tizen_src causing confusion sometimes;
removing WebContentsViewEflDelegate improves code structure and understandability.

Reference: https://review.tizen.org/gerrit/274379

Change-Id: I0f8e2220ece36594a710d179a4706878b14a9ab4
Signed-off-by: Bakka Uday Kiran <b.kiran@samsung.com>
tizen_src/chromium_impl/content/browser/browser_efl.gni
tizen_src/chromium_impl/content/browser/screen_orientation/screen_orientation_delegate_efl.cc
tizen_src/chromium_impl/content/public/browser/web_contents_efl_delegate.h
tizen_src/chromium_impl/content/public/browser/web_contents_view_efl_delegate.h [deleted file]
tizen_src/ewk/efl_integration/BUILD.gn
tizen_src/ewk/efl_integration/eweb_view.cc
tizen_src/ewk/efl_integration/web_contents_efl_delegate_ewk.cc
tizen_src/ewk/efl_integration/web_contents_efl_delegate_ewk.h
tizen_src/ewk/efl_integration/web_contents_view_efl_delegate_ewk.cc [deleted file]
tizen_src/ewk/efl_integration/web_contents_view_efl_delegate_ewk.h [deleted file]

index ed7da4058c16a9052555754077611f2aa444434b..1ae5fbff848783c67179b5a8f8dd97620e1d6fd6 100644 (file)
@@ -69,7 +69,6 @@ external_content_browser_efl_sources = [
   "//tizen_src/chromium_impl/content/browser/javascript_dialog/javascript_modal_dialog.cc",
   "//tizen_src/chromium_impl/content/browser/javascript_dialog/javascript_modal_dialog.h",
   "//tizen_src/chromium_impl/content/browser/public/browser/web_contents_efl_delegate.h",
-  "//tizen_src/chromium_impl/content/browser/public/browser/web_contents_view_efl_delegate.h",
   "//tizen_src/chromium_impl/content/browser/renderer_host/edge_effect.cc",
   "//tizen_src/chromium_impl/content/browser/renderer_host/edge_effect.h",
   "//tizen_src/chromium_impl/content/browser/renderer_host/rwhv_aura_offscreen_helper_efl.cc",
index 00c55949e4fdbdda5ec8bc9d6a082c8b4b0fc403..4fcddbfa2c5c0807fd4378cd653f52c350cc4e4c 100644 (file)
@@ -8,7 +8,7 @@
 #include "chromium_impl/content/browser/web_contents/web_contents_impl_efl.h"
 #include "content/public/browser/web_contents.h"
 #include "content/public/browser/web_contents_delegate.h"
-#include "ewk/efl_integration/web_contents_view_efl_delegate_ewk.h"
+#include "ewk/efl_integration/web_contents_efl_delegate_ewk.h"
 
 namespace content {
 
@@ -31,12 +31,9 @@ bool ScreenOrientationDelegateEfl::FullScreenRequired(
 void ScreenOrientationDelegateEfl::Lock(
     WebContents* web_contents,
     device::mojom::ScreenOrientationLockType lock_orientation) {
-#if !defined(USE_AURA)
-  WebContentsImpl* wci = static_cast<WebContentsImpl*>(web_contents);
-  WebContentsViewEfl* wcve = static_cast<WebContentsViewEfl*>(wci->GetView());
-  if (wcve->GetEflDelegate())
-    wcve->GetEflDelegate()->OrientationLock(lock_orientation);
-#endif
+  WebContentsImplEfl* wcie = static_cast<WebContentsImplEfl*>(web_contents);
+  if (wcie->GetEflDelegate())
+    wcie->GetEflDelegate()->OrientationLock(lock_orientation);
 }
 
 bool ScreenOrientationDelegateEfl::ScreenOrientationProviderSupported(
@@ -46,12 +43,9 @@ bool ScreenOrientationDelegateEfl::ScreenOrientationProviderSupported(
 }
 
 void ScreenOrientationDelegateEfl::Unlock(WebContents* web_contents) {
-#if !defined(USE_AURA)
-  WebContentsImpl* wci = static_cast<WebContentsImpl*>(web_contents);
-  WebContentsViewEfl* wcve = static_cast<WebContentsViewEfl*>(wci->GetView());
-  if (wcve->GetEflDelegate())
-    wcve->GetEflDelegate()->OrientationUnlock();
-#endif
+  WebContentsImplEfl* wcie = static_cast<WebContentsImplEfl*>(web_contents);
+  if (wcie->GetEflDelegate())
+    wcie->GetEflDelegate()->OrientationUnlock();
 }
 
 } // namespace content
index 1e808bd86d382eeba27b9b4242aa6b419572000a..75d3cc51d58fa4aa3cd1c5b01afb0159d507f1bf 100644 (file)
@@ -5,13 +5,22 @@
 #ifndef CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_EFL_DELEGATE_H_
 #define CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_EFL_DELEGATE_H_
 
+#include <vector>
+
 #include "base/callback.h"
 #include "content/common/content_export.h"
+#include "content/public/browser/context_menu_params.h"
+#include "services/device/public/mojom/screen_orientation_lock_types.mojom.h"
+#include "third_party/blink/public/common/context_menu_data/menu_item_info.h"
+#include "third_party/blink/public/common/input/web_gesture_event.h"
+#include "third_party/blink/public/common/input/web_input_event.h"
+#include "ui/gfx/geometry/rect.h"
 
 class GURL;
 
 namespace content {
 
+class RenderFrameHost;
 class WebContents;
 
 class CONTENT_EXPORT WebContentsEflDelegate {
@@ -38,6 +47,28 @@ class CONTENT_EXPORT WebContentsEflDelegate {
   // This is needed when a window is created with window.open or target:_blank,
   // where RenderWidgetHostViewXXX objects are created earlier in the call chain.
   virtual void SetUpSmartObject(void* platform_data, void* native_view) = 0;
+
+  virtual void ShowPopupMenu(RenderFrameHost* render_frame_host,
+                             const gfx::Rect& bounds,
+                             int item_height,
+                             double item_font_size,
+                             int selected_item,
+                             const std::vector<blink::MenuItemInfo>& items,
+                             bool right_aligned,
+                             bool allow_multiple_selection) = 0;
+  virtual void HidePopupMenu() = 0;
+
+  virtual void CancelContextMenu(int request_id) = 0;
+
+  virtual void QuerySelectionStyle() = 0;
+  virtual void HandleZoomGesture(blink::WebGestureEvent& event) = 0;
+
+  virtual bool UseKeyPadWithoutUserAction() = 0;
+
+  virtual void ShowContextMenu(const ContextMenuParams& params) = 0;
+
+  virtual void OrientationLock(device::mojom::ScreenOrientationLockType) = 0;
+  virtual void OrientationUnlock() = 0;
 };
 
 } // namespace content
diff --git a/tizen_src/chromium_impl/content/public/browser/web_contents_view_efl_delegate.h b/tizen_src/chromium_impl/content/public/browser/web_contents_view_efl_delegate.h
deleted file mode 100644 (file)
index 71bb716..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright 2015 Samsung Electronics. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_VIEW_EFL_DELEGATE_H_
-#define CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_VIEW_EFL_DELEGATE_H_
-
-#include <vector>
-
-#include "content/common/content_export.h"
-#include "content/public/browser/context_menu_params.h"
-#include "services/device/public/mojom/screen_orientation_lock_types.mojom.h"
-#include "third_party/blink/public/common/context_menu_data/menu_item_info.h"
-#include "third_party/blink/public/common/input/web_gesture_event.h"
-#include "third_party/blink/public/common/input/web_input_event.h"
-#include "ui/gfx/geometry/rect.h"
-
-namespace content {
-
-class RenderFrameHost;
-
-class WebContentsViewEflDelegate {
- public:
-  WebContentsViewEflDelegate() {};
-  virtual ~WebContentsViewEflDelegate() {};
-
-  virtual void ShowPopupMenu(RenderFrameHost* render_frame_host,
-                             const gfx::Rect& bounds,
-                             int item_height,
-                             double item_font_size,
-                             int selected_item,
-                             const std::vector<blink::MenuItemInfo>& items,
-                             bool right_aligned,
-                             bool allow_multiple_selection) = 0;
-  virtual void HidePopupMenu() = 0;
-
-  virtual void SetPageTitle(const std::u16string& title) = 0;
-  virtual void CancelContextMenu(int request_id) = 0;
-
-  virtual void QuerySelectionStyle() = 0;
-  virtual void HandleZoomGesture(blink::WebGestureEvent& event) = 0;
-
-  virtual bool UseKeyPadWithoutUserAction() = 0;
-
-  virtual void ShowContextMenu(const ContextMenuParams& params) = 0;
-
-  virtual void OrientationLock(device::mojom::ScreenOrientationLockType) = 0;
-  virtual void OrientationUnlock() = 0;
-
-  virtual void OnOverscrolled(
-      const gfx::Vector2dF& accumulated_overscroll,
-      const gfx::Vector2dF& latest_overscroll_delta) = 0;
-};
-
-} // namespace content
-
-#endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_VIEW_EFL_DELEGATE_H_
index 7d5fdae60f30f8fa107c115599800d315d57d9db..f77440817f88eadd56d961581af5820207f10f52 100644 (file)
@@ -279,8 +279,6 @@ shared_library("chromium-ewk") {
     "web_contents_efl_delegate_ewk.h",
     "web_contents_view_delegate_ewk.cc",
     "web_contents_view_delegate_ewk.h",
-    "web_contents_view_efl_delegate_ewk.cc",
-    "web_contents_view_efl_delegate_ewk.h",
 
     # Make use of Android webview"s simplified pref class.
     "browser/autofill/autofill_client_efl.cc",
index fbe84063a61c34ed27a905492fd8109fdca07fe7..14e288003499ff59666e8e631486312b17d9b2ca 100644 (file)
@@ -62,7 +62,6 @@
 #include "ui/platform_window/platform_window_init_properties.h"
 #include "web_contents_delegate_efl.h"
 #include "web_contents_efl_delegate_ewk.h"
-#include "web_contents_view_efl_delegate_ewk.h"
 
 #include <Ecore_Evas.h>
 #include <Elementary.h>
@@ -2298,10 +2297,6 @@ void EWebView::InitializeContent() {
   }
   web_contents_delegate_.reset(new WebContentsDelegateEfl(this));
   web_contents_->SetDelegate(web_contents_delegate_.get());
-#if !defined(USE_AURA)
-  GetWebContentsViewEfl()->SetEflDelegate(
-      new WebContentsViewEflDelegateEwk(this));
-#endif
   WebContentsImplEfl* wc_efl =
       static_cast<WebContentsImplEfl*>(web_contents_.get());
   wc_efl->SetEflDelegate(new WebContentsEflDelegateEwk(this));
index d050fc8c3eca545995e94786aa04afb213d8c547..d010dc8c70736ddf84c1b18427a6dd21a6c6b2de 100644 (file)
@@ -3,6 +3,7 @@
 // found in the LICENSE file.
 
 #include "web_contents_efl_delegate_ewk.h"
+#include "ewk/efl_integration/private/webview_delegate_ewk.h"
 
 #include <tuple>
 
@@ -22,3 +23,70 @@ void WebContentsEflDelegateEwk::SetUpSmartObject(void* platform_data, void* nati
   Evas_Object* _native_view = static_cast<Evas_Object*>(native_view);
   evas_object_smart_member_add(_native_view, new_web_view->evas_object());
 }
+
+void WebContentsEflDelegateEwk::ShowPopupMenu(
+    content::RenderFrameHost* render_frame_host,
+    const gfx::Rect& bounds,
+    int item_height,
+    double item_font_size,
+    int selected_item,
+    const std::vector<blink::MenuItemInfo>& items,
+    bool right_aligned,
+    bool allow_multiple_selection) {
+  web_view_->ShowPopupMenu(items, selected_item, allow_multiple_selection);
+}
+
+void WebContentsEflDelegateEwk::HidePopupMenu() {
+  web_view_->HidePopupMenu();
+}
+
+void WebContentsEflDelegateEwk::CancelContextMenu(int request_id) {
+  web_view_->CancelContextMenu(request_id);
+}
+
+void WebContentsEflDelegateEwk::QuerySelectionStyle() {
+  web_view_->QuerySelectionStyle();
+}
+
+void WebContentsEflDelegateEwk::HandleZoomGesture(
+    blink::WebGestureEvent& event) {
+  web_view_->HandleZoomGesture(event);
+}
+
+bool WebContentsEflDelegateEwk::UseKeyPadWithoutUserAction() {
+  return web_view_->GetSettings()->useKeyPadWithoutUserAction();
+}
+
+void WebContentsEflDelegateEwk::ShowContextMenu(
+    const content::ContextMenuParams& params) {
+  web_view_->ShowContextMenu(params);
+}
+
+void WebContentsEflDelegateEwk::OrientationLock(
+    device::mojom::ScreenOrientationLockType orientation) {
+  // Conversion of WebScreenOrientationLockType to
+  // list of orientations.
+  // This is related to the commentary to the M42 version
+  // (currently non-existent) of prototype
+  // Eina_Bool (*orientation_lock)(Ewk_View_Smart_Data* sd, int orientations)
+  //   InvalidOrientation = 0,
+  //   OrientationPortraitPrimary = 1,
+  //   OrientationLandscapePrimary = 1 << 1,
+  //   OrientationPortraitSecondary = 1 << 2,
+  //   OrientationLandscapeSecondary = 1 << 3,
+  //   OrientationPortrait =
+  //       OrientationPortraitPrimary | OrientationPortraitSecondary,
+  //   OrientationLandscape =
+  //       OrientationLandscapePrimary | OrientationLandscapeSecondary,
+  //   OrientationNatural =
+  //       OrientationPortraitPrimary | OrientationLandscapePrimary,
+  //   OrientationAny = OrientationPortrait | OrientationLandscape
+  int orientation_convert[9] = {0, 1, 4, 2, 8, 15, 10, 5, 3};
+
+  WebViewDelegateEwk::GetInstance().RequestHandleOrientationLock(
+      web_view_, orientation_convert[static_cast<int>(orientation)]);
+}
+
+void WebContentsEflDelegateEwk::OrientationUnlock() {
+  WebViewDelegateEwk::GetInstance().RequestHandleOrientationUnlock(web_view_);
+}
\ No newline at end of file
index a7d6905e11c39ddab4f126b0116ddf1e19914528..0377cff640772f4cc3c26bede17a19732ca31a44 100644 (file)
@@ -17,6 +17,30 @@ class WebContentsEflDelegateEwk : public content::WebContentsEflDelegate {
 
   void SetUpSmartObject(void*platform_data, void* native_view) override;
 
+  void ShowPopupMenu(content::RenderFrameHost* render_frame_host,
+                     const gfx::Rect& bounds,
+                     int item_height,
+                     double item_font_size,
+                     int selected_item,
+                     const std::vector<blink::MenuItemInfo>& items,
+                     bool right_aligned,
+                     bool allow_multiple_selection) override;
+  void HidePopupMenu() override;
+
+  void CancelContextMenu(int request_id) override;
+
+  void QuerySelectionStyle() override;
+
+  void HandleZoomGesture(blink::WebGestureEvent& event) override;
+
+  bool UseKeyPadWithoutUserAction() override;
+
+  void ShowContextMenu(const content::ContextMenuParams& params) override;
+
+  virtual void OrientationLock(
+      device::mojom::ScreenOrientationLockType) override;
+  virtual void OrientationUnlock() override;
+
  private:
   EWebView* web_view_;
 
diff --git a/tizen_src/ewk/efl_integration/web_contents_view_efl_delegate_ewk.cc b/tizen_src/ewk/efl_integration/web_contents_view_efl_delegate_ewk.cc
deleted file mode 100644 (file)
index 1838af0..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-// Copyright 2015 Samsung Electronics. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "web_contents_view_efl_delegate_ewk.h"
-
-#include "eweb_view.h"
-#include "ewk/efl_integration/private/webview_delegate_ewk.h"
-
-WebContentsViewEflDelegateEwk::WebContentsViewEflDelegateEwk(EWebView* wv)
-    : web_view_(wv) {
-}
-
-void WebContentsViewEflDelegateEwk::ShowPopupMenu(
-    content::RenderFrameHost* render_frame_host,
-    const gfx::Rect& bounds,
-    int item_height,
-    double item_font_size,
-    int selected_item,
-    const std::vector<blink::MenuItemInfo>& items,
-    bool right_aligned,
-    bool allow_multiple_selection) {
-  web_view_->ShowPopupMenu(items, selected_item, allow_multiple_selection);
-}
-
-void WebContentsViewEflDelegateEwk::HidePopupMenu() {
-  web_view_->HidePopupMenu();
-}
-
-void WebContentsViewEflDelegateEwk::SetPageTitle(const std::u16string& title) {
-  web_view_->SmartCallback<EWebViewCallbacks::TitleChange>().
-      call(base::UTF16ToUTF8(title).c_str());
-}
-
-void WebContentsViewEflDelegateEwk::CancelContextMenu(int request_id) {
-  web_view_->CancelContextMenu(request_id);
-}
-
-void WebContentsViewEflDelegateEwk::QuerySelectionStyle() {
-  web_view_->QuerySelectionStyle();
-}
-
-void WebContentsViewEflDelegateEwk::HandleZoomGesture(blink::WebGestureEvent& event) {
-  web_view_->HandleZoomGesture(event);
-}
-
-bool WebContentsViewEflDelegateEwk::UseKeyPadWithoutUserAction() {
-  return web_view_->GetSettings()->useKeyPadWithoutUserAction();
-}
-
-void WebContentsViewEflDelegateEwk::ShowContextMenu(
-    const content::ContextMenuParams& params) {
-  web_view_->ShowContextMenu(params);
-}
-
-void WebContentsViewEflDelegateEwk::OrientationLock(
-    device::mojom::ScreenOrientationLockType orientation) {
-  // Conversion of WebScreenOrientationLockType to
-  // list of orientations.
-  // This is related to the commentary to the M42 version
-  // (currently non-existent) of prototype
-  // Eina_Bool (*orientation_lock)(Ewk_View_Smart_Data* sd, int orientations)
-  //   InvalidOrientation = 0,
-  //   OrientationPortraitPrimary = 1,
-  //   OrientationLandscapePrimary = 1 << 1,
-  //   OrientationPortraitSecondary = 1 << 2,
-  //   OrientationLandscapeSecondary = 1 << 3,
-  //   OrientationPortrait =
-  //       OrientationPortraitPrimary | OrientationPortraitSecondary,
-  //   OrientationLandscape =
-  //       OrientationLandscapePrimary | OrientationLandscapeSecondary,
-  //   OrientationNatural =
-  //       OrientationPortraitPrimary | OrientationLandscapePrimary,
-  //   OrientationAny = OrientationPortrait | OrientationLandscape
-  int orientation_convert[9] = { 0, 1, 4, 2, 8, 15, 10, 5, 3 };
-
-  WebViewDelegateEwk::GetInstance().RequestHandleOrientationLock(
-      web_view_,
-      orientation_convert[static_cast<int>(orientation)]);
-}
-
-void WebContentsViewEflDelegateEwk::OrientationUnlock() {
-  WebViewDelegateEwk::GetInstance().RequestHandleOrientationUnlock(web_view_);
-}
-
-void WebContentsViewEflDelegateEwk::OnOverscrolled(
-    const gfx::Vector2dF& accumulated_overscroll,
-    const gfx::Vector2dF& latest_overscroll_delta) {
-  web_view_->OnOverscrolled(accumulated_overscroll, latest_overscroll_delta);
-}
diff --git a/tizen_src/ewk/efl_integration/web_contents_view_efl_delegate_ewk.h b/tizen_src/ewk/efl_integration/web_contents_view_efl_delegate_ewk.h
deleted file mode 100644 (file)
index 6330b27..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright 2015 Samsung Electronics. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef WEB_CONTENTS_VIEW_EFL_DELEGATE_EWK
-#define WEB_CONTENTS_VIEW_EFL_DELEGATE_EWK
-
-#include "content/public/browser/web_contents_view_efl_delegate.h"
-#include "third_party/blink/public/common/context_menu_data/menu_item_info.h"
-
-class EWebView;
-
-namespace content {
-class RenderFrameHost;
-}
-
-class WebContentsViewEflDelegateEwk
-    : public content::WebContentsViewEflDelegate {
- public:
-  WebContentsViewEflDelegateEwk(EWebView*);
-
-  void ShowPopupMenu(content::RenderFrameHost* render_frame_host,
-                     const gfx::Rect& bounds,
-                     int item_height,
-                     double item_font_size,
-                     int selected_item,
-                     const std::vector<blink::MenuItemInfo>& items,
-                     bool right_aligned,
-                     bool allow_multiple_selection) override;
-  void HidePopupMenu() override;
-
-  void SetPageTitle(const std::u16string& title) override;
-
-  void CancelContextMenu(int request_id) override;
-
-  void QuerySelectionStyle() override;
-
-  void HandleZoomGesture(blink::WebGestureEvent& event) override;
-
-  bool UseKeyPadWithoutUserAction() override;
-
-  void ShowContextMenu(const content::ContextMenuParams& params) override;
-
-  virtual void OrientationLock(
-      device::mojom::ScreenOrientationLockType) override;
-  virtual void OrientationUnlock() override;
-
- private:
-  void OnOverscrolled(const gfx::Vector2dF& accumulated_overscroll,
-                      const gfx::Vector2dF& latest_overscroll_delta) override;
-
-  EWebView* web_view_;
-};
-
-#endif // WEB_CONTENTS_VIEW_EFL_DELEGATE_EWK
-