initial import
[vuplus_webkit] / Source / WebKit / efl / ewk / 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 /**
39  * Returns the default quota for Web Database databases. By default
40  * this value is 1MB.
41  *
42  * @return the current default database quota in bytes
43  */
44 EAPI uint64_t         ewk_settings_web_database_default_quota_get(void);
45
46 /**
47  * Sets the current path to the directory WebKit will write Web
48  * Database databases.
49  *
50  * @param path the new database directory path
51  */
52 EAPI void             ewk_settings_web_database_path_set(const char *path);
53
54 /**
55  * Returns directory path where web database is stored.
56  *
57  * This is guaranteed to be eina_stringshare, so whenever possible
58  * save yourself some cpu cycles and use eina_stringshare_ref()
59  * instead of eina_stringshare_add() or strdup().
60  *
61  * @return database path or @c 0 if none or web database is not supported
62  */
63 EAPI const char      *ewk_settings_web_database_path_get(void);
64
65 /**
66  * Sets directory where to store icon database, opening or closing database.
67  *
68  * Icon database must be opened only once. If you try to set a path when the icon
69  * database is already open, this function returns @c EINA_FALSE.
70  *
71  * @param directory where to store icon database, must be
72  *        write-able, if @c 0 is given, then database is closed
73  *
74  * @return @c EINA_TRUE on success, @c EINA_FALSE on errors
75  */
76 EAPI Eina_Bool        ewk_settings_icon_database_path_set(const char *path);
77
78 /**
79  * Returns directory path where icon database is stored.
80  *
81  * This is guaranteed to be eina_stringshare, so whenever possible
82  * save yourself some cpu cycles and use eina_stringshare_ref()
83  * instead of eina_stringshare_add() or strdup().
84  *
85  * @return database path or @c 0 if none is set or database is closed
86  */
87 EAPI const char      *ewk_settings_icon_database_path_get(void);
88
89 /**
90  * Removes all known icons from database.
91  *
92  * Database must be opened with ewk_settings_icon_database_path_set()
93  * in order to work.
94  *
95  * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise, like
96  *         closed database.
97  */
98 EAPI Eina_Bool        ewk_settings_icon_database_clear(void);
99
100 /**
101  * Queries icon for given URL, returning associated cairo surface.
102  *
103  * @note In order to have this working, one must open icon database
104  *       with ewk_settings_icon_database_path_set().
105  *
106  * @param url which url to query icon
107  *
108  * @return cairo surface if any, or @c 0 on failure
109  */
110 EAPI cairo_surface_t *ewk_settings_icon_database_icon_surface_get(const char *url);
111
112 /**
113  * Creates Evas_Object of type image representing the given URL.
114  *
115  * This is an utility function that creates an Evas_Object of type
116  * image set to have fill always match object size
117  * (evas_object_image_filled_add()), saving some code to use it from Evas.
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  * @param canvas evas instance where to add resulting object
124  *
125  * @return newly allocated Evas_Object instance or @c 0 on
126  *         errors. Delete the object with evas_object_del().
127  */
128 EAPI Evas_Object     *ewk_settings_icon_database_icon_object_add(const char *url, Evas *canvas);
129
130 /**
131  * Sets cache directory.
132  *
133  * @param path where to store cache, must be write-able.
134  *
135  * @return @c EINA_TRUE on success, @c EINA_FALSE if path is NULL or offline
136  *         web application is not supported.
137  */
138 EAPI Eina_Bool        ewk_settings_cache_directory_path_set(const char *path);
139
140 /**
141  * Return cache directory path.
142  *
143  * This is guaranteed to be eina_stringshare, so whenever possible
144  * save yourself some cpu cycles and use eina_stringshare_ref()
145  * instead of eina_stringshare_add() or strdup().
146  *
147  * @return cache directory path.
148  */
149 EAPI const char      *ewk_settings_cache_directory_path_get(void);
150
151 /**
152  * Gets status of the memory cache of WebCore.
153  *
154  * @return @c EINA_TRUE if the cache is enabled or @c EINA_FALSE if not
155  */
156 EAPI Eina_Bool        ewk_settings_cache_enable_get(void);
157
158 /**
159  * Enables/disables the memory cache of WebCore, possibly clearing it.
160  *
161  * Disabling the cache will remove all resources from the cache.
162  * They may still live on if they are referenced by some Web page though.
163  *
164  * @param set @c EINA_TRUE to enable memory cache, @c EINA_FALSE to disable
165  */
166 EAPI void             ewk_settings_cache_enable_set(Eina_Bool set);
167
168 /**
169  * Sets capacity of memory cache of WebCore.
170  *
171  * WebCore sets default value of memory cache on 8192 * 1024 bytes.
172  *
173  * @param capacity the maximum number of bytes that the cache should consume overall
174  */
175 EAPI void             ewk_settings_cache_capacity_set(unsigned capacity);
176
177 /**
178  * Sets values for repaint throttling.
179  *
180  * It allows to slow down page loading and
181  * should ensure displaying a content with many css/gif animations.
182  *
183  * These values can be used as a example for repaints throttling.
184  * 0,     0,   0,    0    - default WebCore's values, these do not delay any repaints
185  * 0.025, 0,   2.5,  0.5  - recommended values for dynamic content
186  * 0.01,  0,   1,    0.2  - minimal level
187  * 0.025, 1,   5,    0.5  - medium level
188  * 0.1,   2,   10,   1    - heavy level
189  *
190  * @param deferred_repaint_delay a normal delay
191  * @param initial_deferred_repaint_delay_during_loading negative value would mean that first few repaints happen without a delay
192  * @param max_deferred_repaint_delay_during_loading the delay grows on each repaint to this maximum value
193  * @param deferred_repaint_delay_increment_during_loading on each repaint the delay increses by this amount
194  */
195 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);
196
197 /**
198  * Gets the default interval for DOMTimers on all pages.
199  *
200  * DOMTimer processes javascript function registered by setInterval() based on interval value.
201  *
202  * @return default minimum interval for DOMTimers
203  */
204 EAPI double           ewk_settings_default_timer_interval_get(void);
205
206 #ifdef __cplusplus
207 }
208 #endif
209 #endif // ewk_settings_h