WebViewEvasEventHandler does not rely on tizen_webview::WebView anymore
[platform/framework/web/chromium-efl.git] / tizen_src / ewk / efl_integration / tizen_webview / public / tw_webview_delegate.h
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved.
2 // Copyright 2014 Samsung Electronics. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5
6 #ifndef TIZEN_WEBVIEW_PUBLIC_TW_WEBVIEW_DELEGATE_H_
7 #define TIZEN_WEBVIEW_PUBLIC_TW_WEBVIEW_DELEGATE_H_
8
9 #include <Evas.h>
10 #include <eina_rectangle.h>
11
12 class EWebView;
13
14 namespace tizen_webview {
15
16 class WebView;
17
18 class WebViewDelegate {
19  public:
20   // Register the default delegate.
21   // Client of WebView should register one before creating a WebView first time.
22   // Client has the ownership for |wv_delegate| and should ensure its validity
23   // while using WebView.
24   // Currently, it is not allowed to re-register another delegate,
25   // and if try to do it it is simply ignored.
26   static void RegisterDelegate(WebViewDelegate* wv_delegate);
27
28   // Check if a default delegate is registered or not
29   static bool IsDelegateRegistered();
30
31   // Get the default delegate registered in RegisterDefaultDelegate()
32   static WebViewDelegate* GetInstance();
33
34   // Retrieve WebView from |evas_object|.
35   // If |evas_object| is not WebView, return NULL.
36   virtual WebView* GetWebViewFromEvasObject(Evas_Object* evas_object) = 0;
37
38   // Check if |evas_object| is WebView or not.
39   virtual bool IsWebViewEvasObject(Evas_Object* evas_object) = 0;
40
41   // Get clipped data from WebView evas object which is a clipped smart object.
42   virtual Evas_Object_Smart_Clipped_Data* GetSmartClippedData(
43       Evas_Object* evas_object) = 0;
44
45   // Get lastly used view port area.
46   // If |evas_object| is not a WebView, return Enia_Rectangle with width -1.
47   virtual Eina_Rectangle GetLastUsedViewPortArea(Evas_Object* evas_object) = 0;
48
49   // ---- Custom Event handlers
50   // Give opportunity for client to process event.
51   // [Note] return true if handled, false otherwise.
52   virtual bool RequestHandleEvent_FocusIn(EWebView* wv) { return false; }
53   virtual bool RequestHandleEvent_FocusOut(EWebView* wv) { return false; }
54   virtual bool RequestHandleEvent_MouseUp(
55       EWebView* wv, const Evas_Event_Mouse_Up* event_info) { return false; }
56   virtual bool RequestHandleEvent_MouseDown(
57       EWebView* wv, const Evas_Event_Mouse_Down* event_info) { return false; }
58   virtual bool RequestHandleEvent_MouseMove(
59       EWebView* wv, const Evas_Event_Mouse_Move* event_info) { return false; }
60   virtual bool RequestHandleEvent_MouseWheel(
61       EWebView* wv, const Evas_Event_Mouse_Wheel* event_info) { return false; }
62   virtual bool RequestHandleEvent_KeyUp(
63       EWebView* wv, const Evas_Event_Key_Up* event_info) { return false; }
64   virtual bool RequestHandleEvent_KeyDown(
65       EWebView* wv, const Evas_Event_Key_Down* event_info) { return false; }
66 };
67
68 } // namespace tizen_webview
69
70 #endif  // TIZEN_WEBVIEW_PUBLIC_TW_WEBVIEW_DELEGATE_H_