[EWK_REFACTOR] bringup EWebViewCallbacks::ZoomStarted/ZoomFinished SmartCallback
authorhh4813.kim <hh4813.kim@samsung.com>
Wed, 10 Jun 2015 11:08:00 +0000 (20:08 +0900)
committerYoungsoo Choi <kenshin.choi@samsung.com>
Tue, 10 Jul 2018 06:57:09 +0000 (06:57 +0000)
EWK_REFACTOR guards are removed for bringup ZoomStarted/ZoomFinished SmartCallback.
WebContentsViewEflDelegate::HandleZoomGesture is newly introduced to deliver zoom
gesture events to EWebView, so it can trigger ZoomStarted/ZoomFinished SmartCallback.

Bug: http://web.sec.samsung.net/bugzilla/show_bug.cgi?id=12028
Reviewed by: Antonio Gomes, DONGJUN KiM

Change-Id: I56fb07992f4e7b543cfe45b50f440c732a808a72
Signed-off-by: hh4813.kim <hh4813.kim@samsung.com>
tizen_src/chromium_impl/content/browser/renderer_host/render_widget_host_view_efl.cc
tizen_src/chromium_impl/content/browser/web_contents/web_contents_view_efl.cc
tizen_src/chromium_impl/content/browser/web_contents/web_contents_view_efl.h
tizen_src/chromium_impl/content/public/browser/web_contents_view_efl_delegate.h
tizen_src/ewk/efl_integration/eweb_view.cc
tizen_src/ewk/efl_integration/eweb_view.h
tizen_src/ewk/efl_integration/web_contents_view_efl_delegate_ewk.cc
tizen_src/ewk/efl_integration/web_contents_view_efl_delegate_ewk.h

index a97c05d..8b95b57 100755 (executable)
@@ -48,6 +48,7 @@
 #include "content/common/cursors/webcursor_efl.h"
 #include "content/public/browser/render_widget_host_view_frame_subscriber.h"
 #include "content/public/browser/screen_orientation_dispatcher_host.h"
+#include "content/public/browser/web_contents_delegate.h"
 #include "content/public/browser/browser_thread.h"
 #include "content/public/browser/context_factory.h"
 #include "content/public/browser/render_process_host.h"
@@ -1638,23 +1639,21 @@ void RenderWidgetHostViewEfl::HandleGesture(
         restore_showing_large_handle_on_gesture_end_,
         should_restore_selection_menu_);
 
-#if defined(EWK_REFACTOR)
   if ((event.type == blink::WebInputEvent::GesturePinchBegin ||
       event.type == blink::WebInputEvent::GesturePinchUpdate ||
       event.type == blink::WebInputEvent::GesturePinchEnd) &&
-      (!pinch_zoom_enabled_ || eweb_view()->IsFullscreen())) {
+      (!pinch_zoom_enabled_ || (web_contents_.GetDelegate() &&
+      web_contents_.GetDelegate()->IsFullscreenForTabOrPending(&web_contents_)))) {
     return;
   }
 
   if (event.type == blink::WebInputEvent::GestureDoubleTap ||
-      event.type == blink::WebInputEvent::GesturePinchBegin) {
-    eweb_view()->SmartCallback<EWebViewCallbacks::ZoomStarted>().call();
-  }
-  if (event.type == blink::WebInputEvent::GestureDoubleTap ||
+      event.type == blink::WebInputEvent::GesturePinchBegin ||
       event.type == blink::WebInputEvent::GesturePinchEnd) {
-    eweb_view()->SmartCallback<EWebViewCallbacks::ZoomFinished>().call();
+    WebContentsImpl* wci = static_cast<WebContentsImpl*>(&web_contents_);
+    WebContentsViewEfl* wcve = static_cast<WebContentsViewEfl*>(wci->GetView());
+    wcve->HandleZoomGesture(event);
   }
-#endif
 
   if (event.type == blink::WebInputEvent::GestureTap ||
       event.type == blink::WebInputEvent::GestureTapCancel) {
index e07c3c6..94b4042 100644 (file)
@@ -323,4 +323,9 @@ void WebContentsViewEfl::SetPageScaleFactor(float scale) {
     drag_dest_->SetPageScaleFactor(scale);
 }
 
+void WebContentsViewEfl::HandleZoomGesture(blink::WebGestureEvent& event) {
+  if (efl_delegate_)
+    efl_delegate_->HandleZoomGesture(event);
+}
+
 } // namespace content
index 4f81aa1..bbc6f2d 100644 (file)
@@ -83,6 +83,8 @@ class CONTENT_EXPORT WebContentsViewEfl
   }
   void QuerySelectionStyle();
 
+  void HandleZoomGesture(blink::WebGestureEvent& event);
+
 private:
   // Our optional, generic views wrapper.
   scoped_ptr<WebContentsViewDelegate> delegate_;
index 111cad9..7aaa808 100644 (file)
@@ -9,6 +9,7 @@
 
 #include "content/common/content_export.h"
 #include "content/public/common/menu_item.h"
+#include "third_party/WebKit/public/web/WebInputEvent.h"
 #include "ui/gfx/geometry/rect.h"
 
 namespace content {
@@ -35,6 +36,7 @@ class WebContentsViewEflDelegate {
   virtual void CancelContextMenu(int request_id) = 0;
 
   virtual void QuerySelectionStyle() = 0;
+  virtual void HandleZoomGesture(blink::WebGestureEvent& event) = 0;
 };
 
 } // namespace content
index 5357618..c7adf2c 100644 (file)
@@ -2138,6 +2138,17 @@ bool EWebView::HandleTextSelectionUp(int x, int y) {
   return GetSelectionController()->TextSelectionUp(x, y);
 }
 
+void EWebView::HandleZoomGesture(blink::WebGestureEvent& event) {
+  if (event.type == blink::WebInputEvent::GestureDoubleTap ||
+      event.type == blink::WebInputEvent::GesturePinchBegin) {
+    SmartCallback<EWebViewCallbacks::ZoomStarted>().call();
+  }
+  if (event.type == blink::WebInputEvent::GestureDoubleTap ||
+      event.type == blink::WebInputEvent::GesturePinchEnd) {
+    SmartCallback<EWebViewCallbacks::ZoomFinished>().call();
+  }
+}
+
 void EWebView::SendDelayedMessages(RenderViewHost* render_view_host) {
   DCHECK(render_view_host);
 
index 09450f5..0bd507b 100644 (file)
@@ -449,6 +449,8 @@ class EWebView {
   void HandleRendererProcessCrash();
   void InvokeWebProcessCrashedCallback();
 
+  void HandleZoomGesture(blink::WebGestureEvent& event);
+
  private:
   void InitializeContent();
   void SendDelayedMessages(content::RenderViewHost* render_view_host);
index 4ea9a2a..bed4da9 100644 (file)
@@ -38,3 +38,7 @@ void WebContentsViewEflDelegateEwk::CancelContextMenu(int request_id) {
 void WebContentsViewEflDelegateEwk::QuerySelectionStyle() {
   web_view_->QuerySelectionStyle();
 }
+
+void WebContentsViewEflDelegateEwk::HandleZoomGesture(blink::WebGestureEvent& event) {
+  web_view_->HandleZoomGesture(event);
+}
index 1576762..17df97b 100644 (file)
@@ -37,6 +37,8 @@ class WebContentsViewEflDelegateEwk
 
   void QuerySelectionStyle() override;
 
+  void HandleZoomGesture(blink::WebGestureEvent& event) override;
+
  private:
   EWebView* web_view_;
 };