2 * Copyright (C) 2014 Samsung Electronics. All rights reserved.
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
21 #ifndef EWEB_VIEW_CALLBACKS
22 #define EWEB_VIEW_CALLBACKS
27 #include "eweb_view.h"
28 #include "private/ewk_auth_challenge_private.h"
29 #include "private/ewk_certificate_info_private.h"
30 #include "private/ewk_certificate_private.h"
31 #include "private/ewk_console_message_private.h"
32 #include "private/ewk_context_menu_private.h"
33 #include "private/ewk_error_private.h"
34 #include "private/ewk_geolocation_private.h"
35 #include "private/ewk_policy_decision_private.h"
36 #include "private/ewk_user_media_private.h"
38 typedef struct EwkObject Ewk_Auth_Request;
39 typedef struct EwkObject Ewk_Download_Job;
40 typedef struct EwkObject Ewk_File_Chooser_Request;
41 typedef struct EwkObject Ewk_Form_Submission_Request;
42 typedef struct EwkObject Ewk_Navigation_Policy_Decision;
43 typedef struct _Ewk_User_Media_Permission_Request
44 Ewk_User_Media_Permission_Request;
46 class Ewk_Wrt_Message_Data;
48 namespace EWebViewCallbacks {
51 AuthenticationRequest,
52 BackForwardListChange,
61 NewFormSubmissionRequest,
69 ProvisionalLoadFailed,
70 ProvisionalLoadRedirect,
71 ProvisionalLoadStarted,
74 NavigationPolicyDecision,
75 NewWindowPolicyDecision,
91 IMECandidatePanelShow,
92 IMECandidatePanelHide,
93 IMEInputMethodChanged,
94 GeoLocationPermissionRequest,
96 RequestCertificateConfirm,
97 SSLCertificateChanged,
100 ContextMenuItemSelected,
101 LoadNonEmptyLayoutFinished,
103 PopupReplyWaitFinish,
105 CreateNewBackgroundWindow,
127 WebloginCheckboxClicked,
128 WebloginCheckboxResume,
132 #if BUILDFLAG(IS_TIZEN)
133 NewWindowNavigationPolicyDecision,
137 NotificationPermissionReply,
142 template <CallbackType>
145 class EvasObjectHolder {
147 explicit EvasObjectHolder(Evas_Object* object)
152 Evas_Object* m_object;
155 template <CallbackType callbackType, typename ArgType = typename CallBackInfo<callbackType>::Type>
156 struct CallBack: public EvasObjectHolder {
157 explicit CallBack(Evas_Object* view) : EvasObjectHolder(view) { }
159 void call(ArgType argument) {
160 evas_object_smart_callback_call(m_object, CallBackInfo<callbackType>::name(), static_cast<void*>(argument));
164 template <CallbackType callbackType>
165 struct CallBack <callbackType, void> : public EvasObjectHolder {
166 explicit CallBack(Evas_Object* view) : EvasObjectHolder(view) { }
169 evas_object_smart_callback_call(m_object, CallBackInfo<callbackType>::name(), 0);
173 template <CallbackType callbackType>
174 struct CallBack <callbackType, const char*> : public EvasObjectHolder {
175 explicit CallBack(Evas_Object* view) : EvasObjectHolder(view) { }
177 void call(const char* arg) {
178 evas_object_smart_callback_call(m_object, CallBackInfo<callbackType>::name(), const_cast<char*>(arg));
182 #define DECLARE_EWK_VIEW_CALLBACK(callbackType, string, type) \
184 struct CallBackInfo<callbackType> { \
186 static inline const char* name() { return string; } \
189 // Copied from WebKit as is. TODO: implement each and delete this section.
191 DECLARE_EWK_VIEW_CALLBACK(AuthenticationRequest, "authentication,request", Ewk_Auth_Request*);
192 DECLARE_EWK_VIEW_CALLBACK(CancelVibration, "cancel,vibration", void);
193 DECLARE_EWK_VIEW_CALLBACK(DownloadJobCancelled, "download,cancelled", Ewk_Download_Job*);
194 DECLARE_EWK_VIEW_CALLBACK(DownloadJobFailed, "download,failed", Ewk_Download_Job_Error*);
195 DECLARE_EWK_VIEW_CALLBACK(DownloadJobFinished, "download,finished", Ewk_Download_Job*);
196 DECLARE_EWK_VIEW_CALLBACK(DownloadJobRequested, "download,request", Ewk_Download_Job*);
197 DECLARE_EWK_VIEW_CALLBACK(NewFormSubmissionRequest, "form,submission,request", Ewk_Form_Submission_Request*);
198 DECLARE_EWK_VIEW_CALLBACK(FaviconChanged, "favicon,changed", void);
199 DECLARE_EWK_VIEW_CALLBACK(ProvisionalLoadFailed, "load,provisional,failed", Ewk_Error*);
200 DECLARE_EWK_VIEW_CALLBACK(NavigationPolicyDecision, "policy,decision,navigation", Ewk_Navigation_Policy_Decision*);
201 DECLARE_EWK_VIEW_CALLBACK(TextFound, "text,found", unsigned*);
202 DECLARE_EWK_VIEW_CALLBACK(TooltipTextUnset, "tooltip,text,unset", void);
203 DECLARE_EWK_VIEW_CALLBACK(Vibrate, "vibrate", uint32_t*);
206 // Note: type 'void' means that no arguments are expected.
208 DECLARE_EWK_VIEW_CALLBACK(FileChooserRequest, "file,chooser,request", Ewk_File_Chooser_Request*);
209 DECLARE_EWK_VIEW_CALLBACK(FormSubmit, "form,submit", const char*);
210 DECLARE_EWK_VIEW_CALLBACK(LoadFinished, "load,finished", void);
211 DECLARE_EWK_VIEW_CALLBACK(LoadStarted, "load,started", void);
212 DECLARE_EWK_VIEW_CALLBACK(LoadError, "load,error", _Ewk_Error*);
213 DECLARE_EWK_VIEW_CALLBACK(TitleChange, "title,changed", const char*);
214 DECLARE_EWK_VIEW_CALLBACK(URLChanged, "url,changed", const char*);
215 DECLARE_EWK_VIEW_CALLBACK(URIChanged, "uri,changed", const char*);
216 DECLARE_EWK_VIEW_CALLBACK(LoadProgress, "load,progress", double*);
217 DECLARE_EWK_VIEW_CALLBACK(TooltipTextSet, "tooltip,text,set", const char*);
218 DECLARE_EWK_VIEW_CALLBACK(EnterFullscreen, "fullscreen,enterfullscreen", void);
219 DECLARE_EWK_VIEW_CALLBACK(ExitFullscreen, "fullscreen,exitfullscreen", void);
220 DECLARE_EWK_VIEW_CALLBACK(UserMediaPermission, "usermedia,permission,request", _Ewk_User_Media_Permission_Request*);
221 DECLARE_EWK_VIEW_CALLBACK(IMEInputPanelShow, "editorclient,ime,opened", void);
222 DECLARE_EWK_VIEW_CALLBACK(IMEInputPanelHide, "editorclient,ime,closed", void);
223 DECLARE_EWK_VIEW_CALLBACK(IMECandidatePanelShow, "editorclient,candidate,opened", void);
224 DECLARE_EWK_VIEW_CALLBACK(IMECandidatePanelHide, "editorclient,candidate,closed", void);
225 DECLARE_EWK_VIEW_CALLBACK(CreateNewWindow, "create,window", Evas_Object**);
226 DECLARE_EWK_VIEW_CALLBACK(WindowClosed, "close,window", void);
227 DECLARE_EWK_VIEW_CALLBACK(IMEInputMethodChanged, "inputmethod,changed", Eina_Rectangle*);
228 DECLARE_EWK_VIEW_CALLBACK(ProvisionalLoadStarted, "load,provisional,started", void);
229 DECLARE_EWK_VIEW_CALLBACK(ProvisionalLoadRedirect, "load,provisional,redirect", void);
230 DECLARE_EWK_VIEW_CALLBACK(LoadCommitted, "load,committed", void);
231 DECLARE_EWK_VIEW_CALLBACK(GeoLocationPermissionRequest, "geolocation,permission,request", _Ewk_Geolocation_Permission_Request*);
232 DECLARE_EWK_VIEW_CALLBACK(GeoLocationValid, "geolocation,valid", Eina_Bool*);
233 DECLARE_EWK_VIEW_CALLBACK(RequestCertificateConfirm, "request,certificate,confirm", _Ewk_Certificate_Policy_Decision*);
234 DECLARE_EWK_VIEW_CALLBACK(SSLCertificateChanged, "ssl,certificate,changed", _Ewk_Certificate_Info*);
235 DECLARE_EWK_VIEW_CALLBACK(PolicyResponseDecide, "policy,response,decide", _Ewk_Policy_Decision*);
236 DECLARE_EWK_VIEW_CALLBACK(ContextMenuCustomize, "contextmenu,customize", _Ewk_Context_Menu*);
237 DECLARE_EWK_VIEW_CALLBACK(ContextMenuItemSelected, "contextmenu,selected", _Ewk_Context_Menu_Item*);
238 DECLARE_EWK_VIEW_CALLBACK(NavigationPolicyDecision, "policy,navigation,decide", _Ewk_Policy_Decision*);
239 DECLARE_EWK_VIEW_CALLBACK(TextFound, "text,found", unsigned int*);
240 DECLARE_EWK_VIEW_CALLBACK(TextSelectionMode, "textselection,mode", bool*);
241 DECLARE_EWK_VIEW_CALLBACK(NewWindowPolicyDecision, "policy,newwindow,decide", _Ewk_Policy_Decision*);
242 DECLARE_EWK_VIEW_CALLBACK(LoadNonEmptyLayoutFinished, "load,nonemptylayout,finished", void);
243 DECLARE_EWK_VIEW_CALLBACK(PopupBlocked, "popup,blocked", Eina_Stringshare*);
244 DECLARE_EWK_VIEW_CALLBACK(PopupReplyWaitStart, "popup,reply,wait,start", void*);
245 DECLARE_EWK_VIEW_CALLBACK(PopupReplyWaitFinish, "popup,reply,wait,finish", void*);
246 DECLARE_EWK_VIEW_CALLBACK(FrameRendered, "frame,rendered", void*);
247 DECLARE_EWK_VIEW_CALLBACK(CreateNewBackgroundWindow,
248 "create,window,background",
250 DECLARE_EWK_VIEW_CALLBACK(EdgeLeft, "edge,left", void);
251 DECLARE_EWK_VIEW_CALLBACK(EdgeTop, "edge,top", void);
252 DECLARE_EWK_VIEW_CALLBACK(EdgeBottom, "edge,bottom", void);
253 DECLARE_EWK_VIEW_CALLBACK(EdgeRight, "edge,right", void);
254 DECLARE_EWK_VIEW_CALLBACK(OverscrolledLeft, "overscrolled,left", void);
255 DECLARE_EWK_VIEW_CALLBACK(OverscrolledRight, "overscrolled,right", void);
256 DECLARE_EWK_VIEW_CALLBACK(OverscrolledTop, "overscrolled,top", void);
257 DECLARE_EWK_VIEW_CALLBACK(OverscrolledBottom, "overscrolled,bottom", void);
258 DECLARE_EWK_VIEW_CALLBACK(SaveSessionData, "save,session,data", void);
259 DECLARE_EWK_VIEW_CALLBACK(MagnifierShow, "magnifier,show", void);
260 DECLARE_EWK_VIEW_CALLBACK(MagnifierHide, "magnifier,hide", void);
261 DECLARE_EWK_VIEW_CALLBACK(ClipboardOpened, "clipboard,opened", void*);
262 DECLARE_EWK_VIEW_CALLBACK(BackForwardListChange, "back,forward,list,changed", void);
263 DECLARE_EWK_VIEW_CALLBACK(WebProcessCrashed, "webprocess,crashed", bool*);
264 DECLARE_EWK_VIEW_CALLBACK(ConsoleMessage, "console,message", _Ewk_Console_Message*);
265 DECLARE_EWK_VIEW_CALLBACK(WrtPluginsMessage, "wrt,message", Ewk_Wrt_Message_Data*);
266 DECLARE_EWK_VIEW_CALLBACK(IconReceived, "icon,received", void);
267 DECLARE_EWK_VIEW_CALLBACK(OverflowScrollOff, "overflow,scroll,off", void);
268 DECLARE_EWK_VIEW_CALLBACK(OverflowScrollOn, "overflow,scroll,on", void);
269 DECLARE_EWK_VIEW_CALLBACK(TouchmoveHandled, "touchmove,handled", bool);
270 DECLARE_EWK_VIEW_CALLBACK(HWBackUnhandled, "hwback,unhandled", void);
271 DECLARE_EWK_VIEW_CALLBACK(WebloginCheckboxClicked, "weblogin,checkbox,clicked", void);
272 DECLARE_EWK_VIEW_CALLBACK(WebloginCheckboxResume, "weblogin,checkbox,resume", void);
273 DECLARE_EWK_VIEW_CALLBACK(WebloginReady, "weblogin,ready" , void);
274 DECLARE_EWK_VIEW_CALLBACK(ZoomStarted, "zoom,started", void);
275 DECLARE_EWK_VIEW_CALLBACK(ZoomFinished, "zoom,finished", void);
276 #if BUILDFLAG(IS_TIZEN)
277 DECLARE_EWK_VIEW_CALLBACK(NewWindowNavigationPolicyDecision, "policy,decision,new,window", Ewk_Navigation_Policy_Decision*);
280 DECLARE_EWK_VIEW_CALLBACK(ContentsSizeChanged, "contents,size,changed", void);
281 DECLARE_EWK_VIEW_CALLBACK(MenuBarVisible, "menubar,visible", bool*);
282 DECLARE_EWK_VIEW_CALLBACK(StatusBarVisible, "statusbar,visible", bool*);
283 DECLARE_EWK_VIEW_CALLBACK(ToolbarVisible, "toolbar,visible", bool*);
284 DECLARE_EWK_VIEW_CALLBACK(WindowResizable, "window,resizable", bool*);
285 DECLARE_EWK_VIEW_CALLBACK(DidNotAllowScript, "did,not,allow,script", void);
286 DECLARE_EWK_VIEW_CALLBACK(NotificationPermissionReply,
287 "notification,permission,reply",
288 Ewk_Notification_Permission*);
289 DECLARE_EWK_VIEW_CALLBACK(FocusOut, "webview,focus,out", void);
290 DECLARE_EWK_VIEW_CALLBACK(FocusIn, "webview,focus,in", void);