tizen beta release
[profile/ivi/webkit-efl.git] / debian / libwebkit-engine-dev / usr / include / ewebkit-0 / ewk_settings.h
1 /*
2     Copyright (C) 2009-2010 ProFUSION embedded systems
3     Copyright (C) 2009-2010 Samsung Electronics
4
5     This library is free software; you can redistribute it and/or
6     modify it under the terms of the GNU Library General Public
7     License as published by the Free Software Foundation; either
8     version 2 of the License, or (at your option) any later version.
9
10     This library is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13     Library General Public License for more details.
14
15     You should have received a copy of the GNU Library General Public License
16     along with this library; see the file COPYING.LIB.  If not, write to
17     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18     Boston, MA 02110-1301, USA.
19 */
20
21 #ifndef ewk_settings_h
22 #define ewk_settings_h
23
24 #include <Eina.h>
25 #include <Evas.h>
26 #include <cairo.h>
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
32 /**
33  * @file ewk_settings.h
34  *
35  * @brief General purpose settings, not tied to any view object.
36  */
37
38 /* #if ENABLE(TIZEN_ORIGIN_DEL_FOR_APPCACHE) */
39 struct _Ewk_Origin {
40     const char *protocol;
41     const char *host;
42     unsigned short port;
43 };
44 /* #endif */
45
46 /* #if ENABLE(TIZEN_ORIGIN_DEL_FOR_APPCACHE) */
47 typedef struct _Ewk_Origin Ewk_Origin;
48 /* #endif */
49
50 /**
51  * Returns the default quota for Web Database databases. By default
52  * this value is 1MB.
53  *
54  * @return the current default database quota in bytes
55  */
56 EAPI uint64_t         ewk_settings_web_database_default_quota_get(void);
57
58 /**
59  * Sets the current path to the directory WebKit will write Web
60  * Database databases.
61  *
62  * By default, the value is @c ~/.webkit
63  *
64  * @param path the new database directory path
65  */
66 EAPI void             ewk_settings_web_database_path_set(const char *path);
67
68 /**
69  * Returns directory path where web database is stored.
70  *
71  * By default, the value is @c ~/.webkit
72  *
73  * This is guaranteed to be eina_stringshare, so whenever possible
74  * save yourself some cpu cycles and use eina_stringshare_ref()
75  * instead of eina_stringshare_add() or strdup().
76  *
77  * @return database path or @c 0 if none or web database is not supported
78  */
79 EAPI const char      *ewk_settings_web_database_path_get(void);
80
81 /**
82  * Sets directory where to store icon database, opening or closing database.
83  *
84  * Icon database must be opened only once. If you try to set a path when the icon
85  * database is already open, this function returns @c EINA_FALSE.
86  *
87  * @param directory where to store icon database, must be
88  *        write-able, if @c 0 is given, then database is closed
89  *
90  * @return @c EINA_TRUE on success, @c EINA_FALSE on errors
91  */
92 EAPI Eina_Bool        ewk_settings_icon_database_path_set(const char *path);
93
94 /**
95  * Returns directory path where icon database is stored.
96  *
97  * This is guaranteed to be eina_stringshare, so whenever possible
98  * save yourself some cpu cycles and use eina_stringshare_ref()
99  * instead of eina_stringshare_add() or strdup().
100  *
101  * @return database path or @c 0 if none is set or database is closed
102  */
103 EAPI const char      *ewk_settings_icon_database_path_get(void);
104
105 /**
106  * Removes all known icons from database.
107  *
108  * Database must be opened with ewk_settings_icon_database_path_set()
109  * in order to work.
110  *
111  * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise, like
112  *         closed database.
113  */
114 EAPI Eina_Bool        ewk_settings_icon_database_clear(void);
115
116 /**
117  * Queries icon for given URL, returning associated cairo surface.
118  *
119  * @note In order to have this working, one must open icon database
120  *       with ewk_settings_icon_database_path_set().
121  *
122  * @param url which url to query icon
123  *
124  * @return cairo surface if any, or @c 0 on failure
125  */
126 EAPI cairo_surface_t *ewk_settings_icon_database_icon_surface_get(const char *url);
127
128 /**
129  * Creates Evas_Object of type image representing the given URL.
130  *
131  * This is an utility function that creates an Evas_Object of type
132  * image set to have fill always match object size
133  * (evas_object_image_filled_add()), saving some code to use it from Evas.
134  *
135  * @note In order to have this working, one must open icon database
136  *       with ewk_settings_icon_database_path_set().
137  *
138  * @param url which url to query icon
139  * @param canvas evas instance where to add resulting object
140  *
141  * @return newly allocated Evas_Object instance or @c 0 on
142  *         errors. Delete the object with evas_object_del().
143  */
144 EAPI Evas_Object     *ewk_settings_icon_database_icon_object_add(const char *url, Evas *canvas);
145
146 /* Deprecated.
147  *
148  * This API is moved to ewk_network.h
149  * Please use ewk_network_proxy_uri_set(const char* proxy)
150  */
151 EAPI void            ewk_settings_proxy_uri_set(const char* proxy);
152 EAPI const char*     ewk_settings_proxy_uri_get();
153
154 /**
155  * Sets the path where the application cache will be stored.
156  *
157  * The Offline Application Caching APIs are part of HTML5 and allow applications to store data locally that is accessed
158  * when the network cannot be reached.
159  *
160  * By default, the path is @c ~/.webkit.
161  *
162  * @param path where to store cache, must be write-able.
163  *
164  * @sa ewk_view_setting_application_cache_set
165  */
166 EAPI void             ewk_settings_application_cache_path_set(const char *path);
167
168 /**
169  * Returns the path where the HTML5 application cache is stored.
170  *
171  * The Offline Application Caching APIs are part of HTML5 and allow applications to store data locally that is accessed
172  * when the network cannot be reached.
173  *
174  * By default, the path is @c ~/.webkit.
175  *
176  * @return eina_stringshare'd path value.
177  *
178  * @sa ewk_view_setting_application_cache_set
179  */
180 EAPI const char      *ewk_settings_application_cache_path_get(void);
181
182 /* #if ENABLE(TIZEN_ORIGIN_DEL_FOR_APPCACHE) */
183 /**
184  * Returns list of origins that is stored in cache db.
185  *
186  * @return list of origins.
187  */
188 EAPI Eina_List       *ewk_settings_appcache_origins_get(void);
189 /* #endif */
190
191 /* #if ENABLE(TIZEN_ORIGIN_DEL_FOR_APPCACHE) */
192 /**
193  * Deletes origin that is stored in appcache db.
194  *
195  * @param origin db origin.
196  *
197  */
198 EAPI void             ewk_settings_appcache_origin_delete(Ewk_Origin *origin);
199 /* #endif */
200
201 /* #if ENABLE(TIZEN_ORIGIN_DEL_FOR_APPCACHE) */
202 /**
203  * Returns db size of an origin that is stored in appcache db.
204  *
205  * @param origin db origin.
206  *
207  * @return size of db in bytes.
208  *
209  */
210 EAPI long long        ewk_settings_appcache_size_get(Ewk_Origin *origin);
211 /* #endif */
212
213 /* #if ENABLE(DOM_STORAGE) && ENABLE(TIZEN_ORIGIN_DEL_FOR_WEBSTORAGE) */
214 /**
215  * Sets web storage db path.
216  *
217  * @param path absolute path where to store web storage db, must be write-able.
218  *
219  * @return @c EINA_TRUE on success, @c EINA_FALSE if path is NULL or
220  *         web storage is not supported.
221  */
222 EAPI Eina_Bool        ewk_settings_web_storage_path_set(const char *path);
223 /* #endif */
224
225 /* #if ENABLE(DOM_STORAGE) && ENABLE(TIZEN_ORIGIN_DEL_FOR_WEBSTORAGE) */
226 /**
227  * Returns web storage db path.
228  *
229  * @return web storage db path.
230  */
231 EAPI const char      *ewk_settings_web_storage_path_get(void);
232 /* #endif */
233
234 /* #if ENABLE(DOM_STORAGE) && ENABLE(TIZEN_ORIGIN_DEL_FOR_WEBSTORAGE) */
235 /**
236  * Returns list of origin that is stored to web storage db.
237  *
238  * @return list of origin.
239  */
240 EAPI Eina_List       *ewk_settings_web_storage_origins_get(void);
241 /* #endif */
242
243 /* #if ENABLE(DOM_STORAGE) && ENABLE(TIZEN_ORIGIN_DEL_FOR_WEBSTORAGE) */
244 /**
245  * Deletes origin that is stored to web storage db.
246  *
247  * @param origin origin of db.
248  *
249  */
250 EAPI void             ewk_settings_web_storage_origin_delete(Ewk_Origin *origin);
251 /* #endif */
252
253 /* #if ENABLE(DOM_STORAGE) && ENABLE(TIZEN_ORIGIN_DEL_FOR_WEBSTORAGE) */
254 /**
255  * Returns size of db that is stored to web storage db.
256  *
257  * @param origin origin of db.
258  *
259  * @return size of db in bytes.
260  *
261  */
262 EAPI long long        ewk_settings_web_storage_size_get(Ewk_Origin *origin);
263 /* #endif */
264
265 /* #if ENABLE(TIZEN_ORIGIN_DEL_FOR_APPCACHE) || ENABLE(TIZEN_ORIGIN_DEL_FOR_WEBSTORAGE) */
266 /**
267  * Frees origins allocated by get method of ewk_settings.
268  *
269  * @param origins list of origin that is stored to db.
270  *
271  */
272 EAPI void             ewk_settings_origins_free(Eina_List *origins);
273 /* #endif */
274
275 EAPI void             ewk_settings_proxy_uri_set(const char* proxy);
276 EAPI const char*      ewk_settings_proxy_uri_get(void);
277
278 /* Deprecated.
279  *
280  * This API is moved to ewk_network.h
281  * Please use ewk_network_http_request_append(const char* proxy)
282  */
283 EAPI void            ewk_settings_http_request_append(const char* name, const char* value);
284
285 /**
286  * Returns the maximum size, in bytes, of the application cache for HTML5 Offline Web Applications.
287  *
288  * By default, applications are allowed unlimited storage space.
289  *
290  * @sa ewk_view_setting_offine_app_cache_set
291  */
292 EAPI int64_t          ewk_settings_application_cache_max_quota_get(void);
293
294 /**
295  * Sets the maximum size, in bytes, of the application cache for HTML5 Offline Web Applications.
296  *
297  * By default, applications are allowed unlimited storage space.
298  *
299  * Note that calling this function will delete all the entries currently in the app cache.
300  *
301  * @param maximum_size the new maximum size, in bytes.
302  *
303  * @sa ewk_view_setting_application_cache_enabled_set
304  */
305 EAPI void             ewk_settings_application_cache_max_quota_set(int64_t maximum_size);
306
307 /**
308  * Removes all entries from the HTML5 application cache.
309  *
310  * @sa ewk_view_setting_application_cache_enabled_set, ewk_settings_application_cache_path_set
311  */
312 EAPI void             ewk_settings_application_cache_clear(void);
313
314 /**
315  * Gets status of the memory cache of WebCore.
316  *
317  * @return @c EINA_TRUE if the cache is enabled or @c EINA_FALSE if not
318  */
319 EAPI Eina_Bool        ewk_settings_cache_enable_get(void);
320
321 /**
322  * Enables/disables the memory cache of WebCore, possibly clearing it.
323  *
324  * Disabling the cache will remove all resources from the cache.
325  * They may still live on if they are referenced by some Web page though.
326  *
327  * @param set @c EINA_TRUE to enable memory cache, @c EINA_FALSE to disable
328  */
329 EAPI void             ewk_settings_cache_enable_set(Eina_Bool set);
330
331 /**
332  * Sets capacity of memory cache of WebCore.
333  *
334  * WebCore sets default value of memory cache on 8192 * 1024 bytes.
335  *
336  * @param capacity the maximum number of bytes that the cache should consume overall
337  */
338 EAPI void             ewk_settings_cache_capacity_set(unsigned capacity);
339
340 /**
341  * Clears all memory caches.
342  *
343  * This function clears all memory caches, which include the object cache (for resources such as
344  * images, scripts and stylesheets), the page cache, the font cache and the Cross-Origin Preflight
345  * cache.
346  */
347 EAPI void             ewk_settings_memory_cache_clear(void);
348
349 /**
350  * Sets values for repaint throttling.
351  *
352  * It allows to slow down page loading and
353  * should ensure displaying a content with many css/gif animations.
354  *
355  * These values can be used as a example for repaints throttling.
356  * 0,     0,   0,    0    - default WebCore's values, these do not delay any repaints
357  * 0.025, 0,   2.5,  0.5  - recommended values for dynamic content
358  * 0.01,  0,   1,    0.2  - minimal level
359  * 0.025, 1,   5,    0.5  - medium level
360  * 0.1,   2,   10,   1    - heavy level
361  *
362  * @param deferred_repaint_delay a normal delay
363  * @param initial_deferred_repaint_delay_during_loading negative value would mean that first few repaints happen without a delay
364  * @param max_deferred_repaint_delay_during_loading the delay grows on each repaint to this maximum value
365  * @param deferred_repaint_delay_increment_during_loading on each repaint the delay increses by this amount
366  */
367 EAPI void             ewk_settings_repaint_throttling_set(double deferred_repaint_delay, double initial_deferred_repaint_delay_during_loading, double max_deferred_repaint_delay_during_loading, double deferred_repaint_delay_increment_during_loading);
368
369 /**
370  * Gets the default interval for DOMTimers on all pages.
371  *
372  * DOMTimer processes javascript function registered by setInterval() based on interval value.
373  *
374  * @return default minimum interval for DOMTimers
375  */
376 EAPI double           ewk_settings_default_timer_interval_get(void);
377
378 #ifdef __cplusplus
379 }
380 #endif
381 #endif // ewk_settings_h