30f2c097536ad6fc23fcec3c075c1211a9952da7
[platform/framework/web/chromium-efl.git] / tizen_src / ewk / efl_integration / private / ewk_view_private.h
1 // Copyright 2014 Samsung Electronics. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef ewk_view_private_h
6 #define ewk_view_private_h
7
8 #include <Evas.h>
9 #include "ewk_view.h"
10 #include <tizen_webview/public/tw_webview.h>
11
12 class Ewk_Context;
13
14 // Create WebView Evas Object
15 Evas_Object* CreateWebViewAsEvasObject(Ewk_Context* context, Evas* canvas, Evas_Smart* smart = 0);
16 bool InitSmartClassInterface(Ewk_View_Smart_Class& api);
17
18 // EwkView's Smart Class Name
19 const char EwkViewSmartClassName[] = "EWebView";
20
21 // type conversion utility
22 bool IsWebViewObject(const Evas_Object* evas_object);
23 Ewk_View_Smart_Data* GetEwkViewSmartDataFromEvasObject(const Evas_Object* evas_object);
24 Ewk_View_Smart_Data* GetEwkViewSmartDataFromWebView(tizen_webview::WebView* wv);
25 tizen_webview::WebView* GetWebViewFromSmartData(const Ewk_View_Smart_Data* smartData);
26 tizen_webview::WebView* GetWebViewFromEvasObject(const Evas_Object* eo);
27
28 // helper macro
29 #define EWK_VIEW_IMPL_GET_OR_RETURN(evas_object, impl, ...)               \
30   tizen_webview::WebView* impl = GetWebViewFromEvasObject(evas_object);   \
31   do {                                                                    \
32     if (!impl) {                                                          \
33       EINA_LOG_CRIT("Evas Object %p is not Ewk WebView", evas_object);    \
34       return __VA_ARGS__;                                                 \
35     }                                                                     \
36   } while (0)
37
38 #endif // ewk_view_private_h