Create string tightly when retrive string from cbhm callback event
[framework/web/webkit-efl.git] / Source / WebKit2 / UIProcess / API / efl / ewk_notification.h
1 /*
2  * Copyright (C) 2012 Samsung Electronics
3  *
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.
8  *
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.
13  *
14  * You should have received a copy of the GNU Library General Public License
15  * along with this library; see the file COPYING.LIB.  If not, write to
16  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  */
19
20 #ifndef ewk_notification_h
21 #define ewk_notification_h
22
23 #include "ewk_context.h"
24 #include "ewk_security_origin.h"
25 #include <Eina.h>
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30
31 struct _Ewk_Notification_Permission {
32     const char *origin;
33     Eina_Bool allowed;
34 };
35
36 typedef struct _Ewk_Notification Ewk_Notification;
37 typedef struct _Ewk_Notification_Permission Ewk_Notification_Permission;
38 typedef struct _Ewk_Notification_Permission_Request Ewk_Notification_Permission_Request;
39
40 /**
41  * Requests for getting body of notification.
42  *
43  * @param ewk_notification pointer of notificaion data
44  *
45  * @return body of notification
46  */
47 EAPI const char *ewk_notification_body_get(const Ewk_Notification *ewk_notification);
48
49 /**
50  * Notify that notification is clicked.
51  *
52  * @param context context object
53  * @param notification_id identifier of notification
54  */
55 EAPI void ewk_notification_clicked(Ewk_Context *context, uint64_t notification_id);
56
57 /**
58  * Requests for getting icon url of notification.
59  *
60  * @param ewk_notification pointer of notification data
61  *
62  * @return icon url of notification
63  */
64 EAPI const char *ewk_notification_icon_url_get(const Ewk_Notification *ewk_notification);
65
66 /**
67  * Requests for getting id of notification.
68  *
69  * @param ewk_notification pointer of notification data
70  *
71  * @return id of notification
72  */
73 EAPI uint64_t ewk_notification_id_get(const Ewk_Notification *ewk_notification);
74
75 /**
76  * Requests for setting cached notification permissions.
77  *
78  * By calling this notification permission is replaced as passed ewk_notification_permissions.
79  *
80  * @param context context object
81  * @param ewk_notification_permissions list of cached permissions(Ewk_Notification_Permission)
82  */
83 EAPI void ewk_notification_cached_permissions_set(Ewk_Context *context, Eina_List *ewk_notification_permissions);
84
85 /**
86  * Requests for getting origin of notification permission request.
87  *
88  * @param request Ewk_Notification_Permission_Request object to get origin for notification permission request
89  *
90  * @return security origin of notification permission request
91  */
92 EAPI const Ewk_Security_Origin *ewk_notification_permission_request_origin_get(const Ewk_Notification_Permission_Request *request);
93
94 /**
95  * Sets permission of notification.
96  *
97  * @param request Ewk_Notification_Permission_Request object to allow/deny notification permission
98  *        request is freed in this function.
99  * @param allowed @c EINA_TRUE if permission is allowed, @c EINA_FALSE if permission is denied
100  */
101 EAPI void ewk_notification_permission_request_set(Ewk_Notification_Permission_Request *request, Eina_Bool allowed);
102
103 /**
104  * Suspend the operation for permission request.
105  *
106  * This suspends the operation for permission request.
107  * This is very useful to decide the policy from the additional UI operation like the popup.
108  *
109  * @param request Ewk_Notification_Permission_Request object to suspend notification permission request
110  */
111 EAPI void ewk_notification_permission_request_suspend(Ewk_Notification_Permission_Request *request);
112
113 /**
114  * Notify that notification policies are removed.
115  *
116  * @param context context object
117  * @param origins list of security origins(made by UAs)
118  */
119 EAPI void ewk_notification_policies_removed(Ewk_Context *context, Eina_List *origins);
120
121 /**
122  * Requests for getting security origin of notification.
123  *
124  * @param ewk_notification pointer of notification data
125  *
126  * @return security origin of notification
127  */
128 EAPI const Ewk_Security_Origin *ewk_notification_security_origin_get(const Ewk_Notification *ewk_notification);
129
130 /**
131  * Notify that notification is showed.
132  *
133  * @param context context object
134  * @param notification_id identifier of notification
135  */
136 EAPI void ewk_notification_showed(Ewk_Context *context, uint64_t notification_id);
137
138 /**
139  * Requests for getting title of notification.
140  *
141  * @param ewk_notification pointer of notification data
142  *
143  * @return title of notification
144  */
145 EAPI const char *ewk_notification_title_get(const Ewk_Notification *ewk_notification);
146
147 #ifdef __cplusplus
148 }
149 #endif
150 #endif // ewk_notification_h