Forward events to ewk
authorArnaud Renevier <a.renevier@samsung.com>
Thu, 23 Apr 2015 17:30:28 +0000 (10:30 -0700)
committerYoungsoo Choi <kenshin.choi@samsung.com>
Tue, 10 Jul 2018 06:57:09 +0000 (06:57 +0000)
To match previous behaviour, events (focus, key and mouse) are forwarded
to ewk. If they are handled by the application, they are not forwarded
to chromium anymore.

motion events will be handled in a later patch

Bug: http://107.108.218.239/bugzilla/show_bug.cgi?id=12031

Change-Id: I67d0bf3599e918353b04d8f753dc29b3fad13583
Signed-off-by: Arnaud Renevier <a.renevier@samsung.com>
12 files changed:
tizen_src/chromium_impl/content/browser/renderer_host/evas_event_handler.h [new file with mode: 0644]
tizen_src/chromium_impl/content/browser/renderer_host/render_widget_host_view_efl.cc
tizen_src/chromium_impl/content/browser/renderer_host/render_widget_host_view_efl.h
tizen_src/ewk/efl_integration/efl_integration.gypi
tizen_src/ewk/efl_integration/eweb_view.cc
tizen_src/ewk/efl_integration/eweb_view.h
tizen_src/ewk/efl_integration/private/webview_delegate_ewk.cc
tizen_src/ewk/efl_integration/private/webview_delegate_ewk.h
tizen_src/ewk/efl_integration/tizen_webview/public/tw_webview_delegate.h
tizen_src/ewk/efl_integration/tizen_webview/public/tw_webview_evas_event_handler.cc
tizen_src/ewk/efl_integration/tizen_webview/public/tw_webview_evas_event_handler.h
tizen_src/ewk/efl_integration/web_contents_delegate_efl.cc

diff --git a/tizen_src/chromium_impl/content/browser/renderer_host/evas_event_handler.h b/tizen_src/chromium_impl/content/browser/renderer_host/evas_event_handler.h
new file mode 100644 (file)
index 0000000..c4bba80
--- /dev/null
@@ -0,0 +1,31 @@
+// 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 EVAS_EVENT_HANDLER_H
+#define EVAS_EVENT_HANDLER_H
+
+#include "base/memory/ref_counted.h"
+
+#include <Evas.h>
+
+namespace content {
+
+class EvasEventHandler: public base::RefCountedThreadSafe<EvasEventHandler> {
+ public:
+  virtual ~EvasEventHandler() {}
+
+  virtual bool HandleEvent_FocusIn() { return false; }
+  virtual bool HandleEvent_FocusOut() { return false; }
+  virtual bool HandleEvent_KeyUp (const Evas_Event_Key_Up*) { return false; }
+  virtual bool HandleEvent_KeyDown (const Evas_Event_Key_Down*) { return false; }
+  virtual bool HandleEvent_MouseDown (const Evas_Event_Mouse_Down*) { return false; }
+  virtual bool HandleEvent_MouseUp  (const Evas_Event_Mouse_Up*) { return false; }
+  virtual bool HandleEvent_MouseMove (const Evas_Event_Mouse_Move*) { return false; }
+  virtual bool HandleEvent_MouseWheel (const Evas_Event_Mouse_Wheel*) { return false; }
+
+};
+
+} // namespace content
+
+#endif  // EVAS_EVENT_HANDLER_H
index 0a8ff62..75fdb74 100644 (file)
 #define MAX_SURFACE_WIDTH_EGL 4096 //max supported Framebuffer width
 #define MAX_SURFACE_HEIGHT_EGL 4096 //max supported Framebuffer height
 
+namespace {
+const char kSmartCallbackName_MotionEnable[] = "motion,enable";
+const char kSmartCallbackName_MotionMove[] = "motion,move";
+const char kSmartCallbackName_MotionZoom[] = "motion,zoom";
+}
+
 namespace content {
 
 void RenderWidgetHostViewBase::GetDefaultScreenInfo(
@@ -173,6 +179,15 @@ void RenderWidgetHostViewEfl::InitAsChild(gfx::NativeView parent_view) {
   evas_object_smart_callback_add(content_image_elm_host_,
       "unfocused", OnHostFocusOut, this);
 
+  if (smart_parent_) {
+    evas_object_smart_callback_add(smart_parent_,
+        kSmartCallbackName_MotionEnable, OnMotionEnable, this);
+    evas_object_smart_callback_add(smart_parent_,
+        kSmartCallbackName_MotionMove, OnMotionMove, this);
+    evas_object_smart_callback_add(smart_parent_,
+        kSmartCallbackName_MotionZoom, OnMotionZoom, this);
+  }
+
   evas_object_event_callback_add(content_image_, EVAS_CALLBACK_MOUSE_DOWN,
       OnPointerDown, this);
   evas_object_event_callback_add(content_image_, EVAS_CALLBACK_MOUSE_UP,
@@ -215,6 +230,15 @@ RenderWidgetHostViewEfl::~RenderWidgetHostViewEfl() {
   evas_object_smart_callback_del(content_image_elm_host_,
       "unfocused", OnHostFocusOut);
 
+  if (smart_parent_) {
+    evas_object_smart_callback_del(smart_parent_,
+        kSmartCallbackName_MotionEnable, OnMotionEnable);
+    evas_object_smart_callback_del(smart_parent_,
+        kSmartCallbackName_MotionMove, OnMotionMove);
+    evas_object_smart_callback_del(smart_parent_,
+        kSmartCallbackName_MotionZoom, OnMotionZoom);
+  }
+
   evas_object_event_callback_del(content_image_, EVAS_CALLBACK_MOUSE_DOWN,
       OnPointerDown);
   evas_object_event_callback_del(content_image_, EVAS_CALLBACK_MOUSE_UP,
@@ -462,6 +486,10 @@ void RenderWidgetHostViewEfl::CreateNativeSurface(int width, int height) {
   }
 }
 
+void RenderWidgetHostViewEfl::SetEvasHandler(scoped_refptr<EvasEventHandler> evas_event_handler) {
+  evas_event_handler_ = evas_event_handler;
+}
+
 bool RenderWidgetHostViewEfl::OnMessageReceived(const IPC::Message& message) {
   bool handled = true;
   IPC_BEGIN_MESSAGE_MAP(RenderWidgetHostViewEfl, message)
@@ -1058,6 +1086,10 @@ void RenderWidgetHostViewEfl::OnParentViewResize(
 void RenderWidgetHostViewEfl::OnFocusIn(
     void* data, Evas*, Evas_Object*, void*) {
   RenderWidgetHostViewEfl* thiz = static_cast<RenderWidgetHostViewEfl*>(data);
+  if (thiz->evas_event_handler_.get())
+    if (thiz->evas_event_handler_->HandleEvent_FocusIn())
+      return;
+
   thiz->host_->SetActive(true);
   thiz->host_->GotFocus();
 
@@ -1072,6 +1104,10 @@ void RenderWidgetHostViewEfl::OnFocusIn(
 void RenderWidgetHostViewEfl::OnFocusOut(
     void* data, Evas*, Evas_Object*, void*) {
   RenderWidgetHostViewEfl* thiz = static_cast<RenderWidgetHostViewEfl*>(data);
+  if (thiz->evas_event_handler_.get())
+    if (thiz->evas_event_handler_->HandleEvent_FocusOut())
+      return;
+
   thiz->host_->SetActive(false);
   thiz->host_->LostCapture();
 
@@ -1093,9 +1129,27 @@ void RenderWidgetHostViewEfl::OnHostFocusOut(
   thiz->Blur();
 }
 
+void RenderWidgetHostViewEfl::OnMotionEnable(
+    void* data, Evas_Object*, void*) {
+  NOTIMPLEMENTED();
+}
+
+void RenderWidgetHostViewEfl::OnMotionMove(
+    void* data, Evas_Object*, void*) {
+  NOTIMPLEMENTED();
+}
+
+void RenderWidgetHostViewEfl::OnMotionZoom(
+    void* data, Evas_Object* eo, void* event_info) {
+  NOTIMPLEMENTED();
+}
+
 void RenderWidgetHostViewEfl::OnPointerDown(
     void* data, Evas* evas, Evas_Object* obj, void* event_info) {
   RenderWidgetHostViewEfl* rwhv = static_cast<RenderWidgetHostViewEfl*>(data);
+  if (rwhv->evas_event_handler_.get())
+    if (rwhv->evas_event_handler_->HandleEvent_MouseDown(static_cast<Evas_Event_Mouse_Down*>(event_info)))
+      return;
 
   rwhv->Focus();
 
@@ -1112,6 +1166,9 @@ void RenderWidgetHostViewEfl::OnPointerDown(
 void RenderWidgetHostViewEfl::OnPointerUp(
     void* data, Evas* evas, Evas_Object* obj, void* event_info) {
   RenderWidgetHostViewEfl* rwhv = static_cast<RenderWidgetHostViewEfl*>(data);
+  if (rwhv->evas_event_handler_.get())
+    if (rwhv->evas_event_handler_->HandleEvent_MouseUp(static_cast<Evas_Event_Mouse_Up*>(event_info)))
+      return;
 
   if (!rwhv->touch_events_enabled_) {
     blink::WebMouseEvent event = MakeWebMouseEvent(
@@ -1126,6 +1183,9 @@ void RenderWidgetHostViewEfl::OnPointerUp(
 void RenderWidgetHostViewEfl::OnPointerMove(
     void* data, Evas* evas, Evas_Object* obj, void* event_info) {
   RenderWidgetHostViewEfl* rwhv = static_cast<RenderWidgetHostViewEfl*>(data);
+  if (rwhv->evas_event_handler_.get())
+    if (rwhv->evas_event_handler_->HandleEvent_MouseMove(static_cast<Evas_Event_Mouse_Move*>(event_info)))
+      return;
 
   if (!rwhv->touch_events_enabled_) {
     blink::WebMouseEvent event = MakeWebMouseEvent(obj,
@@ -1139,6 +1199,10 @@ void RenderWidgetHostViewEfl::OnPointerMove(
 void RenderWidgetHostViewEfl::OnKeyDown(
     void* data, Evas* evas, Evas_Object* obj, void* event_info) {
   RenderWidgetHostViewEfl* rwhv = static_cast<RenderWidgetHostViewEfl*>(data);
+  if (rwhv->evas_event_handler_.get())
+    if (rwhv->evas_event_handler_->HandleEvent_KeyDown(static_cast<Evas_Event_Key_Down*>(event_info)))
+      return;
+
   rwhv->host_->ForwardKeyboardEvent(MakeWebKeyboardEvent(
       true, static_cast<Evas_Event_Key_Down*>(event_info)));
 }
@@ -1146,6 +1210,10 @@ void RenderWidgetHostViewEfl::OnKeyDown(
 void RenderWidgetHostViewEfl::OnKeyUp(
     void* data, Evas* evas, Evas_Object* obj, void* event_info) {
   RenderWidgetHostViewEfl* rwhv = static_cast<RenderWidgetHostViewEfl*>(data);
+  if (rwhv->evas_event_handler_.get())
+    if (rwhv->evas_event_handler_->HandleEvent_KeyUp(static_cast<Evas_Event_Key_Up*>(event_info)))
+      return;
+
   rwhv->host_->ForwardKeyboardEvent(MakeWebKeyboardEvent(
       false, static_cast<Evas_Event_Key_Up*>(event_info)));
 }
@@ -1153,6 +1221,9 @@ void RenderWidgetHostViewEfl::OnKeyUp(
 void RenderWidgetHostViewEfl::OnMouseWheel(
     void* data, Evas* evas, Evas_Object* obj, void* event_info) {
   RenderWidgetHostViewEfl* rwhv = static_cast<RenderWidgetHostViewEfl*>(data);
+  if (rwhv->evas_event_handler_.get())
+    if (rwhv->evas_event_handler_->HandleEvent_MouseWheel(static_cast<Evas_Event_Mouse_Wheel*>(event_info)))
+      return;
 
   if (!rwhv->touch_events_enabled_) {
       blink::WebMouseWheelEvent event = MakeWebMouseEvent(
index 045fbca..eb28934 100644 (file)
@@ -14,6 +14,7 @@
 #include "base/basictypes.h"
 #include "base/format_macros.h"
 #include "content/browser/renderer_host/render_widget_host_view_base.h"
+#include "content/browser/renderer_host/evas_event_handler.h"
 #include "content/common/content_export.h"
 #include "cc/layers/delegated_frame_provider.h"
 #include "cc/layers/delegated_frame_resource_collection.h"
@@ -176,6 +177,8 @@ class RenderWidgetHostViewEfl
   void Init_EvasGL(int width, int height);
   void CreateNativeSurface(int width, int height);
 
+  void SetEvasHandler(scoped_refptr<EvasEventHandler> evas_event_handler);
+
   void HandleGestureBegin();
   void HandleGestureEnd();
   void HandleGesture(ui::GestureEvent*);
@@ -212,6 +215,10 @@ class RenderWidgetHostViewEfl
   static void OnHostFocusIn(void* data, Evas_Object*, void*);
   static void OnHostFocusOut(void* data, Evas_Object*, void*);
 
+  static void OnMotionEnable(void* data, Evas_Object*, void*);
+  static void OnMotionMove(void* data, Evas_Object*, void*);
+  static void OnMotionZoom(void* data, Evas_Object*, void*);
+
   static void OnPointerDown(void* data, Evas*, Evas_Object*, void*);
   static void OnPointerUp(void* data, Evas*, Evas_Object*, void*);
   static void OnPointerMove(void* data, Evas*, Evas_Object*, void*);
@@ -268,6 +275,8 @@ class RenderWidgetHostViewEfl
   // Whether we are currently loading.
   bool is_loading_;
 
+  scoped_refptr<EvasEventHandler> evas_event_handler_;
+
   // YUV readback pipeline.
   scoped_ptr<content::ReadbackYUVInterface>
       yuv_readback_pipeline_;
index 192124e..402d005 100644 (file)
       'tizen_webview/public/tw_webview_delegate.h',
       'tizen_webview/public/tw_hit_test.h',
       'tizen_webview/public/tw_web_context.h',
-      #'tizen_webview/public/tw_webview_evas_event_handler.h',
-      #'tizen_webview/public/tw_webview_evas_event_handler.cc',
+      'tizen_webview/public/tw_webview_evas_event_handler.h',
+      'tizen_webview/public/tw_webview_evas_event_handler.cc',
       'tizen_webview/public/tw_webview.h',
       'tizen_webview/public/tw_webview.cc',
       'tizen_webview/public/tw_web_context.cc',
index 51c3466..3723387 100644 (file)
@@ -321,6 +321,7 @@ void EWebView::Initialize() {
   InitializeContent();
 
   selection_controller_.reset(new content::SelectionControllerEfl(this, *web_contents_.get()));
+  evas_event_handler_ = new tizen_webview::WebViewEvasEventHandler(public_webview_);
 
   scroll_detector_.reset(new ScrollDetector(this));
 
@@ -1553,6 +1554,13 @@ void EWebView::UpdateHitTestData(const Hit_Test_Params& params) {
 void EWebView::OnCopyFromBackingStore(bool success, const SkBitmap& bitmap) {
 }
 
+void EWebView::RenderViewCreated(RenderViewHost* render_view_host) {
+  SendDelayedMessages(render_view_host);
+  RenderWidgetHostViewEfl* view = static_cast<RenderWidgetHostViewEfl*>(render_view_host->GetView());
+  if (view)
+    view->SetEvasHandler(evas_event_handler_);
+}
+
 void EWebView::SetOverrideEncoding(const std::string& encoding) {
   web_contents_->SetOverrideEncoding(encoding);
 }
index 5bebc2d..5f04a2b 100644 (file)
@@ -321,6 +321,8 @@ class EWebView {
   // Callback OnCopyFromBackingStore will be called once we get the snapshot from render
   void OnCopyFromBackingStore(bool success, const SkBitmap& bitmap);
 
+  void RenderViewCreated(content::RenderViewHost* render_view_host);
+
   /**
    * Creates a snapshot of given rectangle from EWebView
    *
@@ -427,8 +429,6 @@ class EWebView {
 
   gfx::Point GetContextMenuPosition() const;
 
-  void SendDelayedMessages(content::RenderViewHost* render_view_host);
-
   /// ---- Event handling
   bool HandleShow();
   bool HandleHide();
@@ -441,6 +441,8 @@ class EWebView {
   void HandlePostponedGesture(int x, int y, ui::EventType type);
  private:
   void InitializeContent();
+  void SendDelayedMessages(content::RenderViewHost* render_view_host);
+
   void EvasToBlinkCords(int x, int y, int* view_x, int* view_y);
   Eina_Bool AsyncRequestHitTestDataAtBlinkCords(int x, int y,
       Ewk_Hit_Test_Mode mode,
@@ -465,6 +467,7 @@ class EWebView {
   void ReleasePopupMenuList();
 
   tizen_webview::WebView* public_webview_;
+  scoped_refptr<tizen_webview::WebViewEvasEventHandler> evas_event_handler_;
   scoped_refptr<tizen_webview::WebContext> context_;
   scoped_refptr<tizen_webview::WebContext> old_context_;
   scoped_ptr<content::WebContents> web_contents_;
index 0c491b0..e86ac78 100644 (file)
@@ -47,6 +47,8 @@ Eina_Rectangle WebViewDelegateEwk::GetLastUsedViewPortArea(
 bool WebViewDelegateEwk::RequestHandleEvent_FocusIn(WebView* wv) {
   Ewk_View_Smart_Data* sd = GetEwkViewSmartDataFromWebView(wv);
   if (sd && sd->api && sd->api->focus_in) {
+    // XXX: is it what we want, or do we want to return false if api->focus_in
+    // returns false?
     sd->api->focus_in(sd);
     return true;
   }
@@ -56,6 +58,8 @@ bool WebViewDelegateEwk::RequestHandleEvent_FocusIn(WebView* wv) {
 bool WebViewDelegateEwk::RequestHandleEvent_FocusOut(WebView* wv) {
   Ewk_View_Smart_Data* sd = GetEwkViewSmartDataFromWebView(wv);
   if (sd && sd->api && sd->api->focus_out) {
+    // XXX: is it what we want, or do we want to return false if api->focus_out
+    // returns false?
     sd->api->focus_out(sd);
     return true;
   }
@@ -63,9 +67,11 @@ bool WebViewDelegateEwk::RequestHandleEvent_FocusOut(WebView* wv) {
 }
 
 bool WebViewDelegateEwk::RequestHandleEvent_MouseUp(WebView* wv,
-    Evas_Event_Mouse_Up* event_info) {
+    const Evas_Event_Mouse_Up* event_info) {
   Ewk_View_Smart_Data* sd = GetEwkViewSmartDataFromWebView(wv);
   if (sd && sd->api && sd->api->mouse_up) {
+    // XXX: is it what we want, or do we want to return false if api->mouse_up
+    // returns false?
     sd->api->mouse_up(sd, event_info);
     return true;
   }
@@ -73,9 +79,11 @@ bool WebViewDelegateEwk::RequestHandleEvent_MouseUp(WebView* wv,
 }
 
 bool WebViewDelegateEwk::RequestHandleEvent_MouseDown(WebView* wv,
-    Evas_Event_Mouse_Down* event_info) {
+    const Evas_Event_Mouse_Down* event_info) {
   Ewk_View_Smart_Data* sd = GetEwkViewSmartDataFromWebView(wv);
   if (sd && sd->api && sd->api->mouse_down) {
+    // XXX: is it what we want, or do we want to return false if api->mouse_down
+    // returns false?
     sd->api->mouse_down(sd, event_info);
     return true;
   }
@@ -83,9 +91,11 @@ bool WebViewDelegateEwk::RequestHandleEvent_MouseDown(WebView* wv,
 }
 
 bool WebViewDelegateEwk::RequestHandleEvent_MouseMove(WebView* wv,
-    Evas_Event_Mouse_Move* event_info) {
+    const Evas_Event_Mouse_Move* event_info) {
   Ewk_View_Smart_Data* sd = GetEwkViewSmartDataFromWebView(wv);
   if (sd && sd->api && sd->api->mouse_move) {
+    // XXX: is it what we want, or do we want to return false if api->mouse_move
+    // returns false?
     sd->api->mouse_move(sd, event_info);
     return true;
   }
@@ -93,9 +103,11 @@ bool WebViewDelegateEwk::RequestHandleEvent_MouseMove(WebView* wv,
 }
 
 bool WebViewDelegateEwk::RequestHandleEvent_MouseWheel(WebView* wv,
-    Evas_Event_Mouse_Wheel* event_info) {
+    const Evas_Event_Mouse_Wheel* event_info) {
   Ewk_View_Smart_Data* sd = GetEwkViewSmartDataFromWebView(wv);
   if (sd && sd->api && sd->api->mouse_wheel) {
+    // XXX: is it what we want, or do we want to return false if api->mouse_wheel
+    // returns false?
     sd->api->mouse_wheel(sd, event_info);
     return true;
   }
@@ -103,9 +115,11 @@ bool WebViewDelegateEwk::RequestHandleEvent_MouseWheel(WebView* wv,
 }
 
 bool WebViewDelegateEwk::RequestHandleEvent_KeyUp(WebView* wv,
-    Evas_Event_Key_Up* event_info) {
+    const Evas_Event_Key_Up* event_info) {
   Ewk_View_Smart_Data* sd = GetEwkViewSmartDataFromWebView(wv);
   if (sd && sd->api && sd->api->key_up) {
+    // XXX: is it what we want, or do we want to return false if api->key_up
+    // returns false?
     sd->api->key_up(sd, event_info);
     return true;
   }
@@ -113,9 +127,11 @@ bool WebViewDelegateEwk::RequestHandleEvent_KeyUp(WebView* wv,
 }
 
 bool WebViewDelegateEwk::RequestHandleEvent_KeyDown(WebView* wv,
-    Evas_Event_Key_Down* event_info) {
+    const Evas_Event_Key_Down* event_info) {
   Ewk_View_Smart_Data* sd = GetEwkViewSmartDataFromWebView(wv);
   if (sd && sd->api && sd->api->key_down) {
+    // XXX: is it what we want, or do we want to return false if api->key_down
+    // returns false?
     sd->api->key_down(sd, event_info);
     return true;
   }
index 0e337c9..5609bab 100644 (file)
@@ -24,12 +24,12 @@ struct WebViewDelegateEwk : public WebViewDelegate {
   // Event handlers
   bool RequestHandleEvent_FocusIn(WebView* wv);
   bool RequestHandleEvent_FocusOut(WebView* wv);
-  bool RequestHandleEvent_MouseUp(WebView* wv, Evas_Event_Mouse_Up* event_info);
-  bool RequestHandleEvent_MouseDown(WebView* wv, Evas_Event_Mouse_Down* event_info);
-  bool RequestHandleEvent_MouseMove(WebView* wv, Evas_Event_Mouse_Move* event_info);
-  bool RequestHandleEvent_MouseWheel(WebView* wv, Evas_Event_Mouse_Wheel* event_info);
-  bool RequestHandleEvent_KeyUp(WebView* wv, Evas_Event_Key_Up* event_info);
-  bool RequestHandleEvent_KeyDown(WebView* wv, Evas_Event_Key_Down* event_info);
+  bool RequestHandleEvent_MouseUp(WebView* wv, const Evas_Event_Mouse_Up* event_info);
+  bool RequestHandleEvent_MouseDown(WebView* wv, const Evas_Event_Mouse_Down* event_info);
+  bool RequestHandleEvent_MouseMove(WebView* wv, const Evas_Event_Mouse_Move* event_info);
+  bool RequestHandleEvent_MouseWheel(WebView* wv, const Evas_Event_Mouse_Wheel* event_info);
+  bool RequestHandleEvent_KeyUp(WebView* wv, const Evas_Event_Key_Up* event_info);
+  bool RequestHandleEvent_KeyDown(WebView* wv, const Evas_Event_Key_Down* event_info);
  private:
   WebViewDelegateEwk() {}
   DISALLOW_COPY_AND_ASSIGN(WebViewDelegateEwk);
index 0f00ab1..e266277 100644 (file)
@@ -50,17 +50,17 @@ class WebViewDelegate {
   virtual bool RequestHandleEvent_FocusIn(WebView* wv) { return false; }
   virtual bool RequestHandleEvent_FocusOut(WebView* wv) { return false; }
   virtual bool RequestHandleEvent_MouseUp(
-      WebView* wv, Evas_Event_Mouse_Up* event_info) { return false; }
+      WebView* wv, const Evas_Event_Mouse_Up* event_info) { return false; }
   virtual bool RequestHandleEvent_MouseDown(
-      WebView* wv, Evas_Event_Mouse_Down* event_info) { return false; }
+      WebView* wv, const Evas_Event_Mouse_Down* event_info) { return false; }
   virtual bool RequestHandleEvent_MouseMove(
-      WebView* wv, Evas_Event_Mouse_Move* event_info) { return false; }
+      WebView* wv, const Evas_Event_Mouse_Move* event_info) { return false; }
   virtual bool RequestHandleEvent_MouseWheel(
-      WebView* wv, Evas_Event_Mouse_Wheel* event_info) { return false; }
+      WebView* wv, const Evas_Event_Mouse_Wheel* event_info) { return false; }
   virtual bool RequestHandleEvent_KeyUp(
-      WebView* wv, Evas_Event_Key_Up* event_info) { return false; }
+      WebView* wv, const Evas_Event_Key_Up* event_info) { return false; }
   virtual bool RequestHandleEvent_KeyDown(
-      WebView* wv, Evas_Event_Key_Down* event_info) { return false; }
+      WebView* wv, const Evas_Event_Key_Down* event_info) { return false; }
 };
 
 } // namespace tizen_webview
index 16651f5..7cbc471 100644 (file)
@@ -6,63 +6,10 @@
 #include "tw_webview_evas_event_handler.h"
 
 #include "tizen_webview/public/tw_webview_delegate.h"
-#include "tizen_webview/public/tw_touch_point.h"
 
 #include "eweb_view.h"
-#if defined(OS_TIZEN_MOBILE)
-#include "browser/motion/wkext_motion.h"
-#endif
-#include "browser/renderer_host/web_event_factory_efl.h"
-#include "browser/renderer_host/render_widget_host_view_efl.h"
-
-#define RETURN_IF_TRUE(val) if((val)) return
-
-#define RETURN_IF_FALSE(val) if(!(val)) return
-
-#define EVAS_EVENT_CALLBACK_ADD(event_type, callback)        \
-     evas_object_event_callback_add(evas_object_, event_type,\
-        reinterpret_cast<Evas_Object_Event_Cb>(callback),    \
-        reinterpret_cast<void*>(webview_))
-
-#define EVAS_EVENT_CALLBACK_DEL(event_type, callback)        \
-     evas_object_event_callback_del(evas_object_, event_type,\
-        reinterpret_cast<Evas_Object_Event_Cb>(callback))
-
-#define EVAS_SMART_CALLBACK_ADD(event_type, callback)        \
-     evas_object_smart_callback_add(evas_object_, event_type,\
-        reinterpret_cast<Evas_Smart_Cb>(callback),           \
-        reinterpret_cast<void*>(webview_))
-
-#define EVAS_SMART_CALLBACK_DEL(event_type, callback)        \
-     evas_object_smart_callback_del(evas_object_, event_type,\
-        reinterpret_cast<Evas_Smart_Cb>(callback))
-
-#define EVAS_EVENT_DISPATCH_STANDARD_FLOW_1(our_name)                   \
-    WebView* wv = data;                                                 \
-    WebViewDelegate* wvd = WebViewDelegate::GetInstance();              \
-    if (!wvd) return;                                                   \
-    bool handled = wvd->RequestHandleEvent_ ## our_name (wv);           \
-    if (!handled && wv->GetEvasEventHandler()) {                        \
-      wv->GetEvasEventHandler()->HandleEventDefault_ ## our_name ();    \
-    }                                                                   \
-
-#define EVAS_EVENT_DISPATCH_STANDARD_FLOW_2(our_name, evas_event_name)  \
-    WebView* wv = data;                                                 \
-    WebViewDelegate* wvd = WebViewDelegate::GetInstance();              \
-    if (!wvd) return;                                                   \
-    evas_event_name * ei =                                              \
-        static_cast< evas_event_name *>(event_info);                    \
-    bool handled = wvd->RequestHandleEvent_ ## our_name(wv, ei);        \
-    if (!handled && wv->GetEvasEventHandler()) {                        \
-      wv->GetEvasEventHandler()->HandleEventDefault_ ## our_name (ei);  \
-    }                                                                   \
-
 
 namespace {
-const char kSmartCallbackName_MotionEnable[] = "motion,enable";
-const char kSmartCallbackName_MotionMove[] = "motion,move";
-const char kSmartCallbackName_MotionZoom[] = "motion,zoom";
-
 inline bool isHardwareBackKey(const Evas_Event_Key_Down *event) {
 #ifdef OS_TIZEN
   return (strcmp(event->key, "XF86Stop") == 0);
@@ -76,181 +23,32 @@ namespace tizen_webview {
 
 WebViewEvasEventHandler::WebViewEvasEventHandler(WebView* wv)
     : webview_ (wv) {
-  evas_object_ = webview_->AsEvasObject();
-  is_focus_handler_bound_ = false;
-  is_key_handler_bound_ = false;
-  is_mouse_handler_bound_ = false;
-  is_motion_handler_bound_ = false;
-  is_touch_handler_bound_ = false;
-}
-
-void WebViewEvasEventHandler::BindFocusEventHandlers() {
-  RETURN_IF_TRUE(is_focus_handler_bound_);
-  EVAS_EVENT_CALLBACK_ADD(EVAS_CALLBACK_FOCUS_IN,  __OnFocusIn);
-  EVAS_EVENT_CALLBACK_ADD(EVAS_CALLBACK_FOCUS_OUT, __OnFocusOut);
-  is_focus_handler_bound_ = true;
-}
-
-void WebViewEvasEventHandler::UnbindFocusEventHandlers() {
-  RETURN_IF_FALSE(is_focus_handler_bound_);
-  EVAS_EVENT_CALLBACK_DEL(EVAS_CALLBACK_FOCUS_IN,  __OnFocusIn);
-  EVAS_EVENT_CALLBACK_DEL(EVAS_CALLBACK_FOCUS_OUT, __OnFocusOut);
-  is_focus_handler_bound_ = false;
-}
-
-void WebViewEvasEventHandler::BindKeyEventHandlers() {
-  RETURN_IF_TRUE(is_key_handler_bound_);
-  EVAS_EVENT_CALLBACK_ADD(EVAS_CALLBACK_KEY_DOWN, __OnKeyDown);
-  EVAS_EVENT_CALLBACK_ADD(EVAS_CALLBACK_KEY_UP,   __OnKeyUp);
-  is_key_handler_bound_ = true;
-}
-
-void WebViewEvasEventHandler::UnbindKeyEventHandlers() {
-  RETURN_IF_FALSE(is_key_handler_bound_);
-  EVAS_EVENT_CALLBACK_DEL(EVAS_CALLBACK_KEY_DOWN, __OnKeyDown);
-  EVAS_EVENT_CALLBACK_DEL(EVAS_CALLBACK_KEY_UP,   __OnKeyUp);
-  is_key_handler_bound_ = false;
-}
-
-void WebViewEvasEventHandler::BindMouseEventHandlers() {
-  RETURN_IF_TRUE(is_mouse_handler_bound_);
-  EVAS_EVENT_CALLBACK_ADD(EVAS_CALLBACK_MOUSE_DOWN, __OnMouseDown);
-  EVAS_EVENT_CALLBACK_ADD(EVAS_CALLBACK_MOUSE_UP, __OnMouseUp);
-  EVAS_EVENT_CALLBACK_ADD(EVAS_CALLBACK_MOUSE_MOVE, __OnMouseMove);
-  EVAS_EVENT_CALLBACK_ADD(EVAS_CALLBACK_MOUSE_WHEEL, __OnMouseWheel);
-  is_mouse_handler_bound_ = true;
-}
-
-void WebViewEvasEventHandler::UnbindMouseEventHandlers() {
-  RETURN_IF_FALSE(is_mouse_handler_bound_);
-  EVAS_EVENT_CALLBACK_DEL(EVAS_CALLBACK_MOUSE_DOWN, __OnMouseDown);
-  EVAS_EVENT_CALLBACK_DEL(EVAS_CALLBACK_MOUSE_UP, __OnMouseUp);
-  EVAS_EVENT_CALLBACK_DEL(EVAS_CALLBACK_MOUSE_MOVE, __OnMouseMove);
-  EVAS_EVENT_CALLBACK_DEL(EVAS_CALLBACK_MOUSE_WHEEL, __OnMouseWheel);
-  is_mouse_handler_bound_ = false;
-}
-
-void WebViewEvasEventHandler::BindMotionEventHandlers() {
-  RETURN_IF_TRUE(is_motion_handler_bound_);
-  EVAS_SMART_CALLBACK_ADD(kSmartCallbackName_MotionEnable, __OnMotionEnable);
-  EVAS_SMART_CALLBACK_ADD(kSmartCallbackName_MotionMove, __OnMotionMove);
-  EVAS_SMART_CALLBACK_ADD(kSmartCallbackName_MotionZoom, __OnMotionZoom);
-  is_motion_handler_bound_ = true;
-}
-
-
-void WebViewEvasEventHandler::UnbindMotionEventHandlers() {
-  RETURN_IF_FALSE(is_motion_handler_bound_);
-  EVAS_SMART_CALLBACK_DEL(kSmartCallbackName_MotionEnable, __OnMotionEnable);
-  EVAS_SMART_CALLBACK_DEL(kSmartCallbackName_MotionMove, __OnMotionMove);
-  EVAS_SMART_CALLBACK_DEL(kSmartCallbackName_MotionZoom, __OnMotionZoom);
-  is_motion_handler_bound_ = false;
-}
-
-void WebViewEvasEventHandler::BindTouchEventHandlers() {
-  RETURN_IF_TRUE(is_touch_handler_bound_);
-  EVAS_EVENT_CALLBACK_ADD(EVAS_CALLBACK_MOUSE_DOWN, __OnTouchDown);
-  EVAS_EVENT_CALLBACK_ADD(EVAS_CALLBACK_MOUSE_UP, __OnTouchUp);
-  EVAS_EVENT_CALLBACK_ADD(EVAS_CALLBACK_MOUSE_MOVE, __OnTouchMove);
-  EVAS_EVENT_CALLBACK_ADD(EVAS_CALLBACK_MULTI_DOWN, __OnTouchDown);
-  EVAS_EVENT_CALLBACK_ADD(EVAS_CALLBACK_MULTI_UP, __OnTouchUp);
-  EVAS_EVENT_CALLBACK_ADD(EVAS_CALLBACK_MULTI_MOVE, __OnTouchMove);
-  is_touch_handler_bound_ = true;
-}
-
-void WebViewEvasEventHandler::UnbindTouchEventHandlers() {
-  RETURN_IF_FALSE(is_touch_handler_bound_);
-  EVAS_EVENT_CALLBACK_DEL(EVAS_CALLBACK_MOUSE_DOWN, __OnTouchDown);
-  EVAS_EVENT_CALLBACK_DEL(EVAS_CALLBACK_MOUSE_UP, __OnTouchUp);
-  EVAS_EVENT_CALLBACK_DEL(EVAS_CALLBACK_MOUSE_MOVE, __OnTouchMove);
-  EVAS_EVENT_CALLBACK_DEL(EVAS_CALLBACK_MULTI_DOWN, __OnTouchDown);
-  EVAS_EVENT_CALLBACK_DEL(EVAS_CALLBACK_MULTI_UP, __OnTouchUp);
-  EVAS_EVENT_CALLBACK_DEL(EVAS_CALLBACK_MULTI_MOVE, __OnTouchMove);
-  is_touch_handler_bound_ = false;
-}
-
-// ----- Evas Event Callbacks -------------------------------------------------
-
-void WebViewEvasEventHandler::__OnFocusIn(
-    WebView* data, Evas *e, Evas_Object *obj, void *event_info) {
-  EVAS_EVENT_DISPATCH_STANDARD_FLOW_1(FocusIn);
-}
-
-void WebViewEvasEventHandler::__OnFocusOut(WebView* data, Evas *e, Evas_Object *obj, void *event_info) {
-  EVAS_EVENT_DISPATCH_STANDARD_FLOW_1(FocusOut);
-}
-
-
-void WebViewEvasEventHandler::__OnKeyDown(WebView* data, Evas *e, Evas_Object *obj, void *event_info) {
-  EVAS_EVENT_DISPATCH_STANDARD_FLOW_2(KeyDown, Evas_Event_Key_Down);
-}
-
-void WebViewEvasEventHandler::__OnKeyUp(WebView* data, Evas *e, Evas_Object *obj, void *event_info) {
-  EVAS_EVENT_DISPATCH_STANDARD_FLOW_2(KeyUp, Evas_Event_Key_Up);
-}
-
-void WebViewEvasEventHandler::__OnMouseDown(WebView* data, Evas *e, Evas_Object *obj, void *event_info) {
-  EVAS_EVENT_DISPATCH_STANDARD_FLOW_2(MouseDown, Evas_Event_Mouse_Down);
-}
-
-void WebViewEvasEventHandler::__OnMouseUp(WebView* data, Evas *e, Evas_Object *obj, void *event_info) {
-  EVAS_EVENT_DISPATCH_STANDARD_FLOW_2(MouseUp, Evas_Event_Mouse_Up);
-}
-
-void WebViewEvasEventHandler::__OnMouseMove(WebView* data, Evas *e, Evas_Object *obj, void *event_info) {
-  EVAS_EVENT_DISPATCH_STANDARD_FLOW_2(MouseMove, Evas_Event_Mouse_Move);
-}
-
-void WebViewEvasEventHandler::__OnMouseWheel(WebView* data, Evas *e, Evas_Object *obj, void *event_info) {
-  EVAS_EVENT_DISPATCH_STANDARD_FLOW_2(MouseWheel, Evas_Event_Mouse_Wheel);
-}
-
-void WebViewEvasEventHandler::__OnMotionEnable(WebView* data, Evas_Object *eo, void *event_info) {
-#if defined(OS_TIZEN_MOBILE)
-  bool* enable = static_cast<bool*>(event_info);
-  wkext_motion_tilt_enable_set(data->AsEvasObject(), *enable, g_default_tilt_motion_sensitivity);
-#else
-  DLOG(WARNING) << "Not Supported Event called in " << __PRETTY_FUNCTION__ ;
-#endif
-}
-
-void WebViewEvasEventHandler::__OnMotionMove(WebView* data, Evas_Object *eo, void *event_info) {
-  // Not implemented yet.
-}
-
-void WebViewEvasEventHandler::__OnMotionZoom(WebView* data, Evas_Object *eo, void *event_info) {
-#if defined(OS_TIZEN_MOBILE)
-  data->GetImpl()->rwhv()->makePinchZoom(event_info);
-#else
-  DLOG(WARNING) << "Not Supported Event called in " << __PRETTY_FUNCTION__ ;
-#endif
-}
-
-void WebViewEvasEventHandler::__OnTouchDown(WebView* data, Evas *e, Evas_Object *obj, void *event_info) {
-  data->GetEvasEventHandler()->HandleEventDefault_TouchEvents(EWK_TOUCH_START);
 }
 
-void WebViewEvasEventHandler::__OnTouchUp(WebView* data, Evas *e, Evas_Object *obj, void *event_info) {
-  data->GetEvasEventHandler()->HandleEventDefault_TouchEvents(EWK_TOUCH_END);
-}
-
-void WebViewEvasEventHandler::__OnTouchMove(WebView* data, Evas *e, Evas_Object *obj, void *event_info) {
-  data->GetEvasEventHandler()->HandleEventDefault_TouchEvents(EWK_TOUCH_MOVE);
+bool WebViewEvasEventHandler::HandleEvent_FocusIn() {
+  WebViewDelegate* wvd = WebViewDelegate::GetInstance();
+  if (!wvd)
+    return false;
+  return wvd->RequestHandleEvent_FocusIn(webview_);
 }
 
-
-// ----- Default Event Handlers -----------------------------------------------
-bool WebViewEvasEventHandler::HandleEventDefault_FocusIn() {
-  return webview_->HandleFocusIn();
+bool WebViewEvasEventHandler::HandleEvent_FocusOut() {
+  WebViewDelegate* wvd = WebViewDelegate::GetInstance();
+  if (!wvd)
+    return false;
+  return wvd->RequestHandleEvent_FocusOut(webview_);
 }
 
-bool WebViewEvasEventHandler::HandleEventDefault_FocusOut() {
-  return webview_->HandleFocusOut();
-}
+bool WebViewEvasEventHandler::HandleEvent_KeyDown(const Evas_Event_Key_Down* event_info) {
+  bool handled = false;
 
+  WebViewDelegate* wvd = WebViewDelegate::GetInstance();
+  if (wvd) {
+    handled = wvd->RequestHandleEvent_KeyDown(webview_, event_info);
+    if (handled)
+      return handled;
+  }
 
-bool WebViewEvasEventHandler::HandleEventDefault_KeyDown(const Evas_Event_Key_Down* event_info) {
-  bool handled = false;
   if (isHardwareBackKey(event_info)) {
     if (webview_->GetContextMenuController()) {
       DVLOG(1) << "Hiding context menu due to back key press";
@@ -263,115 +61,44 @@ bool WebViewEvasEventHandler::HandleEventDefault_KeyDown(const Evas_Event_Key_Do
       webview_->ClearSelection();
       handled = true;
     }
-    return handled;
   }
-  return webview_->HandleEvasEvent(event_info);
+  return handled;
 }
 
-bool WebViewEvasEventHandler::HandleEventDefault_KeyUp(const Evas_Event_Key_Up* event_info) {
-  return webview_->HandleEvasEvent(event_info);
-}
-
-bool WebViewEvasEventHandler::HandleEventDefault_MouseDown(const Evas_Event_Mouse_Down* event_info) {
-  webview_->SetFocus(true);
-  return webview_->HandleEvasEvent(event_info);
-}
+bool WebViewEvasEventHandler::HandleEvent_KeyUp(const Evas_Event_Key_Up* event_info) {
 
-bool WebViewEvasEventHandler::HandleEventDefault_MouseUp(const Evas_Event_Mouse_Up* event_info) {
-  return webview_->HandleEvasEvent(event_info);
-}
-
-bool WebViewEvasEventHandler::HandleEventDefault_MouseMove(const Evas_Event_Mouse_Move* event_info) {
-  return webview_->HandleEvasEvent(event_info);
+  WebViewDelegate* wvd = WebViewDelegate::GetInstance();
+  if (!wvd)
+    return false;
+  return wvd->RequestHandleEvent_KeyUp(webview_, event_info);
 }
 
-bool WebViewEvasEventHandler::HandleEventDefault_MouseWheel(const Evas_Event_Mouse_Wheel* event_info) {
-  return webview_->HandleEvasEvent(event_info);
+bool WebViewEvasEventHandler::HandleEvent_MouseDown(const Evas_Event_Mouse_Down* event_info) {
+  WebViewDelegate* wvd = WebViewDelegate::GetInstance();
+  if (!wvd)
+    return false;
+  return wvd->RequestHandleEvent_MouseDown(webview_, event_info);
 }
 
-bool WebViewEvasEventHandler::HandleEventDefault_TextSelectionDown(int x, int y) {
-  if (!webview_->GetSelectionController()) {
+bool WebViewEvasEventHandler::HandleEvent_MouseUp(const Evas_Event_Mouse_Up* event_info) {
+  WebViewDelegate* wvd = WebViewDelegate::GetInstance();
+  if (!wvd)
     return false;
-  }
-  return webview_->GetSelectionController()->TextSelectionDown(x, y);
+  return wvd->RequestHandleEvent_MouseUp(webview_, event_info);
 }
 
-bool WebViewEvasEventHandler::HandleEventDefault_TextSelectionUp(int x, int y) {
-  if (!webview_->GetSelectionController()) {
+bool WebViewEvasEventHandler::HandleEvent_MouseMove(const Evas_Event_Mouse_Move* event_info) {
+  WebViewDelegate* wvd = WebViewDelegate::GetInstance();
+  if (!wvd)
     return false;
-  }
-  return webview_->GetSelectionController()->TextSelectionUp(x, y);
+  return wvd->RequestHandleEvent_MouseMove(webview_, event_info);
 }
 
-bool WebViewEvasEventHandler::HandleEventDefault_TouchEvents(Ewk_Touch_Event_Type type) {
-  // These constants are used to map multi touch's touch id(s).
-  // The poorly-written Tizen API document says:
-  //  "0 for Mouse Event and device id for Multi Event."
-  //  "The point which comes from Mouse Event has id 0 and"
-  //  "The point which comes from Multi Event has id that is same as Multi Event's device id."
-  static const int kMultiTouchIDMapPart0SingleIndex = 0; // This constant is to map touch id 0 to 0, or [0] -> [0]
-  static const int kMultiTouchIDMapPart1StartIndex = 13; // This constant is to map [13, 23] -> [1, 11]
-  static const int kMultiTouchIDMapPart1EndIndex = 23; // This constant is to map [13, 23] -> [1, 11]
-  static const int kMultiTouchIDMapPart1DiffValue = 12; // 13 - 1 = 12, 23 - 11 = 12
-
-  Evas_Object_Smart_Clipped_Data* clip_data =
-    WebViewDelegate::GetInstance()->GetSmartClippedData(evas_object_);
-  DCHECK(clip_data);
-
-  unsigned count = evas_touch_point_list_count(clip_data->evas);
-  if (!count) {
+bool WebViewEvasEventHandler::HandleEvent_MouseWheel(const Evas_Event_Mouse_Wheel* event_info) {
+  WebViewDelegate* wvd = WebViewDelegate::GetInstance();
+  if (!wvd)
     return false;
-  }
-
-  Evas_Coord_Point pt;
-  Eina_List* points = 0;
-  for (unsigned i = 0; i < count; ++i) {
-    tizen_webview::Touch_Point* point = new tizen_webview::Touch_Point;
-    // evas_touch_point_list_nth_id_get returns [0] or [13, )
-    // Multi touch's touch id [[0], [13, 23]] should be mapped to [[0], [1, 11]]
-    // Internet Blame URL:
-    //   https://groups.google.com/d/msg/mailing-enlightenment-devel/-R-ezCzpkTk/HJ0KBCdz6CgJ
-    point->id = evas_touch_point_list_nth_id_get(clip_data->evas, i);
-    DCHECK(point->id == kMultiTouchIDMapPart0SingleIndex || point->id >= kMultiTouchIDMapPart1StartIndex);
-    if (point->id >= kMultiTouchIDMapPart1StartIndex && point->id <= kMultiTouchIDMapPart1EndIndex) {
-      point->id -= kMultiTouchIDMapPart1DiffValue;
-    } else if (point->id > kMultiTouchIDMapPart1EndIndex) {
-      LOG(ERROR) << "evas_touch_point_list_nth_id_get() returned a value greater than ("
-                 << kMultiTouchIDMapPart1EndIndex << "). It is ignored.";
-    }
-    evas_touch_point_list_nth_xy_get(clip_data->evas, i, &point->x, &point->y);
-    pt.x = point->x;
-    pt.y = point->y;
-    point->state = evas_touch_point_list_nth_state_get(clip_data->evas, i);
-    if (type == EWK_TOUCH_CANCEL)
-      point->state = EVAS_TOUCH_POINT_CANCEL;
-    points = eina_list_append(points, point);
-  }
-
-  if (type == EWK_TOUCH_START)
-    webview_->SetFocus(EINA_TRUE);
-
-  webview_->HandleTouchEvents(type, points,
-      evas_key_modifier_get(clip_data->evas));
-
-#if defined(OS_TIZEN_MOBILE)
-  if (count >= 2) {
-    if (type == EWK_TOUCH_START) {
-      LOG(ERROR) << " wkext_motion_tilt_start";
-      wkext_motion_tilt_start(evas_object_, &pt);
-    } else if(type == EWK_TOUCH_END) {
-      wkext_motion_tilt_stop();
-    }
-  }
-#else
-  // Silence unused variable warning
-  (void)(pt);
-#endif
-
-  void* data;
-  EINA_LIST_FREE(points, data)
-  delete static_cast<Touch_Point*>(data);
-  return true;
+  return wvd->RequestHandleEvent_MouseWheel(webview_, event_info);
 }
 
 } // namespace tizen_webview
index 106a866..c6affc8 100644 (file)
@@ -6,86 +6,27 @@
 #ifndef TIZEN_WEBVIEW_EVENT_TW_WEBVIEW_EVAS_EVENT_HANDLER_H_
 #define TIZEN_WEBVIEW_EVENT_TW_WEBVIEW_EVAS_EVENT_HANDLER_H_
 
-#include <Evas.h>
+#include "content/browser/renderer_host/evas_event_handler.h"
 
 namespace tizen_webview {
 
 class WebView;
-class WebViewDelegate;
-class WebViewEvasEventHandler {
+class WebViewEvasEventHandler: public content::EvasEventHandler {
  public:
   explicit WebViewEvasEventHandler(WebView*);
 
-  // Default event handlers of WebView.
-  void BindKeyEventHandlers();
-  void UnbindKeyEventHandlers();
-  void BindMouseEventHandlers();
-  void UnbindMouseEventHandlers();
-  void BindFocusEventHandlers();
-  void UnbindFocusEventHandlers();
-  void BindMotionEventHandlers();
-  void UnbindMotionEventHandlers();
-  void BindTouchEventHandlers();
-  void UnbindTouchEventHandlers();
-
-  // ---- Evas Event callbacks
-  // Each callback will be registered to Evas Object to handle a specified
-  // evas event. It should be EFL's Evas_Event_Cb type because it will be
-  // passed in as an arguement of evas_event_callback_add().
-  // Evas will trigger corresponding callback given evas object and event.
-  // Each callback basically does followings:
-  //  - firstly, ask WebViewDelegate to handle the event
-  //  - If WebViewDelegate return true, the event is not processed any more
-  //  - Otherwise, forward the event to corresponding default event handler
-  typedef void (*Evas_Event_Callback)(WebView* data, Evas *e,
-                                      Evas_Object* obj, void* event_info);
-  static void __OnFocusIn   (WebView*, Evas*, Evas_Object*, void*);
-  static void __OnFocusOut  (WebView*, Evas*, Evas_Object*, void*);
-  static void __OnKeyDown   (WebView*, Evas*, Evas_Object*, void*);
-  static void __OnKeyUp     (WebView*, Evas*, Evas_Object*, void*);
-  static void __OnMouseDown (WebView*, Evas*, Evas_Object*, void*);
-  static void __OnMouseUp   (WebView*, Evas*, Evas_Object*, void*);
-  static void __OnMouseMove (WebView*, Evas*, Evas_Object*, void*);
-  static void __OnMouseWheel(WebView*, Evas*, Evas_Object*, void*);
-  static void __OnTouchDown (WebView*, Evas*, Evas_Object*, void*);
-  static void __OnTouchUp   (WebView*, Evas*, Evas_Object*, void*);
-  static void __OnTouchMove (WebView*, Evas*, Evas_Object*, void*);
-
-  // --- Evas smart object event callbacks
-  // Each callback will be registered to Evas Smart Object to handle a evas
-  // smart event. It should be EFL's Evas_Smart_Cb type because it will be
-  // passed in as an arguement of evas_event_callback_add().
-  typedef void (*Evas_Smart_Callback)(WebView* data, Evas_Object* obj,
-                                      void* event_info);
-  static void __OnMotionEnable(WebView*, Evas_Object*, void*);
-  static void __OnMotionMove  (WebView*, Evas_Object*, void*);
-  static void __OnMotionZoom  (WebView*, Evas_Object*, void*);
-
-  // ---- Default event handlers
-  // It is usually (but not always) invoked when the given event is not handled
-  // by WebViewDelegate.
-  // It's made public to allow a WebView Client to invoke it directly if
-  // necessary (e.g, to implement Ewk webview's smart api).
-  bool HandleEventDefault_FocusIn();
-  bool HandleEventDefault_FocusOut();
-  bool HandleEventDefault_KeyDown(const Evas_Event_Key_Down*);
-  bool HandleEventDefault_KeyUp  (const Evas_Event_Key_Up*);
-  bool HandleEventDefault_MouseDown (const Evas_Event_Mouse_Down*);
-  bool HandleEventDefault_MouseUp   (const Evas_Event_Mouse_Up*);
-  bool HandleEventDefault_MouseMove (const Evas_Event_Mouse_Move*);
-  bool HandleEventDefault_MouseWheel(const Evas_Event_Mouse_Wheel*);
-  bool HandleEventDefault_TextSelectionDown(int x, int y);
-  bool HandleEventDefault_TextSelectionUp  (int x, int y);
-  bool HandleEventDefault_TouchEvents(Ewk_Touch_Event_Type type);
+  // ---- event handlers
+  bool HandleEvent_FocusIn() override;
+  bool HandleEvent_FocusOut() override;
+  bool HandleEvent_KeyDown (const Evas_Event_Key_Down*) override;
+  bool HandleEvent_KeyUp (const Evas_Event_Key_Up*) override;
+  bool HandleEvent_MouseDown (const Evas_Event_Mouse_Down*) override;
+  bool HandleEvent_MouseUp   (const Evas_Event_Mouse_Up*) override;
+  bool HandleEvent_MouseMove (const Evas_Event_Mouse_Move*) override;
+  bool HandleEvent_MouseWheel(const Evas_Event_Mouse_Wheel*) override;
 
  private:
   WebView* webview_;
-  Evas_Object* evas_object_;
-  bool is_focus_handler_bound_;
-  bool is_key_handler_bound_;
-  bool is_mouse_handler_bound_;
-  bool is_motion_handler_bound_;
-  bool is_touch_handler_bound_;
 };
 
 } // namespace tizen_webview
index 6d253cd..bc225ae 100644 (file)
@@ -527,7 +527,7 @@ void WebContentsDelegateEfl::NavigationEntryCommitted(const LoadCommittedDetails
 }
 
 void WebContentsDelegateEfl::RenderViewCreated(RenderViewHost* render_view_host) {
-  web_view_->SendDelayedMessages(render_view_host);
+  web_view_->RenderViewCreated(render_view_host);
 }
 
 void WebContentsDelegateEfl::RenderProcessGone(base::TerminationStatus status) {