Create string tightly when retrive string from cbhm callback event
[framework/web/webkit-efl.git] / Source / WebKit2 / UIProcess / API / efl / ewk_context.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 program 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 program; 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 /**
21  * @file    ewk_context.h
22  * @brief   Describes the context API.
23  *
24  * @note ewk_context encapsulates all pages related to specific use of WebKit.
25  *
26  * Applications have the option of creating a context different than the default one
27  * and use it for a group of pages. All pages in the same context share the same
28  * preferences, visited link set, local storage, etc.
29  *
30  * A process model can be specified per context. The default one is the shared model
31  * where the web-engine process is shared among the pages in the context. The second
32  * model allows each page to use a separate web-engine process. This latter model is
33  * currently not supported by WebKit2/EFL.
34  *
35  */
36
37 #ifndef ewk_context_h
38 #define ewk_context_h
39
40 #include "ewk_cookie_manager.h"
41 #include "ewk_favicon_database.h"
42 #include "ewk_navigation_data.h"
43 #include "ewk_url_scheme_request.h"
44 #include <Evas.h>
45
46 #include "ewk_security_origin.h"
47 #include <Eina.h>
48
49 #ifdef __cplusplus
50 extern "C" {
51 #endif
52
53 /// Defines extensible api
54 enum Ewk_Extensible_API {
55     EWK_EXTENSIBLE_API_BACKGROUND_MUSIC,
56     EWK_EXTENSIBLE_API_CSP,
57     EWK_EXTENSIBLE_API_ENCRYPTION_DATABASE,
58     EWK_EXTENSIBLE_API_FULL_SCREEN,
59     EWK_EXTENSIBLE_API_MEDIA_STREAM_RECORD,
60     EWK_EXTENSIBLE_API_MEDIA_VOLUME_CONTROL,
61     EWK_EXTENSIBLE_API_PRERENDERING_FOR_ROTATION,
62     EWK_EXTENSIBLE_API_ROTATE_CAMERA_VIEW
63 };
64 /// Creates a type name for @a _Ewk_Extensible_API.
65 typedef enum Ewk_Extensible_API Ewk_Extensible_API;
66
67 /** Creates a type name for @a Ewk_Context. */
68 typedef struct Ewk_Context Ewk_Context;
69 typedef struct Ewk_Context_Exceeded_Quota Ewk_Context_Exceeded_Quota;
70
71 /**
72  * Deletes Ewk_Context.
73  *
74  * @param context Ewk_Context to delete
75  */
76 EAPI void ewk_context_delete(Ewk_Context* context);
77
78 /**
79  * Notify low memory to free unused memory.
80  *
81  * @param o context object to notify low memory.
82  *
83  * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise.
84  */
85 EAPI Eina_Bool ewk_context_notify_low_memory(Ewk_Context* ewkContext);
86
87 /**
88  * Sets the given proxy URI to network backend of specific context.
89  *
90  * @param ewkContext context object to set proxy URI.
91  * @param proxy URI to set
92  */
93 EAPI void ewk_context_proxy_uri_set(Ewk_Context* ewkContext, const char* proxy);
94
95 /**
96  * Gets the proxy URI from the network backend of specific context.
97  *
98  * It returns an internal string and should not
99  * be modified. The string is guaranteed to be stringshared.
100  *
101  * @param ewkContext context object to get proxy URI.
102  *
103  * @return current proxy URI or @c 0 if it's not set
104  */
105 EAPI const char* ewk_context_proxy_uri_get(Ewk_Context* ewkContext);
106
107 /**
108  * Cancels network session requests.
109  *
110  * @param context context object to cancel network session requests
111  */
112 EAPI void ewk_context_network_session_requests_cancel(Ewk_Context* context);
113
114 /**
115  * @typedef Ewk_Local_File_System_Origins_Get_Callback Ewk_Local_File_System_Origins_Get_Callback
116  * @brief Type definition for use with ewk_context_local_file_system_origins_get()
117  */
118 typedef void (*Ewk_Local_File_System_Origins_Get_Callback)(Eina_List *origins, void *user_data);
119
120 /**
121  * Callback for ewk_context_application_cache_origins_get
122  *
123  * @param origins web application cache origins
124  * @param user_data user_data will be passsed when ewk_context_application_cache_origins_get is called
125  */
126 typedef void (*Ewk_Web_Application_Cache_Origins_Get_Callback)(Eina_List* origins, void* user_data);
127
128 /**
129  * Callback for ewk_context_application_cache_quota_get.
130  *
131  * @param quota web application cache quota
132  * @param user_data user_data will be passsed when ewk_context_application_cache_quota_get is called
133  */
134 typedef void (*Ewk_Web_Application_Cache_Quota_Get_Callback)(int64_t quota, void* user_data);
135
136 /**
137  * Callback for ewk_context_application_cache_usage_for_origin_get.
138  *
139  * @param usage web application cache usage for origin
140  * @param user_data user_data will be passsed when ewk_context_application_cache_usage_for_origin_get is called
141  */
142 typedef void (*Ewk_Web_Application_Cache_Usage_For_Origin_Get_Callback)(int64_t usage, void* user_data);
143
144 /**
145  * Callback for ewk_context_application_cache_path_get.
146  *
147  * @param path web application cache directory
148  * @param user_data user_data will be passsed when ewk_context_application_cache_path_get is called
149  */
150 typedef void (*Ewk_Web_Application_Cache_Path_Get_Callback)(const char* path, void* user_data);
151
152 /**
153  * Callback for ewk_context_web_database_origins_get.
154  *
155  * @param origins web database origins
156  * @param user_data user_data will be passsed when ewk_context_web_database_origins_get is called
157  */
158 typedef void (*Ewk_Web_Database_Origins_Get_Callback)(Eina_List* origins, void* user_data);
159
160 /**
161  * Callback for ewk_context_web_database_quota_for_origin_get.
162  *
163  * @param quota web database quota
164  * @param user_data user_data will be passsed when ewk_context_web_database_quota_for_origin_get is called
165  */
166 typedef void (*Ewk_Web_Database_Quota_Get_Callback)(uint64_t quota, void* user_data);
167
168 /**
169  * Callback for ewk_context_web_database_usage_for_origin_get.
170  *
171  * @param usage web database usage
172  * @param user_data user_data will be passsed when ewk_context_web_database_usage_for_origin_get is called
173  */
174 typedef void (*Ewk_Web_Database_Usage_Get_Callback)(uint64_t usage, void* user_data);
175
176 /**
177  * Callback for ewk_context_web_database_path_get.
178  *
179  * @param path web database directory
180  * @param user_data user_data will be passsed when ewk_context_web_database_path_get is called
181  */
182 typedef void (*Ewk_Web_Database_Path_Get_Callback)(const char* path, void* user_data);
183
184 /**
185  * Callback for ewk_context_web_storage_origins_get.
186  *
187  * @param origins web storage origins
188  * @param user_data user_data will be passsed when ewk_context_web_storage_origins_get is called
189  */
190 typedef void (*Ewk_Web_Storage_Origins_Get_Callback)(Eina_List* origins, void* user_data);
191
192 /**
193  * Callback for ewk_context_web_storage_usage_for_origin_get.
194  *
195  * @param usage usage of web storage
196  * @param user_data user_data will be passsed when ewk_context_web_storage_usage_for_origin_get is called
197  */
198 typedef void (*Ewk_Web_Storage_Usage_Get_Callback)(uint64_t usage, void* user_data);
199
200 /**
201  * Callback for ewk_context_web_storage_path_get.
202  *
203  * @param path web storage directory
204  * @param user_data user_data will be passsed when ewk_context_web_storage_path_get is called
205  */
206 typedef void (*Ewk_Web_Storage_Path_Get_Callback)(const char* path, void* user_data);
207
208 /**
209  * Callback for didReceiveMessageFromInjectedBundle and didReceiveSynchronousMessageFromInjectedBundle
210  *
211  * User should allocate new string for return_data before setting it.
212  * The return_data string will be freed in the WebKit side.
213  *
214  * @param name name of message from injected bundle
215  * @param body body of message from injected bundle
216  * @param return_data return_data string from application
217  * @param user_data user_data will be passsed when receiving message from injected bundle
218  */
219 typedef void (*Ewk_Context_Message_From_Injected_Bundle_Callback)(const char* name, const char* body, char** return_data, void* user_data);
220
221 /**
222  * Callback for didStartDownload
223  *
224  * @param download_url url to download
225  * @param user_data user_data will be passsed when download is started
226  */
227 typedef void (*Ewk_Context_Did_Start_Download_Callback)(const char* download_url, void* user_data);
228
229 /**
230  * Requests for freeing origins.
231  *
232  * @param origins list of origins
233  *
234  * @return @c EINA_TRUE on success, @c EINA_FALSE on failure
235  */
236 EAPI Eina_Bool ewk_context_origins_free(Eina_List* origins);
237
238 /**
239  * Requests for deleting all web application caches.
240  *
241  * @param context context object
242  *
243  * @return @c EINA_TRUE on successful request or @c EINA FALSE on failure
244  */
245 EAPI Eina_Bool ewk_context_application_cache_delete_all(Ewk_Context* context);
246
247 /**
248  * Requests for deleting web application cache for origin.
249  *
250  * @param context context object
251  * @param origin application cache origin
252  *
253  * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure
254  */
255 EAPI Eina_Bool ewk_context_application_cache_delete(Ewk_Context* context, Ewk_Security_Origin* origin);
256
257 /**
258  * Requests for getting web application cache origins.
259  *
260  * @param context context object
261  * @param result_callback callback to get web application cache origins
262  * @param user_data user_data will be passsed when result_callback is called
263  *
264  * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure
265  *
266  * @see ewk_context_origins_free
267  */
268 EAPI Eina_Bool ewk_context_application_cache_origins_get(Ewk_Context* context, Ewk_Web_Application_Cache_Origins_Get_Callback callback, void* user_data);
269
270 /**
271  * Requests for setting application cache path.
272  *
273  * @param context context object
274  * @param path application cache path to set
275  *
276  * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure
277  */
278 EAPI Eina_Bool ewk_context_application_cache_path_set(Ewk_Context* context, const char* path);
279
280 /**
281  * Requests for getting application cache path.
282  *
283  * @param context context object
284  * @param callback callback to get web application cache directory
285  * @param userData will be passed when result_callback is called
286  *    -I.e., user data will be kept until callback is called
287  *
288  * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure
289  */
290 EAPI Eina_Bool ewk_context_application_cache_path_get(Ewk_Context* ewkContext, Ewk_Web_Application_Cache_Path_Get_Callback callback, void* userData);
291
292 /**
293  * Requests for getting application cache quota.
294  *
295  * @param context context object
296  * @param result_callback callback to get web database quota
297  * @param user_data user_data will be passed when result_callback is called
298  *    -I.e., user data will be kept until callback is called
299  *
300  * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure
301  */
302 EAPI Eina_Bool ewk_context_application_cache_quota_get(Ewk_Context* context, Ewk_Web_Application_Cache_Quota_Get_Callback callback, void* user_data);
303
304 /**
305  * Requests for setting application cache quota.
306  *
307  * @param context context object
308  * @param quota size of quota
309  *
310  * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure
311  */
312 EAPI Eina_Bool ewk_context_application_cache_quota_set(Ewk_Context* context, int64_t quota);
313
314 /**
315  * Requests for setting application cache quota for origin.
316  *
317  * @param context context object
318  * @param origin serucity origin
319  * @param quota size of quota
320  *
321  * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure
322  */
323 EAPI Eina_Bool ewk_context_application_cache_quota_for_origin_set(Ewk_Context* context, const Ewk_Security_Origin* origin, int64_t quota);
324
325 /**
326  * Requests for getting application cache usage for origin.
327  *
328  * @param context context object
329  * @param origin security origin
330  * @param result_callback callback to get web database usage
331  * @param user_data user_data will be passed when result_callback is called
332  *    -I.e., user data will be kept until callback is called
333  *
334  * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure
335  */
336 Eina_Bool ewk_context_application_cache_usage_for_origin_get(Ewk_Context* context, const Ewk_Security_Origin* origin, Ewk_Web_Application_Cache_Usage_For_Origin_Get_Callback callback, void* userData);
337
338 /**
339  * Requests setting of the favicon database path.
340  *
341  * @param context context object
342  * @param path database path.
343  *
344  * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure
345  */
346 EAPI Eina_Bool ewk_context_icon_database_path_set(Ewk_Context* context, const char* path);
347
348 /**
349  * Requests to get image representing the given URL.
350  *
351  * @param context context object
352  * @param url which url to query icon, must not be @c 0
353  * @param canvas evas instance where to add resulting object, must not be @c 0
354  *
355  * @return newly allocated Evas_Object instance or @c 0 on
356  *         errors. Delete the object with evas_object_del().
357  */
358 EAPI Evas_Object* ewk_context_icon_database_icon_object_add(Ewk_Context* context, const char* uri, Evas* canvas);
359
360 /**
361  * Deletes all known icons from database.
362  *
363  * @param context context object
364  */
365 EAPI void ewk_context_icon_database_delete_all(Ewk_Context* context);
366
367 /**
368  * Requests for setting local file system path.
369  *
370  * @param context context object
371  * @param path local file system path
372  *
373  * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure
374  */
375 EAPI Eina_Bool ewk_context_local_file_system_path_set(Ewk_Context* context, const char* path);
376
377 /**
378  * Requests for deleting all local file systems.
379  *
380  * @param context context object
381  *
382  * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure
383  */
384 EAPI Eina_Bool ewk_context_local_file_system_all_delete(Ewk_Context *context);
385
386 /**
387  * Requests for deleting local file system for origin.
388  *
389  * @param context context object
390  * @param origin local file system origin
391  *
392  * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure
393  */
394 EAPI Eina_Bool ewk_context_local_file_system_delete(Ewk_Context *context, Ewk_Security_Origin *origin);
395
396  /**
397  * Requests for getting local file system origins.
398  *
399  * @param context context object
400  * @param result_callback callback to get local file system origins
401  * @param user_data user_data will be passed when result_callback is called
402  *    -I.e., user data will be kept until callback is called
403  *
404  * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure
405  *
406  * @see ewk_context_origins_free
407  */
408 EAPI Eina_Bool ewk_context_local_file_system_origins_get(const Ewk_Context *context, Ewk_Local_File_System_Origins_Get_Callback callback, void *user_data);
409
410 /**
411  * Requests for getting security origin of exceeded database quota data
412  *
413  * @param exceeded_qouta data of exceeded database quota
414  *
415  * @return security origin of exceeded database quota
416  */
417 EAPI Ewk_Security_Origin* ewk_context_web_database_exceeded_quota_security_origin_get(Ewk_Context_Exceeded_Quota* exceeded_quota);
418
419 /**
420  * Requests for getting database name of exceeded database quota data
421  *
422  * @param exceeded_qouta data of exceeded database quota
423  *
424  * @return database name of exceeded database quota
425  */
426 EAPI const char* ewk_context_web_database_exceeded_quota_database_name_get(Ewk_Context_Exceeded_Quota* exceeded_quota);
427
428 /**
429  * Requests for getting display name of exceeded database quota data
430  *
431  * @param exceeded_qouta data of exceeded database quota
432  *
433  * @return display name of exceeded database quota
434  */
435 EAPI const char* ewk_context_web_database_exceeded_quota_display_name_get(Ewk_Context_Exceeded_Quota* exceeded_quota);
436
437 /*
438  * Requests for getting current quota of exceeded database quota data
439  *
440  * @param exceeded_qouta data of exceeded database quota
441  *
442  * @return current quota of exceeded database quota
443  */
444 EAPI unsigned long long ewk_context_web_database_exceeded_quota_current_quota_get(Ewk_Context_Exceeded_Quota* exceeded_quota);
445
446 /**
447  * Requests for getting current origin usage of exceeded database quota data
448  *
449  * @param exceeded_qouta data of exceeded database quota
450  *
451  * @return current origin usage of exceeded database quota
452  */
453 EAPI unsigned long long ewk_context_web_database_exceeded_quota_current_origin_usage_get(Ewk_Context_Exceeded_Quota* exceeded_quota);
454
455 /**
456  * Requests for getting current database usage of exceeded database quota data
457  *
458  * @param exceeded_qouta data of exceeded database quota
459  *
460  * @return current database usage of exceeded database quota
461  */
462 EAPI unsigned long long ewk_context_web_database_exceeded_quota_current_database_usage_get(Ewk_Context_Exceeded_Quota* exceeded_quota);
463
464 /**
465  * Requests for getting expected usage of exceeded database quota data
466  *
467  * @param exceeded_qouta data of exceeded database quota
468  *
469  * @return expected usage of exceeded database quota
470  */
471 EAPI unsigned long long ewk_context_web_database_exceeded_quota_expected_usage_get(Ewk_Context_Exceeded_Quota* exceeded_quota);
472
473 /**
474  * Requests for setting new quota of exceeded database quota data
475  *
476  * @param exceeded_qouta data of exceeded database quota
477  * @param quota new size of database quota
478  */
479 EAPI void ewk_context_web_database_exceeded_quota_new_quota_set(Ewk_Context_Exceeded_Quota* exceeded_quota, unsigned long long quota);
480
481 /**
482  * Requests for deleting all web databases.
483  *
484  * @param context context object
485  *
486  * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure
487  */
488 EAPI Eina_Bool ewk_context_web_database_delete_all(Ewk_Context* context);
489
490 /**
491  * Requests for deleting web databases for origin.
492  *
493  * @param context context object
494  * @param origin database origin
495  *
496  * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure
497  */
498 EAPI Eina_Bool ewk_context_web_database_delete(Ewk_Context* context, Ewk_Security_Origin* origin);
499
500 /**
501  * Requests for getting web database origins.
502  *
503  * @param context context object
504  * @param result_callback callback to get web database origins
505  * @param user_data user_data will be passed when result_callback is called
506  *    -I.e., user data will be kept until callback is called
507  *
508  * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure
509  *
510  * @see ewk_context_origins_free
511  */
512 EAPI Eina_Bool ewk_context_web_database_origins_get(Ewk_Context* context, Ewk_Web_Database_Origins_Get_Callback callback, void* user_data);
513
514 /**
515  * Requests for setting web database path.
516  *
517  * @param context context object
518  * @param path web database path to set
519  *
520  * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure
521  */
522 EAPI Eina_Bool ewk_context_web_database_path_set(Ewk_Context* context, const char* path);
523
524 /**
525  * Requests for getting web database path.
526  *
527  * @param context context object
528  * @param callback callback to get web database directory
529  * @param userData will be passed when result_callback is called
530  *    -I.e., user data will be kept until callback is called
531  *
532  * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure
533  */
534 EAPI Eina_Bool ewk_context_web_database_path_get(Ewk_Context* context, Ewk_Web_Database_Path_Get_Callback callback, void* user_data);
535
536 /**
537  * Requests for getting web database quota for origin.
538  *
539  * @param context context object
540  * @param result_callback callback to get web database quota
541  * @param user_data user_data will be passed when result_callback is called
542  *    -I.e., user data will be kept until callback is called
543  * @param origin database origin
544  *
545  * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure
546  */
547 EAPI Eina_Bool ewk_context_web_database_quota_for_origin_get(Ewk_Context* context, Ewk_Web_Database_Quota_Get_Callback callback, void* user_data, Ewk_Security_Origin* origin);
548
549 /**
550  * Requests for setting web database default quota.
551  *
552  * @param context context object
553  * @param quota size of quota
554  *
555  * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure
556  */
557 EAPI Eina_Bool ewk_context_web_database_default_quota_set(Ewk_Context* context, uint64_t quota);
558
559 /**
560  * Requests for setting web database quota for origin.
561  *
562  * @param context context object
563  * @param origin database origin
564  * @param quota size of quota
565  *
566  * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure
567  */
568 EAPI Eina_Bool ewk_context_web_database_quota_for_origin_set(Ewk_Context* context, Ewk_Security_Origin* origin, uint64_t quota);
569
570 /**
571  * Requests for getting web database usage for origin.
572  *
573  * @param context context object
574  * @param result_callback callback to get web database usage
575  * @param user_data user_data will be passed when result_callback is called
576  *    -I.e., user data will be kept until callback is called
577  * @param origin database origin
578  *
579  * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure
580  */
581 EAPI Eina_Bool ewk_context_web_database_usage_for_origin_get(Ewk_Context* context, Ewk_Web_Database_Usage_Get_Callback callback, void* user_data, Ewk_Security_Origin* origin);
582
583 /**
584  * Requests for deleting all web indexed databases.
585  *
586  * @param context context object
587  *
588  * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure
589  */
590 EAPI Eina_Bool ewk_context_web_indexed_database_delete_all(Ewk_Context* context);
591
592 /**
593  * Deletes all web storage.
594  *
595  * @param context context object
596  *
597  * @return @c EINA_TRUE on success, @c EINA_FALSE on failure
598  */
599 EAPI Eina_Bool ewk_context_web_storage_delete_all(Ewk_Context* context);
600
601 /**
602  * Deletes origin that is stored in web storage db.
603  *
604  * @param context context object
605  * @param origin origin of db
606  *
607  * @return @c EINA_TRUE on success, @c EINA_FALSE on failure
608  */
609 EAPI Eina_Bool ewk_context_web_storage_origin_delete(Ewk_Context* context, Ewk_Security_Origin* origin);
610
611 /**
612  * Gets list of origins that is stored in web storage db.
613  *
614  * This function allocates memory for context structure made from callback and user_data.
615  *
616  * @param context context object
617  * @param result_callback callback to get web storage origins
618  * @param user_data user_data will be passed when result_callback is called
619  *    -I.e., user data will be kept until callback is called
620  *
621  * @return @c EINA_TRUE on success, @c EINA_FALSE on failure
622  *
623  * @See ewk_context_origins_free()
624  */
625 EAPI Eina_Bool ewk_context_web_storage_origins_get(Ewk_Context* context, Ewk_Web_Storage_Origins_Get_Callback callback, void* user_data);
626
627 /**
628  * Requests for setting web storage path.
629  *
630  * @param context context object
631  * @param path web storage path to set
632  *
633  * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure
634  */
635 EAPI Eina_Bool ewk_context_web_storage_path_set(Ewk_Context* context, const char* path);
636
637 /**
638  * Requests for getting web storage path.
639  *
640  * @param context context object
641  * @param callback callback to get web storage directory
642  * @param userData will be passed when result_callback is called
643  *    -I.e., user data will be kept until callback is called
644  *
645  * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure
646  */
647 EAPI Eina_Bool ewk_context_web_storage_path_get(Ewk_Context* context, Ewk_Web_Storage_Path_Get_Callback callback, void* user_data);
648
649 /**
650  * Gets usage of web storage for certain origin.
651  *
652  * This function allocates memory for context structure made from callback and user_data.
653  *
654  * @param context context object
655  * @param origin security origin
656  * @param callback callback to get web storage usage
657  * @param user_data user_data will be passed when result_callback is called
658  *    -I.e., user data will be kept until callback is called
659  *
660  * @return @c EINA_TRUE on success, @c EINA_FALSE on failure
661  */
662 EAPI Eina_Bool ewk_context_web_storage_usage_for_origin_get(Ewk_Context* context, Ewk_Security_Origin* origin, Ewk_Web_Storage_Usage_Get_Callback callback, void* user_data);
663
664 //#if ENABLE(TIZEN_SOUP_COOKIE_CACHE_FOR_WEBKIT2)
665 /**
666  * Requests for setting soup data path(soup data include cookie and cache).
667  *
668  * @param context context object
669  * @param path soup data path to set
670  *
671  * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure
672  */
673 EAPI Eina_Bool ewk_context_soup_data_directory_set(Ewk_Context* context, const char* path);
674 //#endif
675
676 /**
677  * \enum    Ewk_Cache_Model
678  *
679  * @brief   Contains option for cache model
680  */
681 enum Ewk_Cache_Model {
682     /// Use the smallest cache capacity.
683     EWK_CACHE_MODEL_DOCUMENT_VIEWER,
684     /// Use bigger cache capacity than EWK_CACHE_MODEL_DOCUMENT_VIEWER.
685     EWK_CACHE_MODEL_DOCUMENT_BROWSER,
686     /// Use the biggest cache capacity.
687     EWK_CACHE_MODEL_PRIMARY_WEBBROWSER
688 };
689
690 /// Creates a type name for the Ewk_Cache_Model.
691 typedef enum Ewk_Cache_Model Ewk_Cache_Model;
692
693 /**
694 * Requests to set the cache model
695 *
696 * @param context context object
697 * @param model cache model
698 *
699 * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise
700 */
701 EAPI Eina_Bool ewk_context_cache_model_set(Ewk_Context* context, Ewk_Cache_Model model);
702
703 /**
704 * Returns the cache model type
705 *
706 * @param context context object
707 *
708 * @return Ewk_Cache_Model
709 */
710 EAPI Ewk_Cache_Model ewk_context_cache_model_get(Ewk_Context* context);
711
712  /**
713 * Toggles the cache enable and disable
714 *
715 * @param context context object
716 * @param enable or disable cache
717 *
718 * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise
719 */
720 EAPI Eina_Bool ewk_context_cache_disabled_set(Ewk_Context* ewkContext, Eina_Bool cacheDisabled);
721
722 /**
723 * Queries if the cache is enabled
724 *
725 * @param context context object
726 *
727 * @return @c EINA_TRUE is cache is enabled or @c EINA_FALSE otherwise
728 */
729 EAPI Eina_Bool ewk_context_cache_disabled_get(const Ewk_Context* ewkContext);
730
731 /**
732 * Request to set certifcate file
733 *
734 * @param context context object
735 * @param certificate_file is path where certificate file is stored
736 *
737 * @return @c EINA_TRUE is cache is enabled or @c EINA_FALSE otherwise
738 */
739 EAPI Eina_Bool ewk_context_certificate_file_set(Ewk_Context *context, const char *certificate_file);
740
741 /**
742 * Request to get certifcate file
743 *
744 * @param context context object
745 *
746 * @return @c certificate_file is path which is set during ewk_context_certificate_file_set or @c NULL otherwise
747 */
748 EAPI const char* ewk_context_certificate_file_get(const Ewk_Context *context);
749
750 /**
751  * Requests to clear cache
752  *
753  * @param context context object
754  *
755  * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise
756  */
757 EAPI Eina_Bool ewk_context_cache_clear(Ewk_Context* context);
758
759 /**
760  * Posts message to injected bundle.
761  *
762  * @param context context object
763  * @param name message name
764  * @param body message body
765  */
766 EAPI void ewk_context_message_post_to_injected_bundle(Ewk_Context* context, const char* name, const char* body);
767
768 /**
769  * Sets callback for received injected bundle message.
770  *
771  * @param context context object
772  * @param callback callback for received injected bundle message
773  * @param user_data user data
774  */
775 EAPI void ewk_context_message_from_injected_bundle_callback_set(Ewk_Context* context, Ewk_Context_Message_From_Injected_Bundle_Callback callback, void* user_data);
776
777 /**
778  * Sets callback for started download.
779  *
780  * @param context context object
781  * @param callback callback for started download
782  * @param user_data user data
783  */
784 EAPI void ewk_context_did_start_download_callback_set(Ewk_Context* context, Ewk_Context_Did_Start_Download_Callback callback, void* user_data);
785
786 //#if ENABLE(MEMORY_SAMPLER)
787 /**
788  * start memory sampler.
789  *
790  * @param context context object
791  * @param interval time gap to fire the timer
792 */
793 EAPI void ewk_context_memory_sampler_start(Ewk_Context* context, double timer_interval);
794
795 /**
796 * stop memory sampler.
797 *
798 * @param context context object
799 */
800 EAPI void ewk_context_memory_sampler_stop(Ewk_Context* context);
801 //#endif
802
803 /**
804  * @typedef Ewk_Url_Scheme_Request_Cb Ewk_Url_Scheme_Request_Cb
805  * @brief Callback type for use with ewk_context_url_scheme_register().
806  */
807 typedef void (*Ewk_Url_Scheme_Request_Cb) (Ewk_Url_Scheme_Request *request, void *user_data);
808
809 /**
810  * @typedef Ewk_Vibration_Client_Vibrate_Cb Ewk_Vibration_Client_Vibrate_Cb
811  * @brief Type definition for a function that will be called back when vibrate
812  * request receiveed from the vibration controller.
813  */
814 typedef void (*Ewk_Vibration_Client_Vibrate_Cb)(uint64_t vibration_time, void *user_data);
815
816 /**
817  * @typedef Ewk_Vibration_Client_Vibration_Cancel_Cb Ewk_Vibration_Client_Vibration_Cancel_Cb
818  * @brief Type definition for a function that will be called back when cancel
819  * vibration request receiveed from the vibration controller.
820  */
821 typedef void (*Ewk_Vibration_Client_Vibration_Cancel_Cb)(void *user_data);
822
823 /**
824  * @typedef Ewk_History_Navigation_Cb Ewk_History_Navigation_Cb
825  * @brief Type definition for a function that will be called back when @a view did navigation (loaded new URL).
826  */
827 typedef void (*Ewk_History_Navigation_Cb)(const Evas_Object *view, Ewk_Navigation_Data *navigation_data, void *user_data);
828
829 /**
830  * @typedef Ewk_History_Client_Redirection_Cb Ewk_History_Client_Redirection_Cb
831  * @brief Type definition for a function that will be called back when @a view performed a client redirect.
832  */
833 typedef void (*Ewk_History_Client_Redirection_Cb)(const Evas_Object *view, const char *source_url, const char *destination_url, void *user_data);
834
835 /**
836  * @typedef Ewk_History_Server_Redirection_Cb Ewk_History_Server_Redirection_Cb
837  * @brief Type definition for a function that will be called back when @a view performed a server redirect.
838  */
839 typedef void (*Ewk_History_Server_Redirection_Cb)(const Evas_Object *view, const char *source_url, const char *destination_url, void *user_data);
840
841 /**
842  * @typedef Ewk_History_Title_Update_Cb Ewk_History_Title_Update_Cb
843  * @brief Type definition for a function that will be called back when history title is updated.
844  */
845 typedef void (*Ewk_History_Title_Update_Cb)(const Evas_Object *view, const char *title, const char *url, void *user_data);
846
847 /**
848  * @typedef Ewk_Context_History_Client_Visited_Links_Populate_Cb Ewk_Context_History_Client_Visited_Links_Populate_Cb
849  * @brief Type definition for a function that will be called back when client is asked to provide visited links from a client-managed storage.
850  *
851  * @see ewk_context_visited_link_add
852  */
853 typedef void (*Ewk_History_Populate_Visited_Links_Cb)(void *user_data);
854
855 /**
856  * Increases the reference count of the given object.
857  *
858  * @param context context object to increase the reference count
859  *
860  * @return Ewk_Context object on success or @c NULL on failure
861  */
862 EAPI Ewk_Context *ewk_context_ref(Ewk_Context *context);
863
864 /**
865  * Decreases the reference count of the given object, possibly freeing it.
866  *
867  * When the reference count it's reached 0, the Ewk_Context is freed.
868  *
869  * @param context context object to decrease the reference count
870  */
871 EAPI void ewk_context_unref(Ewk_Context *context);
872
873 /**
874  * Gets default Ewk_Context instance.
875  *
876  * The returned Ewk_Context object @b should not be unref'ed if application
877  * does not call ewk_context_ref() for that.
878  *
879  * @return Ewk_Context object.
880  */
881 EAPI Ewk_Context *ewk_context_default_get(void);
882
883 /**
884  * Creates a new Ewk_Context.
885  *
886  * The returned Ewk_Context object @b should be unref'ed after use.
887  *
888  * @return Ewk_Context object on success or @c NULL on failure
889  *
890  * @see ewk_context_unref
891  * @see ewk_context_new_with_injected_bundle_path
892  */
893 EAPI Ewk_Context *ewk_context_new(void);
894
895 /**
896  * Creates a new Ewk_Context.
897  *
898  * The returned Ewk_Context object @b should be unref'ed after use.
899  *
900  * @param path path of injected bundle library
901  *
902  * @return Ewk_Context object on success or @c NULL on failure
903  *
904  * @see ewk_context_unref
905  * @see ewk_context_new
906  */
907 EAPI Ewk_Context *ewk_context_new_with_injected_bundle_path(const char *path);
908
909 /**
910  * Gets the cookie manager instance for this @a context.
911  *
912  * @param context context object to query.
913  *
914  * @return Ewk_Cookie_Manager object instance or @c NULL in case of failure.
915  */
916 EAPI Ewk_Cookie_Manager *ewk_context_cookie_manager_get(const Ewk_Context *context);
917
918 /**
919  * Gets the favicon database instance for this @a context.
920  *
921  * @param context context object to query.
922  *
923  * @return Ewk_Favicon_Database object instance or @c NULL in case of failure.
924  */
925 EAPI Ewk_Favicon_Database *ewk_context_favicon_database_get(const Ewk_Context *context);
926
927 /**
928  * Register @a scheme in @a context.
929  *
930  * When an URL request with @a scheme is made in the #Ewk_Context, the callback
931  * function provided will be called with a #Ewk_Url_Scheme_Request.
932  *
933  * It is possible to handle URL scheme requests asynchronously, by calling ewk_url_scheme_ref() on the
934  * #Ewk_Url_Scheme_Request and calling ewk_url_scheme_request_finish() later when the data of
935  * the request is available.
936  *
937  * @param context a #Ewk_Context object.
938  * @param scheme the network scheme to register
939  * @param callback the function to be called when an URL request with @a scheme is made.
940  * @param user_data data to pass to callback function
941  *
942  * @code
943  * static void about_url_scheme_request_cb(Ewk_Url_Scheme_Request *request, void *user_data)
944  * {
945  *     const char *path;
946  *     char *contents_data = NULL;
947  *     unsigned int contents_length = 0;
948  *
949  *     path = ewk_url_scheme_request_path_get(request);
950  *     if (!strcmp(path, "plugins")) {
951  *         // Initialize contents_data with the contents of plugins about page, and set its length to contents_length
952  *     } else if (!strcmp(path, "memory")) {
953  *         // Initialize contents_data with the contents of memory about page, and set its length to contents_length
954  *     } else if (!strcmp(path, "applications")) {
955  *         // Initialize contents_data with the contents of application about page, and set its length to contents_length
956  *     } else {
957  *         Eina_Strbuf *buf = eina_strbuf_new();
958  *         eina_strbuf_append_printf(buf, "&lt;html&gt;&lt;body&gt;&lt;p&gt;Invalid about:%s page&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;", path);
959  *         contents_data = eina_strbuf_string_steal(buf);
960  *         contents_length = strlen(contents);
961  *         eina_strbuf_free(buf);
962  *     }
963  *     ewk_url_scheme_request_finish(request, contents_data, contents_length, "text/html");
964  *     free(contents_data);
965  * }
966  * @endcode
967  */
968 EAPI Eina_Bool ewk_context_url_scheme_register(Ewk_Context *context, const char *scheme, Ewk_Url_Scheme_Request_Cb callback, void *user_data);
969
970 // #if ENABLE(TIZEN_SUPPORT_PLUGINS)
971 /**
972  * Sets a additional plugin directory.
973  *
974  * @param context context object
975  * @param path the directory to be set
976  *
977  * @return @c EINA_TRUE if the directory was set, @c EINA_FALSE otherwise
978  */
979 EAPI Eina_Bool ewk_context_additional_plugin_path_set(Ewk_Context *context, const char *path);
980 // #endif
981
982 /**
983  * Sets vibration client callbacks to handle the tactile feedback in the form of
984  * vibration in the client application when the content asks for vibration.
985  *
986  * To stop listening for vibration events, you may call this function with @c
987  * NULL for the callbacks.
988  *
989  * @param context context object to set vibration client callbacks.
990  * @param vibrate The function to call when the vibrate request received from the
991  *        controller (may be @c NULL).
992  * @param cancel The function to call when the cancel vibration request received
993  *        from the controller (may be @c NULL).
994  * @param data User data (may be @c NULL).
995  */
996 EAPI void ewk_context_vibration_client_callbacks_set(Ewk_Context *context, Ewk_Vibration_Client_Vibrate_Cb vibrate, Ewk_Vibration_Client_Vibration_Cancel_Cb cancel, void *data);
997
998 /**
999  * Sets history callbacks for the given @a context.
1000  *
1001  * To stop listening for history events, you may call this function with @c
1002  * NULL for the callbacks.
1003  *
1004  * @param context context object to set history callbacks
1005  * @param navigate_func The function to call when @c ewk_view did navigation (may be @c NULL).
1006  * @param client_redirect_func The function to call when @c ewk_view performed a client redirect (may be @c NULL).
1007  * @param server_redirect_func The function to call when @c ewk_view performed a server redirect (may be @c NULL).
1008  * @param title_update_func The function to call when history title is updated (may be @c NULL).
1009  * @param populate_visited_links_func The function is called when client is asked to provide visited links from a
1010  *        client-managed storage (may be @c NULL).
1011  * @param data User data (may be @c NULL).
1012  */
1013 EAPI void ewk_context_history_callbacks_set(Ewk_Context *context,
1014                                             Ewk_History_Navigation_Cb navigate_func,
1015                                             Ewk_History_Client_Redirection_Cb client_redirect_func,
1016                                             Ewk_History_Server_Redirection_Cb server_redirect_func,
1017                                             Ewk_History_Title_Update_Cb title_update_func,
1018                                             Ewk_History_Populate_Visited_Links_Cb populate_visited_links_func,
1019                                             void *data);
1020
1021 /**
1022  * Registers the given @a visited_url as visited link in @a context visited link cache.
1023  *
1024  * This function shall be invoked as a response to @c populateVisitedLinks callback of the history cient.
1025  *
1026  * @param context context object to add visited link data
1027  * @param visited_url visited url
1028  *
1029  * @see Ewk_Context_History_Client
1030  */
1031 EAPI void ewk_context_visited_link_add(Ewk_Context *context, const char *visited_url);
1032
1033 //#if ENABLE(TIZEN_WEBKIT2_MEMORY_SAVING_MODE)
1034 /**
1035  * Sets memory saving mode.
1036  *
1037  * @param context context object
1038  * @param enable or disable memory saving mode
1039  *
1040  */
1041 EAPI void ewk_context_memory_saving_mode_set(Ewk_Context *context, Eina_Bool mode);
1042 //#endif
1043
1044 //#if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
1045 /**
1046  * Clear password data
1047  *
1048  * @param context context object
1049  *
1050  */
1051 EAPI void ewk_context_form_password_data_clear(Ewk_Context* context);
1052
1053 /**
1054  * Clear candidate data
1055  *
1056  * @param context context object
1057  *
1058  */
1059 EAPI void ewk_context_form_candidate_data_clear(Ewk_Context* context);
1060 //#endif
1061
1062 //#if ENABLE(TIZEN_EXTENSIBLE_API)
1063  /**
1064  * Toggles tizen extensible api enable and disable
1065  *
1066  * @param context context object
1067  * @param extensibleAPI extensible API of every kind
1068  * @param enable enable or disable tizen extensible api
1069  *
1070  * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise
1071  */
1072 EAPI Eina_Bool ewk_context_tizen_extensible_api_set(Ewk_Context *ewkContext, Ewk_Extensible_API extensibleAPI, Eina_Bool enable);
1073 //#endif
1074
1075 //#if ENABLE(TIZEN_RESET_PATH)
1076 /**
1077  * Reset storage path such as web storage, web database, application cache and so on
1078  *
1079  * @param context context object
1080  *
1081  */
1082 EAPI void ewk_context_storage_path_reset(Ewk_Context* ewkContext);
1083 //#endif
1084
1085 #ifdef __cplusplus
1086 }
1087 #endif
1088
1089 #endif // ewk_context_h