summaryrefslogtreecommitdiff
path: root/Source/WebKit/efl/ewk/ewk_settings.h
blob: f290a0698c8137ea096c07d0cc2a6f1078de37c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
/*
    Copyright (C) 2009-2010 ProFUSION embedded systems
    Copyright (C) 2009-2010 Samsung Electronics
    Copyright (C) 2012 Intel Corporation

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
    License as published by the Free Software Foundation; either
    version 2 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Library General Public License for more details.

    You should have received a copy of the GNU Library General Public License
    along with this library; see the file COPYING.LIB.  If not, write to
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
    Boston, MA 02110-1301, USA.
*/

#ifndef ewk_settings_h
#define ewk_settings_h

#include <Eina.h>
#include <Evas.h>
#include <cairo.h>

#ifdef __cplusplus
extern "C" {
#endif

/**
 * @file ewk_settings.h
 *
 * @brief General purpose settings, not tied to any view object.
 */

/**
 * Returns the default quota for Web Database databases. By default
 * this value is 1MB.
 *
 * @return the current default database quota in bytes
 */
EAPI uint64_t         ewk_settings_web_database_default_quota_get(void);

/**
 * Sets the default maximum size (in bytes) an HTML5 Web Database database can have.
 *
 * By default, this value is 1MB.
 *
 * @param maximum_size the new maximum size a database is allowed
 */
EAPI void             ewk_settings_web_database_default_quota_set(uint64_t maximum_size);

/**
 * Sets the current path to the directory WebKit will write Web
 * Database databases.
 *
 * By default, the value is @c ~/.cache/WebKitEfl/Databases
 *
 * @param path the new database directory path
 */
EAPI void             ewk_settings_web_database_path_set(const char *path);

/**
 * Sets the current path to the directory where WebKit will write the
 * HTML5 local storage indexing database (the one keeping track of
 * individual views' local storage databases).
 *
 * By default, the value is @c ~/.local/share/WebKitEfl/LocalStorage
 *
 * @param path the new local storage database directory path
 *
 * @note You may want to call
 * ewk_view_setting_local_storage_database_path_set() on the same @p
 * path, here, for your views.
 */
EAPI void ewk_settings_local_storage_path_set(const char* path);

/**
 * Returns directory's path where the HTML5 local storage indexing
 * database is stored.
 *
 * This is guaranteed to be eina-stringshared, so whenever possible
 * save yourself some cpu cycles and use eina_stringshare_ref()
 * instead of eina_stringshare_add() or strdup().
 *
 * By default, the value is @c ~/.local/share/WebKitEfl/LocalStorage
 *
 * @return database path or @c NULL, on errors.
 *
 * @see ewk_settings_local_storage_path_set()
 */
EAPI const char* ewk_settings_local_storage_path_get(void);

/**
 * Removes @b all HTML 5 local storage databases.
 */
EAPI void ewk_settings_local_storage_database_clear();

/**
 * Clears the HTML 5 local storage database for the given URL
 * (origin).
 *
 * @param url which URL to clear local storage to.
 *
 * After this call, the file holding the local storage database for
 * that origin will be deleted, along with its entry on the local
 * storage files database (a file stored under the path returned by
 * ewk_settings_local_storage_path_get()).
 */
EAPI void ewk_settings_local_storage_database_origin_clear(const char *url);

/**
 * Returns directory path where web database is stored.
 *
 * By default, the value is @c ~/.cache/WebKitEfl/Databases
 *
 * This is guaranteed to be eina_stringshare, so whenever possible
 * save yourself some cpu cycles and use eina_stringshare_ref()
 * instead of eina_stringshare_add() or strdup().
 *
 * @return database path or @c NULL if none or web database is not supported
 */
EAPI const char      *ewk_settings_web_database_path_get(void);

/**
 * Sets directory where to store icon database, opening or closing database.
 *
 * Icon database must be opened only once. If you try to set a path when the icon
 * database is already open, this function returns @c EINA_FALSE.
 *
 * @param directory where to store icon database, must be
 *        write-able, if @c NULL is given, then database is closed
 *
 * @return @c EINA_TRUE on success, @c EINA_FALSE on errors
 */
EAPI Eina_Bool        ewk_settings_icon_database_path_set(const char *path);

/**
 * Returns directory path where icon database is stored.
 *
 * This is guaranteed to be eina_stringshare, so whenever possible
 * save yourself some cpu cycles and use eina_stringshare_ref()
 * instead of eina_stringshare_add() or strdup().
 *
 * @return database path or @c NULL if none is set
 */
EAPI const char      *ewk_settings_icon_database_path_get(void);

/**
 * Removes all known icons from database.
 *
 * Database must be opened with ewk_settings_icon_database_path_set()
 * in order to work.
 *
 * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise, like
 *         closed database.
 */
EAPI Eina_Bool        ewk_settings_icon_database_clear(void);

/**
 * Queries icon for given URL, returning associated cairo surface.
 *
 * @note In order to have this working, one must open icon database
 *       with ewk_settings_icon_database_path_set().
 *
 * @param url which url to query icon
 *
 * @return cairo surface if any, or @c NULL on failure
 */
EAPI cairo_surface_t *ewk_settings_icon_database_icon_surface_get(const char *url);

/**
 * Gets image representing the given URL.
 *
 * This is an utility function that creates an Evas_Object of type
 * image set to have fill always match object size
 * (evas_object_image_filled_add()), saving some code to use it from Evas.
 *
 * @note In order to have this working, one must open icon database
 *       with ewk_settings_icon_database_path_set().
 *
 * @note The "load,finished" signal doesn't guarantee that icons are completely loaded and
 *        saved to database. Icon can be taken after the "icon,received" signal.
 *
 * @param url which url to query icon
 * @param canvas evas instance where to add resulting object
 *
 * @return newly allocated Evas_Object instance or @c NULL on
 *         errors. Delete the object with evas_object_del().
 */
EAPI Evas_Object     *ewk_settings_icon_database_icon_object_get(const char *url, Evas *canvas);

/**
 * Sets the path where the application cache will be stored.
 *
 * The Offline Application Caching APIs are part of HTML5 and allow applications to store data locally that is accessed
 * when the network cannot be reached.
 *
 * By default, the path is @c ~/.cache/WebKitEfl/Applications
 * Once the path is set, the feature is enabled and the path cannot be changed.
 *
 * @param path where to store cache, must be write-able.
 *
 * @sa ewk_view_setting_application_cache_set
 */
EAPI void             ewk_settings_application_cache_path_set(const char *path);

/**
 * Returns the path where the HTML5 application cache is stored.
 *
 * The Offline Application Caching APIs are part of HTML5 and allow applications to store data locally that is accessed
 * when the network cannot be reached.
 *
 * By default, the path is @c ~/.cache/WebKitEfl/Applications
 *
 * @return eina_stringshare'd path value.
 *
 * @sa ewk_view_setting_application_cache_set
 */
EAPI const char      *ewk_settings_application_cache_path_get(void);

/**
 * Returns the maximum size, in bytes, of the application cache for HTML5 Offline Web Applications.
 *
 * By default, applications are allowed unlimited storage space.
 *
 * @sa ewk_view_setting_offine_app_cache_set
 */
EAPI int64_t          ewk_settings_application_cache_max_quota_get(void);

/**
 * Sets the maximum size, in bytes, of the application cache for HTML5 Offline Web Applications.
 *
 * By default, applications are allowed unlimited storage space.
 *
 * Note that calling this function will delete all the entries currently in the app cache.
 *
 * @param maximum_size the new maximum size, in bytes.
 *
 * @sa ewk_view_setting_application_cache_enabled_set
 */
EAPI void             ewk_settings_application_cache_max_quota_set(int64_t maximum_size);

/**
 * Removes all entries from the HTML5 application cache.
 *
 * @sa ewk_view_setting_application_cache_enabled_set, ewk_settings_application_cache_path_set
 */
EAPI void             ewk_settings_application_cache_clear(void);

/**
 * Returns whether the in-memory object cache is enabled.
 *
 * The object cache is responsible for holding resources such as scripts, stylesheets
 * and images in memory.
 *
 * By default, the cache is enabled.
 *
 * @return @c EINA_TRUE if the cache is enabled or @c EINA_FALSE if not
 *
 * @sa ewk_settings_object_cache_capacity_set
 */
EAPI Eina_Bool        ewk_settings_object_cache_enable_get(void);

/**
 * Enables/disables the in-memory object cache of WebCore, possibly clearing it.
 *
 * The object cache is responsible for holding resources such as scripts, stylesheets
 * and images in memory.
 *
 * By default, the cache is enabled.
 *
 * Disabling the cache will remove all resources from the cache.
 * They may still live on if they are referenced by some Web page though.
 *
 * @param set @c EINA_TRUE to enable memory cache, @c EINA_FALSE to disable
 */
EAPI void             ewk_settings_object_cache_enable_set(Eina_Bool set);

/**
 * Returns whether Shadow DOM is enabled.
 *
 * Shadow DOM is a method of establishing and maintaining functional boundaries between
 * DOM subtrees and how these subtrees interact with each other within a document tree,
 * thus enabling better functional encapsulation within DOM.
 *
 * By default, Shadow DOM is disabled.
 *
 * @return @c EINA_TRUE if Shadow DOM is enabled or @c EINA_FALSE if not
 *
 * @sa ewk_settings_shadow_dom_enable_set
 */
EAPI Eina_Bool    ewk_settings_shadow_dom_enable_get(void);

/**
 * Enables/disables Shadow DOM functionality.
 *
 * Shadow DOM is a method of establishing and maintaining functional boundaries between
 * DOM subtrees and how these subtrees interact with each other within a document tree,
 * thus enabling better functional encapsulation within DOM.
 *
 * By default, Shadow DOM is disabled.
 *
 * @param set @c EINA_TRUE to enable Shadow DOM, @c EINA_FALSE to disable
 */
EAPI Eina_Bool    ewk_settings_shadow_dom_enable_set(Eina_Bool enable);

/**
 * Defines the capacities for the in-memory object cache.
 *
 * The object cache is responsible for holding resources such as scripts, stylesheets
 * and images in memory.
 *
 * By default, @p min_dead_bytes is 0 and both @p max_dead_bytes and @p total_bytes are 8MB.
 *
 * @param min_dead_bytes The maximum number of bytes that dead resources should consume when
 *                       the cache is under pressure.
 * @param max_dead_bytes The maximum number of bytes that dead resources should consume when
 *                       the cache is not under pressure.
 * @param total_bytes    The maximum number of bytes that the cache should consume overall.
 *
 * @param capacity the maximum number of bytes that the cache should consume overall
 */
EAPI void             ewk_settings_object_cache_capacity_set(unsigned min_dead_bytes, unsigned max_dead_bytes, unsigned total_bytes);

/**
 * Returns the maximum number of pages in the memory page cache.
 *
 * By default, maximum number of pages is 3.
 *
 * @return  The maximum number of pages in the memory page cache.
 *
 * @sa ewk_settings_page_cache_capacity_set
 */
EAPI unsigned         ewk_settings_page_cache_capacity_get(void);

/**
 * Defines the capacity for the memory page cache.
 *
 * The page cache is responsible for holding visited web pages in memory. So it improves user experience when navigating forth or back
 * to pages in the forward/back history as the cached pages do not require to be loaded from server.
 *
 * By default, @p pages is 3.
 *
 * @param pages The maximum number of pages to keep in the memory page cache.
 */
EAPI void             ewk_settings_page_cache_capacity_set(unsigned pages);

/**
 * Clears all memory caches.
 *
 * This function clears all memory caches, which include the object cache (for resources such as
 * images, scripts and stylesheets), the page cache, the font cache and the Cross-Origin Preflight
 * cache.
 */
EAPI void             ewk_settings_memory_cache_clear(void);

/**
 * Sets values for repaint throttling.
 *
 * It allows to slow down page loading and
 * should ensure displaying a content with many css/gif animations.
 *
 * These values can be used as a example for repaints throttling.
 * 0,     0,   0,    0    - default WebCore's values, these do not delay any repaints
 * 0.025, 0,   2.5,  0.5  - recommended values for dynamic content
 * 0.01,  0,   1,    0.2  - minimal level
 * 0.025, 1,   5,    0.5  - medium level
 * 0.1,   2,   10,   1    - heavy level
 *
 * @param deferred_repaint_delay a normal delay
 * @param initial_deferred_repaint_delay_during_loading negative value would mean that first few repaints happen without a delay
 * @param max_deferred_repaint_delay_during_loading the delay grows on each repaint to this maximum value
 * @param deferred_repaint_delay_increment_during_loading on each repaint the delay increses by this amount
 */
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);

/**
 * Gets the default interval for DOMTimers on all pages.
 *
 * DOMTimer processes javascript function registered by setInterval() based on interval value.
 *
 * @return default minimum interval for DOMTimers
 */
EAPI double           ewk_settings_default_timer_interval_get(void);

/**
 * Sets the CSS media type.
 *
 * Setting this will override the normal value of the CSS media property.
 *
 * Setting the value to @c NULL will restore the internal default value.
 *
 * @param type css media type to be set, must be write-able
 *
 * @sa ewk_settings_css_media_type_get
 */
EAPI void             ewk_settings_css_media_type_set(const char *type);

/**
 * Returns the current CSS media type.
 *
 * It will only return the value set through ewk_settings_css_media_type_set and not the one used internally.
 *
 * This is guaranteed to be eina_stringshare, so whenever possible
 * save yourself some cpu cycles and use eina_stringshare_ref()
 * instead of eina_stringshare_add() or strdup().
 * 
 * @return css media type set by user or @c NULL if none is set
 *
 * @sa ewk_settings_css_media_type_set
 */
EAPI const char      *ewk_settings_css_media_type_get(void);

#ifdef __cplusplus
}
#endif
#endif // ewk_settings_h