e26627744aa3f6b01f980bd680b7f110e398537d
[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 namespace tizen_webview {
13
14 class WebView;
15
16 class WebViewDelegate {
17  public:
18   // Register the default delegate.
19   // Client of WebView should register one before creating a WebView first time.
20   // Client has the ownership for |wv_delegate| and should ensure its validity
21   // while using WebView.
22   // Currently, it is not allowed to re-register another delegate,
23   // and if try to do it it is simply ignored.
24   static void RegisterDelegate(WebViewDelegate* wv_delegate);
25
26   // Check if a default delegate is registered or not
27   static bool IsDelegateRegistered();
28
29   // Get the default delegate registered in RegisterDefaultDelegate()
30   static WebViewDelegate* GetInstance();
31
32   // Retrieve WebView from |evas_object|.
33   // If |evas_object| is not WebView, return NULL.
34   virtual WebView* GetWebViewFromEvasObject(Evas_Object* evas_object) = 0;
35
36   // Check if |evas_object| is WebView or not.
37   virtual bool IsWebViewEvasObject(Evas_Object* evas_object) = 0;
38
39   // Get clipped data from WebView evas object which is a clipped smart object.
40   virtual Evas_Object_Smart_Clipped_Data* GetSmartClippedData(
41       Evas_Object* evas_object) = 0;
42
43   // Get lastly used view port area.
44   // If |evas_object| is not a WebView, return Enia_Rectangle with width -1.
45   virtual Eina_Rectangle GetLastUsedViewPortArea(Evas_Object* evas_object) = 0;
46
47   // ---- Custom Event handlers
48   // Give opportunity for client to process event.
49   // [Note] return true if handled, false otherwise.
50   virtual bool RequestHandleEvent_FocusIn(WebView* wv) { return false; }
51   virtual bool RequestHandleEvent_FocusOut(WebView* wv) { return false; }
52   virtual bool RequestHandleEvent_MouseUp(
53       WebView* wv, const Evas_Event_Mouse_Up* event_info) { return false; }
54   virtual bool RequestHandleEvent_MouseDown(
55       WebView* wv, const Evas_Event_Mouse_Down* event_info) { return false; }
56   virtual bool RequestHandleEvent_MouseMove(
57       WebView* wv, const Evas_Event_Mouse_Move* event_info) { return false; }
58   virtual bool RequestHandleEvent_MouseWheel(
59       WebView* wv, const Evas_Event_Mouse_Wheel* event_info) { return false; }
60   virtual bool RequestHandleEvent_KeyUp(
61       WebView* wv, const Evas_Event_Key_Up* event_info) { return false; }
62   virtual bool RequestHandleEvent_KeyDown(
63       WebView* wv, const Evas_Event_Key_Down* event_info) { return false; }
64 };
65
66 } // namespace tizen_webview
67
68 #endif  // TIZEN_WEBVIEW_PUBLIC_TW_WEBVIEW_DELEGATE_H_