[WebKit2] [GTK] Add API for controlling the user agent
[WebKit-https.git] / Source / WebKit2 / UIProcess / API / gtk / WebKitSettings.cpp
1 /*
2  * Copyright (c) 2011 Motorola Mobility, Inc.  All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without modification,
5  * are permitted provided that the following conditions are met:
6  *
7  * Redistributions of source code must retain the above copyright notice,
8  * this list of conditions and the following disclaimer.
9  *
10  * Redistributions in binary form must reproduce the above copyright notice,
11  * this list of conditions and the following disclaimer in the documentation and/or
12  * other materials provided with the distribution.
13  *
14  * Neither the name of Motorola Mobility, Inc. nor the names of its contributors may
15  * be used to endorse or promote products derived from this software without
16  * specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
20  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
22  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
26  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  */
30
31 #include "config.h"
32 #include "WebKitSettings.h"
33
34 #include "WebKitPrivate.h"
35 #include "WebKitSettingsPrivate.h"
36 #include "WebPageProxy.h"
37 #include <WebCore/UserAgentGtk.h>
38 #include <glib/gi18n-lib.h>
39 #include <wtf/text/CString.h>
40
41 struct _WebKitSettingsPrivate {
42     WKRetainPtr<WKPreferencesRef> preferences;
43     CString defaultFontFamily;
44     CString monospaceFontFamily;
45     CString serifFontFamily;
46     CString sansSerifFontFamily;
47     CString cursiveFontFamily;
48     CString fantasyFontFamily;
49     CString pictographFontFamily;
50     CString defaultCharset;
51     CString userAgent;
52     bool allowModalDialogs;
53     bool zoomTextOnly;
54 };
55
56 /**
57  * SECTION:WebKitSettings
58  * @short_description: Control the behaviour of a #WebKitWebView
59  *
60  * #WebKitSettings can be applied to a #WebKitWebView to control text charset,
61  * color, font sizes, printing mode, script support, loading of images and various other things.
62  * After creation, a #WebKitSettings object contains default settings.
63  *
64  * <informalexample><programlisting>
65  * /<!-- -->* Create a new #WebKitSettings and disable JavaScript. *<!-- -->/
66  * WebKitSettings *settings = webkit_settings_new ();
67  * g_object_set (G_OBJECT (settings), "enable-javascript", FALSE, NULL);
68  *
69  * webkit_web_view_set_settings (WEBKIT_WEB_VIEW (my_webview), settings);
70  * </programlisting></informalexample>
71  */
72
73
74 G_DEFINE_TYPE(WebKitSettings, webkit_settings, G_TYPE_OBJECT)
75
76 enum {
77     PROP_0,
78
79     PROP_ENABLE_JAVASCRIPT,
80     PROP_AUTO_LOAD_IMAGES,
81     PROP_LOAD_ICONS_IGNORING_IMAGE_LOAD_SETTING,
82     PROP_ENABLE_OFFLINE_WEB_APPLICATION_CACHE,
83     PROP_ENABLE_HTML5_LOCAL_STORAGE,
84     PROP_ENABLE_HTML5_DATABASE,
85     PROP_ENABLE_XSS_AUDITOR,
86     PROP_ENABLE_FRAME_FLATTENING,
87     PROP_ENABLE_PLUGINS,
88     PROP_ENABLE_JAVA,
89     PROP_JAVASCRIPT_CAN_OPEN_WINDOWS_AUTOMATICALLY,
90     PROP_ENABLE_HYPERLINK_AUDITING,
91     PROP_DEFAULT_FONT_FAMILY,
92     PROP_MONOSPACE_FONT_FAMILY,
93     PROP_SERIF_FONT_FAMILY,
94     PROP_SANS_SERIF_FONT_FAMILY,
95     PROP_CURSIVE_FONT_FAMILY,
96     PROP_FANTASY_FONT_FAMILY,
97     PROP_PICTOGRAPH_FONT_FAMILY,
98     PROP_DEFAULT_FONT_SIZE,
99     PROP_DEFAULT_MONOSPACE_FONT_SIZE,
100     PROP_MINIMUM_FONT_SIZE,
101     PROP_DEFAULT_CHARSET,
102     PROP_ENABLE_PRIVATE_BROWSING,
103     PROP_ENABLE_DEVELOPER_EXTRAS,
104     PROP_ENABLE_RESIZABLE_TEXT_AREAS,
105     PROP_ENABLE_TABS_TO_LINKS,
106     PROP_ENABLE_DNS_PREFETCHING,
107     PROP_ENABLE_CARET_BROWSING,
108     PROP_ENABLE_FULLSCREEN,
109     PROP_PRINT_BACKGROUNDS,
110     PROP_ENABLE_WEBAUDIO,
111     PROP_ENABLE_WEBGL,
112     PROP_ALLOW_MODAL_DIALOGS,
113     PROP_ZOOM_TEXT_ONLY,
114     PROP_JAVASCRIPT_CAN_ACCESS_CLIPBOARD,
115     PROP_MEDIA_PLAYBACK_REQUIRES_USER_GESTURE,
116     PROP_MEDIA_PLAYBACK_ALLOWS_INLINE,
117     PROP_DRAW_COMPOSITING_INDICATORS,
118     PROP_ENABLE_SITE_SPECIFIC_QUIRKS,
119     PROP_ENABLE_PAGE_CACHE,
120     PROP_USER_AGENT
121 };
122
123 static void webKitSettingsSetProperty(GObject* object, guint propId, const GValue* value, GParamSpec* paramSpec)
124 {
125     WebKitSettings* settings = WEBKIT_SETTINGS(object);
126
127     switch (propId) {
128     case PROP_ENABLE_JAVASCRIPT:
129         webkit_settings_set_enable_javascript(settings, g_value_get_boolean(value));
130         break;
131     case PROP_AUTO_LOAD_IMAGES:
132         webkit_settings_set_auto_load_images(settings, g_value_get_boolean(value));
133         break;
134     case PROP_LOAD_ICONS_IGNORING_IMAGE_LOAD_SETTING:
135         webkit_settings_set_load_icons_ignoring_image_load_setting(settings, g_value_get_boolean(value));
136         break;
137     case PROP_ENABLE_OFFLINE_WEB_APPLICATION_CACHE:
138         webkit_settings_set_enable_offline_web_application_cache(settings, g_value_get_boolean(value));
139         break;
140     case PROP_ENABLE_HTML5_LOCAL_STORAGE:
141         webkit_settings_set_enable_html5_local_storage(settings, g_value_get_boolean(value));
142         break;
143     case PROP_ENABLE_HTML5_DATABASE:
144         webkit_settings_set_enable_html5_database(settings, g_value_get_boolean(value));
145         break;
146     case PROP_ENABLE_XSS_AUDITOR:
147         webkit_settings_set_enable_xss_auditor(settings, g_value_get_boolean(value));
148         break;
149     case PROP_ENABLE_FRAME_FLATTENING:
150         webkit_settings_set_enable_frame_flattening(settings, g_value_get_boolean(value));
151         break;
152     case PROP_ENABLE_PLUGINS:
153         webkit_settings_set_enable_plugins(settings, g_value_get_boolean(value));
154         break;
155     case PROP_ENABLE_JAVA:
156         webkit_settings_set_enable_java(settings, g_value_get_boolean(value));
157         break;
158     case PROP_JAVASCRIPT_CAN_OPEN_WINDOWS_AUTOMATICALLY:
159         webkit_settings_set_javascript_can_open_windows_automatically(settings, g_value_get_boolean(value));
160         break;
161     case PROP_ENABLE_HYPERLINK_AUDITING:
162         webkit_settings_set_enable_hyperlink_auditing(settings, g_value_get_boolean(value));
163         break;
164     case PROP_DEFAULT_FONT_FAMILY:
165         webkit_settings_set_default_font_family(settings, g_value_get_string(value));
166         break;
167     case PROP_MONOSPACE_FONT_FAMILY:
168         webkit_settings_set_monospace_font_family(settings, g_value_get_string(value));
169         break;
170     case PROP_SERIF_FONT_FAMILY:
171         webkit_settings_set_serif_font_family(settings, g_value_get_string(value));
172         break;
173     case PROP_SANS_SERIF_FONT_FAMILY:
174         webkit_settings_set_sans_serif_font_family(settings, g_value_get_string(value));
175         break;
176     case PROP_CURSIVE_FONT_FAMILY:
177         webkit_settings_set_cursive_font_family(settings, g_value_get_string(value));
178         break;
179     case PROP_FANTASY_FONT_FAMILY:
180         webkit_settings_set_fantasy_font_family(settings, g_value_get_string(value));
181         break;
182     case PROP_PICTOGRAPH_FONT_FAMILY:
183         webkit_settings_set_pictograph_font_family(settings, g_value_get_string(value));
184         break;
185     case PROP_DEFAULT_FONT_SIZE:
186         webkit_settings_set_default_font_size(settings, g_value_get_uint(value));
187         break;
188     case PROP_DEFAULT_MONOSPACE_FONT_SIZE:
189         webkit_settings_set_default_monospace_font_size(settings, g_value_get_uint(value));
190         break;
191     case PROP_MINIMUM_FONT_SIZE:
192         webkit_settings_set_minimum_font_size(settings, g_value_get_uint(value));
193         break;
194     case PROP_DEFAULT_CHARSET:
195         webkit_settings_set_default_charset(settings, g_value_get_string(value));
196         break;
197     case PROP_ENABLE_PRIVATE_BROWSING:
198         webkit_settings_set_enable_private_browsing(settings, g_value_get_boolean(value));
199         break;
200     case PROP_ENABLE_DEVELOPER_EXTRAS:
201         webkit_settings_set_enable_developer_extras(settings, g_value_get_boolean(value));
202         break;
203     case PROP_ENABLE_RESIZABLE_TEXT_AREAS:
204         webkit_settings_set_enable_resizable_text_areas(settings, g_value_get_boolean(value));
205         break;
206     case PROP_ENABLE_TABS_TO_LINKS:
207         webkit_settings_set_enable_tabs_to_links(settings, g_value_get_boolean(value));
208         break;
209     case PROP_ENABLE_DNS_PREFETCHING:
210         webkit_settings_set_enable_dns_prefetching(settings, g_value_get_boolean(value));
211         break;
212     case PROP_ENABLE_CARET_BROWSING:
213         webkit_settings_set_enable_caret_browsing(settings, g_value_get_boolean(value));
214         break;
215     case PROP_ENABLE_FULLSCREEN:
216         webkit_settings_set_enable_fullscreen(settings, g_value_get_boolean(value));
217         break;
218     case PROP_PRINT_BACKGROUNDS:
219         webkit_settings_set_print_backgrounds(settings, g_value_get_boolean(value));
220         break;
221     case PROP_ENABLE_WEBAUDIO:
222         webkit_settings_set_enable_webaudio(settings, g_value_get_boolean(value));
223         break;
224     case PROP_ENABLE_WEBGL:
225         webkit_settings_set_enable_webgl(settings, g_value_get_boolean(value));
226         break;
227     case PROP_ALLOW_MODAL_DIALOGS:
228         webkit_settings_set_allow_modal_dialogs(settings, g_value_get_boolean(value));
229         break;
230     case PROP_ZOOM_TEXT_ONLY:
231         webkit_settings_set_zoom_text_only(settings, g_value_get_boolean(value));
232         break;
233     case PROP_JAVASCRIPT_CAN_ACCESS_CLIPBOARD:
234         webkit_settings_set_javascript_can_access_clipboard(settings, g_value_get_boolean(value));
235         break;
236     case PROP_MEDIA_PLAYBACK_REQUIRES_USER_GESTURE:
237         webkit_settings_set_media_playback_requires_user_gesture(settings, g_value_get_boolean(value));
238         break;
239     case PROP_MEDIA_PLAYBACK_ALLOWS_INLINE:
240         webkit_settings_set_media_playback_allows_inline(settings, g_value_get_boolean(value));
241         break;
242     case PROP_DRAW_COMPOSITING_INDICATORS:
243         webkit_settings_set_draw_compositing_indicators(settings, g_value_get_boolean(value));
244         break;
245     case PROP_ENABLE_SITE_SPECIFIC_QUIRKS:
246         webkit_settings_set_enable_site_specific_quirks(settings, g_value_get_boolean(value));
247         break;
248     case PROP_ENABLE_PAGE_CACHE:
249         webkit_settings_set_enable_page_cache(settings, g_value_get_boolean(value));
250         break;
251     case PROP_USER_AGENT:
252         webkit_settings_set_user_agent(settings, g_value_get_string(value));
253         break;
254     default:
255         G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, paramSpec);
256         break;
257     }
258 }
259
260 static void webKitSettingsGetProperty(GObject* object, guint propId, GValue* value, GParamSpec* paramSpec)
261 {
262     WebKitSettings* settings = WEBKIT_SETTINGS(object);
263
264     switch (propId) {
265     case PROP_ENABLE_JAVASCRIPT:
266         g_value_set_boolean(value, webkit_settings_get_enable_javascript(settings));
267         break;
268     case PROP_AUTO_LOAD_IMAGES:
269         g_value_set_boolean(value, webkit_settings_get_auto_load_images(settings));
270         break;
271     case PROP_LOAD_ICONS_IGNORING_IMAGE_LOAD_SETTING:
272         g_value_set_boolean(value, webkit_settings_get_load_icons_ignoring_image_load_setting(settings));
273         break;
274     case PROP_ENABLE_OFFLINE_WEB_APPLICATION_CACHE:
275         g_value_set_boolean(value, webkit_settings_get_enable_offline_web_application_cache(settings));
276         break;
277     case PROP_ENABLE_HTML5_LOCAL_STORAGE:
278         g_value_set_boolean(value, webkit_settings_get_enable_html5_local_storage(settings));
279         break;
280     case PROP_ENABLE_HTML5_DATABASE:
281         g_value_set_boolean(value, webkit_settings_get_enable_html5_database(settings));
282         break;
283     case PROP_ENABLE_XSS_AUDITOR:
284         g_value_set_boolean(value, webkit_settings_get_enable_xss_auditor(settings));
285         break;
286     case PROP_ENABLE_FRAME_FLATTENING:
287         g_value_set_boolean(value, webkit_settings_get_enable_frame_flattening(settings));
288         break;
289     case PROP_ENABLE_PLUGINS:
290         g_value_set_boolean(value, webkit_settings_get_enable_plugins(settings));
291         break;
292     case PROP_ENABLE_JAVA:
293         g_value_set_boolean(value, webkit_settings_get_enable_java(settings));
294         break;
295     case PROP_JAVASCRIPT_CAN_OPEN_WINDOWS_AUTOMATICALLY:
296         g_value_set_boolean(value, webkit_settings_get_javascript_can_open_windows_automatically(settings));
297         break;
298     case PROP_ENABLE_HYPERLINK_AUDITING:
299         g_value_set_boolean(value, webkit_settings_get_enable_hyperlink_auditing(settings));
300         break;
301     case PROP_DEFAULT_FONT_FAMILY:
302         g_value_set_string(value, webkit_settings_get_default_font_family(settings));
303         break;
304     case PROP_MONOSPACE_FONT_FAMILY:
305         g_value_set_string(value, webkit_settings_get_monospace_font_family(settings));
306         break;
307     case PROP_SERIF_FONT_FAMILY:
308         g_value_set_string(value, webkit_settings_get_serif_font_family(settings));
309         break;
310     case PROP_SANS_SERIF_FONT_FAMILY:
311         g_value_set_string(value, webkit_settings_get_sans_serif_font_family(settings));
312         break;
313     case PROP_CURSIVE_FONT_FAMILY:
314         g_value_set_string(value, webkit_settings_get_cursive_font_family(settings));
315         break;
316     case PROP_FANTASY_FONT_FAMILY:
317         g_value_set_string(value, webkit_settings_get_fantasy_font_family(settings));
318         break;
319     case PROP_PICTOGRAPH_FONT_FAMILY:
320         g_value_set_string(value, webkit_settings_get_pictograph_font_family(settings));
321         break;
322     case PROP_DEFAULT_FONT_SIZE:
323         g_value_set_uint(value, webkit_settings_get_default_font_size(settings));
324         break;
325     case PROP_DEFAULT_MONOSPACE_FONT_SIZE:
326         g_value_set_uint(value, webkit_settings_get_default_monospace_font_size(settings));
327         break;
328     case PROP_MINIMUM_FONT_SIZE:
329         g_value_set_uint(value, webkit_settings_get_minimum_font_size(settings));
330         break;
331     case PROP_DEFAULT_CHARSET:
332         g_value_set_string(value, webkit_settings_get_default_charset(settings));
333         break;
334     case PROP_ENABLE_PRIVATE_BROWSING:
335         g_value_set_boolean(value, webkit_settings_get_enable_private_browsing(settings));
336         break;
337     case PROP_ENABLE_DEVELOPER_EXTRAS:
338         g_value_set_boolean(value, webkit_settings_get_enable_developer_extras(settings));
339         break;
340     case PROP_ENABLE_RESIZABLE_TEXT_AREAS:
341         g_value_set_boolean(value, webkit_settings_get_enable_resizable_text_areas(settings));
342         break;
343     case PROP_ENABLE_TABS_TO_LINKS:
344         g_value_set_boolean(value, webkit_settings_get_enable_tabs_to_links(settings));
345         break;
346     case PROP_ENABLE_DNS_PREFETCHING:
347         g_value_set_boolean(value, webkit_settings_get_enable_dns_prefetching(settings));
348         break;
349     case PROP_ENABLE_CARET_BROWSING:
350         g_value_set_boolean(value, webkit_settings_get_enable_caret_browsing(settings));
351         break;
352     case PROP_ENABLE_FULLSCREEN:
353         g_value_set_boolean(value, webkit_settings_get_enable_fullscreen(settings));
354         break;
355     case PROP_PRINT_BACKGROUNDS:
356         g_value_set_boolean(value, webkit_settings_get_print_backgrounds(settings));
357         break;
358     case PROP_ENABLE_WEBAUDIO:
359         g_value_set_boolean(value, webkit_settings_get_enable_webaudio(settings));
360         break;
361     case PROP_ENABLE_WEBGL:
362         g_value_set_boolean(value, webkit_settings_get_enable_webgl(settings));
363         break;
364     case PROP_ALLOW_MODAL_DIALOGS:
365         g_value_set_boolean(value, webkit_settings_get_allow_modal_dialogs(settings));
366         break;
367     case PROP_ZOOM_TEXT_ONLY:
368         g_value_set_boolean(value, webkit_settings_get_zoom_text_only(settings));
369         break;
370     case PROP_JAVASCRIPT_CAN_ACCESS_CLIPBOARD:
371         g_value_set_boolean(value, webkit_settings_get_javascript_can_access_clipboard(settings));
372         break;
373     case PROP_MEDIA_PLAYBACK_REQUIRES_USER_GESTURE:
374         g_value_set_boolean(value, webkit_settings_get_media_playback_requires_user_gesture(settings));
375         break;
376     case PROP_MEDIA_PLAYBACK_ALLOWS_INLINE:
377         g_value_set_boolean(value, webkit_settings_get_media_playback_allows_inline(settings));
378         break;
379     case PROP_DRAW_COMPOSITING_INDICATORS:
380         g_value_set_boolean(value, webkit_settings_get_draw_compositing_indicators(settings));
381         break;
382     case PROP_ENABLE_SITE_SPECIFIC_QUIRKS:
383         g_value_set_boolean(value, webkit_settings_get_enable_site_specific_quirks(settings));
384         break;
385     case PROP_ENABLE_PAGE_CACHE:
386         g_value_set_boolean(value, webkit_settings_get_enable_page_cache(settings));
387         break;
388     case PROP_USER_AGENT:
389         g_value_set_string(value, webkit_settings_get_user_agent(settings));
390         break;
391     default:
392         G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, paramSpec);
393         break;
394     }
395 }
396
397 static void webKitSettingsFinalize(GObject* object)
398 {
399     WEBKIT_SETTINGS(object)->priv->~WebKitSettingsPrivate();
400     G_OBJECT_CLASS(webkit_settings_parent_class)->finalize(object);
401 }
402
403 static void webkit_settings_class_init(WebKitSettingsClass* klass)
404 {
405     GObjectClass* gObjectClass = G_OBJECT_CLASS(klass);
406     gObjectClass->set_property = webKitSettingsSetProperty;
407     gObjectClass->get_property = webKitSettingsGetProperty;
408     gObjectClass->finalize = webKitSettingsFinalize;
409
410     GParamFlags readWriteConstructParamFlags = static_cast<GParamFlags>(WEBKIT_PARAM_READWRITE | G_PARAM_CONSTRUCT);
411
412     /**
413      * WebKitSettings:enable-javascript:
414      *
415      * Determines whether or not JavaScript executes within a page.
416      */
417     g_object_class_install_property(gObjectClass,
418                                     PROP_ENABLE_JAVASCRIPT,
419                                     g_param_spec_boolean("enable-javascript",
420                                                          _("Enable JavaScript"),
421                                                          _("Enable JavaScript."),
422                                                          TRUE,
423                                                          readWriteConstructParamFlags));
424
425     /**
426      * WebKitSettings:auto-load-images:
427      *
428      * Determines whether images should be automatically loaded or not.
429      * On devices where network bandwidth is of concern, it might be
430      * useful to turn this property off.
431      */
432     g_object_class_install_property(gObjectClass,
433                                     PROP_AUTO_LOAD_IMAGES,
434                                     g_param_spec_boolean("auto-load-images",
435                                                          _("Auto load images"),
436                                                          _("Load images automatically."),
437                                                          TRUE,
438                                                          readWriteConstructParamFlags));
439
440     /**
441      * WebKitSettings:load-icons-ignoring-image-load-setting:
442      *
443      * Determines whether a site can load favicons irrespective
444      * of the value of #WebKitSettings:auto-load-images.
445      */
446     g_object_class_install_property(gObjectClass,
447                                     PROP_LOAD_ICONS_IGNORING_IMAGE_LOAD_SETTING,
448                                     g_param_spec_boolean("load-icons-ignoring-image-load-setting",
449                                                          _("Load icons ignoring image load setting"),
450                                                          _("Whether to load site icons ignoring image load setting."),
451                                                          FALSE,
452                                                          readWriteConstructParamFlags));
453
454     /**
455      * WebKitSettings:enable-offline-web-application-cache:
456      *
457      * Whether to enable HTML5 offline web application cache support. Offline
458      * web application cache allows web applications to run even when
459      * the user is not connected to the network.
460      *
461      * HTML5 offline web application specification is available at
462      * http://dev.w3.org/html5/spec/offline.html.
463      */
464     g_object_class_install_property(gObjectClass,
465                                     PROP_ENABLE_OFFLINE_WEB_APPLICATION_CACHE,
466                                     g_param_spec_boolean("enable-offline-web-application-cache",
467                                                          _("Enable offline web application cache"),
468                                                          _("Whether to enable offline web application cache."),
469                                                          TRUE,
470                                                          readWriteConstructParamFlags));
471
472     /**
473      * WebKitSettings:enable-html5-local-storage:
474      *
475      * Whether to enable HTML5 local storage support. Local storage provides
476      * simple synchronous storage access.
477      *
478      * HTML5 local storage specification is available at
479      * http://dev.w3.org/html5/webstorage/.
480      */
481     g_object_class_install_property(gObjectClass,
482                                     PROP_ENABLE_HTML5_LOCAL_STORAGE,
483                                     g_param_spec_boolean("enable-html5-local-storage",
484                                                          _("Enable HTML5 local storage"),
485                                                          _("Whether to enable HTML5 Local Storage support."),
486                                                          TRUE,
487                                                          readWriteConstructParamFlags));
488
489     /**
490      * WebKitSettings:enable-html5-database:
491      *
492      * Whether to enable HTML5 client-side SQL database support. Client-side
493      * SQL database allows web pages to store structured data and be able to
494      * use SQL to manipulate that data asynchronously.
495      *
496      * HTML5 database specification is available at
497      * http://www.w3.org/TR/webdatabase/.
498      */
499     g_object_class_install_property(gObjectClass,
500                                     PROP_ENABLE_HTML5_DATABASE,
501                                     g_param_spec_boolean("enable-html5-database",
502                                                          _("Enable HTML5 database"),
503                                                          _("Whether to enable HTML5 database support."),
504                                                          TRUE,
505                                                          readWriteConstructParamFlags));
506
507     /**
508      * WebKitSettings:enable-xss-auditor:
509      *
510      * Whether to enable the XSS auditor. This feature filters some kinds of
511      * reflective XSS attacks on vulnerable web sites.
512      */
513     g_object_class_install_property(gObjectClass,
514                                     PROP_ENABLE_XSS_AUDITOR,
515                                     g_param_spec_boolean("enable-xss-auditor",
516                                                          _("Enable XSS auditor"),
517                                                          _("Whether to enable the XSS auditor."),
518                                                          TRUE,
519                                                          readWriteConstructParamFlags));
520
521
522     /**
523      * WebKitSettings:enable-frame-flattening:
524      *
525      * Whether to enable the frame flattening. With this setting each subframe is expanded
526      * to its contents, which will flatten all the frames to become one scrollable page.
527      * On touch devices scrollable subframes on a page can result in a confusing user experience.
528      */
529     g_object_class_install_property(gObjectClass,
530                                     PROP_ENABLE_FRAME_FLATTENING,
531                                     g_param_spec_boolean("enable-frame-flattening",
532                                                          _("Enable frame flattening"),
533                                                          _("Whether to enable frame flattening."),
534                                                          FALSE,
535                                                          readWriteConstructParamFlags));
536
537     /**
538      * WebKitSettings:enable-plugins:
539      *
540      * Determines whether or not plugins on the page are enabled.
541      */
542     g_object_class_install_property(gObjectClass,
543                                     PROP_ENABLE_PLUGINS,
544                                     g_param_spec_boolean("enable-plugins",
545                                                          _("Enable plugins"),
546                                                          _("Enable embedded plugin objects."),
547                                                          TRUE,
548                                                          readWriteConstructParamFlags));
549
550     /**
551      * WebKitSettings:enable-java:
552      *
553      * Determines whether or not Java is enabled on the page.
554      */
555     g_object_class_install_property(gObjectClass,
556                                     PROP_ENABLE_JAVA,
557                                     g_param_spec_boolean("enable-java",
558                                                          _("Enable Java"),
559                                                          _("Whether Java support should be enabled."),
560                                                          TRUE,
561                                                          readWriteConstructParamFlags));
562
563     /**
564      * WebKitSettings:javascript-can-open-windows-automatically:
565      *
566      * Whether JavaScript can open popup windows automatically without user
567      * intervention.
568      */
569     g_object_class_install_property(gObjectClass,
570                                     PROP_JAVASCRIPT_CAN_OPEN_WINDOWS_AUTOMATICALLY,
571                                     g_param_spec_boolean("javascript-can-open-windows-automatically",
572                                                          _("JavaScript can open windows automatically"),
573                                                          _("Whether JavaScript can open windows automatically."),
574                                                          FALSE,
575                                                          readWriteConstructParamFlags));
576
577     /**
578      * WebKitSettings:enable-hyperlink-auditing:
579      *
580      * Determines whether or not hyperlink auditing is enabled.
581      *
582      * The hyperlink auditing specification is available at
583      * http://www.whatwg.org/specs/web-apps/current-work/multipage/links.html#hyperlink-auditing.
584      */
585     g_object_class_install_property(gObjectClass,
586                                     PROP_ENABLE_HYPERLINK_AUDITING,
587                                     g_param_spec_boolean("enable-hyperlink-auditing",
588                                                          _("Enable hyperlink auditing"),
589                                                          _("Whether <a ping> should be able to send pings."),
590                                                          FALSE,
591                                                          readWriteConstructParamFlags));
592
593     /**
594      * WebKitWebSettings:default-font-family:
595      *
596      * The font family to use as the default for content that does not specify a font.
597      */
598     g_object_class_install_property(gObjectClass,
599                                     PROP_DEFAULT_FONT_FAMILY,
600                                     g_param_spec_string("default-font-family",
601                                                         _("Default font family"),
602                                                         _("The font family to use as the default for content that does not specify a font."),
603                                                         "sans-serif",
604                                                         readWriteConstructParamFlags));
605
606     /**
607      * WebKitWebSettings:monospace-font-family:
608      *
609      * The font family used as the default for content using a monospace font.
610      *
611      */
612     g_object_class_install_property(gObjectClass,
613                                     PROP_MONOSPACE_FONT_FAMILY,
614                                     g_param_spec_string("monospace-font-family",
615                                                         _("Monospace font family"),
616                                                         _("The font family used as the default for content using monospace font."),
617                                                         "monospace",
618                                                         readWriteConstructParamFlags));
619
620     /**
621      * WebKitWebSettings:serif-font-family:
622      *
623      * The font family used as the default for content using a serif font.
624      */
625     g_object_class_install_property(gObjectClass,
626                                     PROP_SERIF_FONT_FAMILY,
627                                     g_param_spec_string("serif-font-family",
628                                                         _("Serif font family"),
629                                                         _("The font family used as the default for content using serif font."),
630                                                         "serif",
631                                                         readWriteConstructParamFlags));
632
633     /**
634      * WebKitWebSettings:sans-serif-font-family:
635      *
636      * The font family used as the default for content using a sans-serif font.
637      */
638     g_object_class_install_property(gObjectClass,
639                                     PROP_SANS_SERIF_FONT_FAMILY,
640                                     g_param_spec_string("sans-serif-font-family",
641                                                         _("Sans-serif font family"),
642                                                         _("The font family used as the default for content using sans-serif font."),
643                                                         "sans-serif",
644                                                         readWriteConstructParamFlags));
645
646     /**
647      * WebKitWebSettings:cursive-font-family:
648      *
649      * The font family used as the default for content using a cursive font.
650      */
651     g_object_class_install_property(gObjectClass,
652                                     PROP_CURSIVE_FONT_FAMILY,
653                                     g_param_spec_string("cursive-font-family",
654                                                         _("Cursive font family"),
655                                                         _("The font family used as the default for content using cursive font."),
656                                                         "serif",
657                                                         readWriteConstructParamFlags));
658
659     /**
660      * WebKitWebSettings:fantasy-font-family:
661      *
662      * The font family used as the default for content using a fantasy font.
663      */
664     g_object_class_install_property(gObjectClass,
665                                     PROP_FANTASY_FONT_FAMILY,
666                                     g_param_spec_string("fantasy-font-family",
667                                                         _("Fantasy font family"),
668                                                         _("The font family used as the default for content using fantasy font."),
669                                                         "serif",
670                                                         readWriteConstructParamFlags));
671
672     /**
673      * WebKitWebSettings:pictograph-font-family:
674      *
675      * The font family used as the default for content using a pictograph font.
676      */
677     g_object_class_install_property(gObjectClass,
678                                     PROP_PICTOGRAPH_FONT_FAMILY,
679                                     g_param_spec_string("pictograph-font-family",
680                                                         _("Pictograph font family"),
681                                                         _("The font family used as the default for content using pictograph font."),
682                                                         "serif",
683                                                         readWriteConstructParamFlags));
684
685     /**
686      * WebKitWebSettings:default-font-size:
687      *
688      * The default font size in pixels to use for content displayed if
689      * no font size is specified.
690      */
691     g_object_class_install_property(gObjectClass,
692                                     PROP_DEFAULT_FONT_SIZE,
693                                     g_param_spec_uint("default-font-size",
694                                                       _("Default font size"),
695                                                       _("The default font size used to display text."),
696                                                       0, G_MAXUINT, 16,
697                                                       readWriteConstructParamFlags));
698
699     /**
700      * WebKitWebSettings:default-monospace-font-size:
701      *
702      * The default font size in pixels to use for content displayed in
703      * monospace font if no font size is specified.
704      */
705     g_object_class_install_property(gObjectClass,
706                                     PROP_DEFAULT_MONOSPACE_FONT_SIZE,
707                                     g_param_spec_uint("default-monospace-font-size",
708                                                       _("Default monospace font size"),
709                                                       _("The default font size used to display monospace text."),
710                                                       0, G_MAXUINT, 13,
711                                                       readWriteConstructParamFlags));
712
713     /**
714      * WebKitWebSettings:minimum-font-size:
715      *
716      * The minimum font size in points used to display text. This setting
717      * controls the absolute smallest size. Values other than 0 can
718      * potentially break page layouts.
719      */
720     g_object_class_install_property(gObjectClass,
721                                     PROP_MINIMUM_FONT_SIZE,
722                                     g_param_spec_uint("minimum-font-size",
723                                                       _("Minimum font size"),
724                                                       _("The minimum font size used to display text."),
725                                                       0, G_MAXUINT, 0,
726                                                       readWriteConstructParamFlags));
727
728     /**
729      * WebKitSettings:default-charset:
730      *
731      * The default text charset used when interpreting content with an unspecified charset.
732      */
733     g_object_class_install_property(gObjectClass,
734                                     PROP_DEFAULT_CHARSET,
735                                     g_param_spec_string("default-charset",
736                                                         _("Default charset"),
737                                                         _("The default text charset used when interpreting content with unspecified charset."),
738                                                         "iso-8859-1",
739                                                         readWriteConstructParamFlags));
740
741     /**
742      * WebKitSettings:enable-private-browsing:
743      *
744      * Determines whether or not private browsing is enabled. Private browsing
745      * will disable history, cache and form auto-fill for any pages visited.
746      */
747     g_object_class_install_property(gObjectClass,
748                                     PROP_ENABLE_PRIVATE_BROWSING,
749                                     g_param_spec_boolean("enable-private-browsing",
750                                                          _("Enable private browsing"),
751                                                          _("Whether to enable private browsing"),
752                                                          FALSE,
753                                                          readWriteConstructParamFlags));
754
755     /**
756      * WebKitSettings:enable-developer-extras:
757      *
758      * Determines whether or not developer tools, such as the Web Inspector, are enabled.
759      */
760     g_object_class_install_property(gObjectClass,
761                                     PROP_ENABLE_DEVELOPER_EXTRAS,
762                                     g_param_spec_boolean("enable-developer-extras",
763                                                          _("Enable developer extras"),
764                                                          _("Whether to enable developer extras"),
765                                                          FALSE,
766                                                          readWriteConstructParamFlags));
767
768     /**
769      * WebKitSettings:enable-resizable-text-areas:
770      *
771      * Determines whether or not text areas can be resized.
772      */
773     g_object_class_install_property(gObjectClass,
774                                     PROP_ENABLE_RESIZABLE_TEXT_AREAS,
775                                     g_param_spec_boolean("enable-resizable-text-areas",
776                                                          _("Enable resizable text areas"),
777                                                          _("Whether to enable resizable text areas"),
778                                                          TRUE,
779                                                          readWriteConstructParamFlags));
780
781     /**
782      * WebKitSettings:enable-tabs-to-links:
783      *
784      * Determines whether the tab key cycles through the elements on the page.
785      * When this setting is enabled, users will be able to focus the next element
786      * in the page by pressing the tab key. If the selected element is editable,
787      * then pressing tab key will insert the tab character.
788      */
789     g_object_class_install_property(gObjectClass,
790                                     PROP_ENABLE_TABS_TO_LINKS,
791                                     g_param_spec_boolean("enable-tabs-to-links",
792                                                          _("Enable tabs to links"),
793                                                          _("Whether to enable tabs to links"),
794                                                          TRUE,
795                                                          readWriteConstructParamFlags));
796
797     /**
798      * WebKitSettings:enable-dns-prefetching:
799      *
800      * Determines whether or not to prefetch domain names. DNS prefetching attempts
801      * to resolve domain names before a user tries to follow a link.
802      */
803     g_object_class_install_property(gObjectClass,
804                                     PROP_ENABLE_DNS_PREFETCHING,
805                                     g_param_spec_boolean("enable-dns-prefetching",
806                                                          _("Enable DNS prefetching"),
807                                                          _("Whether to enable DNS prefetching"),
808                                                          FALSE,
809                                                          readWriteConstructParamFlags));
810
811     /**
812      * WebKitSettings:enable-caret-browsing:
813      *
814      * Whether to enable accessibility enhanced keyboard navigation.
815      */
816     g_object_class_install_property(gObjectClass,
817                                     PROP_ENABLE_CARET_BROWSING,
818                                     g_param_spec_boolean("enable-caret-browsing",
819                                                          _("Enable Caret Browsing"),
820                                                          _("Whether to enable accessibility enhanced keyboard navigation"),
821                                                          FALSE,
822                                                          readWriteConstructParamFlags));
823
824     /**
825      * WebKitSettings:enable-fullscreen:
826      *
827      * Whether to enable the Javascript Fullscreen API. The API
828      * allows any HTML element to request fullscreen display. See also
829      * the current draft of the spec:
830      * http://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html
831      */
832     g_object_class_install_property(gObjectClass,
833                                     PROP_ENABLE_FULLSCREEN,
834                                     g_param_spec_boolean("enable-fullscreen",
835                                                          _("Enable Fullscreen"),
836                                                          _("Whether to enable the Javascriipt Fullscreen API"),
837                                                          FALSE,
838                                                          readWriteConstructParamFlags));
839
840     /**
841      * WebKitSettings:print-backgrounds:
842      *
843      * Whether background images should be drawn during printing.
844      */
845     g_object_class_install_property(gObjectClass,
846                                     PROP_PRINT_BACKGROUNDS,
847                                     g_param_spec_boolean("print-backgrounds",
848                                                          _("Print Backgrounds"),
849                                                          _("Whether background images should be drawn during printing"),
850                                                          TRUE,
851                                                          readWriteConstructParamFlags));
852
853     /**
854      * WebKitSettings:enable-webaudio:
855      *
856      *
857      * Enable or disable support for WebAudio on pages. WebAudio is an
858      * experimental proposal for allowing web pages to generate Audio
859      * WAVE data from JavaScript. The standard is currently a
860      * work-in-progress by the W3C Audio Working Group.
861      *
862      * See also https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html
863      */
864     g_object_class_install_property(gObjectClass,
865                                     PROP_ENABLE_WEBAUDIO,
866                                     g_param_spec_boolean("enable-webaudio",
867                                                          _("Enable WebAudio"),
868                                                          _("Whether WebAudio content should be handled"),
869                                                          FALSE,
870                                                          readWriteConstructParamFlags));
871
872     /**
873     * WebKitSettings:enable-webgl:
874     *
875     * Enable or disable support for WebGL on pages. WebGL is an experimental
876     * proposal for allowing web pages to use OpenGL ES-like calls directly. The
877     * standard is currently a work-in-progress by the Khronos Group.
878     */
879     g_object_class_install_property(gObjectClass,
880                                     PROP_ENABLE_WEBGL,
881                                     g_param_spec_boolean("enable-webgl",
882                                                          _("Enable WebGL"),
883                                                          _("Whether WebGL content should be rendered"),
884                                                          FALSE,
885                                                          readWriteConstructParamFlags));
886
887     /**
888      * WebKitSettings:allow-modal-dialogs:
889      *
890      * Determine whether it's allowed to create and run modal dialogs
891      * from a #WebKitWebView through JavaScript with
892      * <function>window.showModalDialog</function>. If it's set to
893      * %FALSE, the associated #WebKitWebView won't be able to create
894      * new modal dialogs, so not even the #WebKitWebView::create
895      * signal will be emitted.
896      */
897     g_object_class_install_property(gObjectClass,
898                                     PROP_ALLOW_MODAL_DIALOGS,
899                                     g_param_spec_boolean("allow-modal-dialogs",
900                                                          _("Allow modal dialogs"),
901                                                          _("Whether it is possible to create modal dialogs"),
902                                                          FALSE,
903                                                          readWriteConstructParamFlags));
904
905     /**
906      * WebKitSettings:zoom-text-only:
907      *
908      * Whether #WebKitWebView:zoom-level affects only the
909      * text of the page or all the contents. Other contents containing text
910      * like form controls will be also affected by zoom factor when
911      * this property is enabled.
912      */
913     g_object_class_install_property(gObjectClass,
914                                     PROP_ZOOM_TEXT_ONLY,
915                                     g_param_spec_boolean("zoom-text-only",
916                                                          _("Zoom Text Only"),
917                                                          _("Whether zoom level of web view changes only the text size"),
918                                                          FALSE,
919                                                          readWriteConstructParamFlags));
920
921     /**
922      * WebKitSettings:javascript-can-access-clipboard:
923      *
924      * Whether JavaScript can access the clipboard. The default value is %FALSE. If
925      * set to %TRUE, document.execCommand() allows cut, copy and paste commands.
926      *
927      */
928     g_object_class_install_property(gObjectClass,
929                                     PROP_JAVASCRIPT_CAN_ACCESS_CLIPBOARD,
930                                     g_param_spec_boolean("javascript-can-access-clipboard",
931                                                          _("JavaScript can access clipboard"),
932                                                          _("Whether JavaScript can access Clipboard"),
933                                                          FALSE,
934                                                          readWriteConstructParamFlags));
935
936     /**
937      * WebKitSettings:media-playback-requires-user-gesture:
938      *
939      * Whether a user gesture (such as clicking the play button)
940      * would be required to start media playback or load media. This is off
941      * by default, so media playback could start automatically.
942      * Setting it on requires a gesture by the user to start playback, or to
943      * load the media.
944      */
945     g_object_class_install_property(gObjectClass,
946                                     PROP_MEDIA_PLAYBACK_REQUIRES_USER_GESTURE,
947                                     g_param_spec_boolean("media-playback-requires-user-gesture",
948                                                          _("Media playback requires user gesture"),
949                                                          _("Whether media playback requires user gesture"),
950                                                          FALSE,
951                                                          readWriteConstructParamFlags));
952
953     /**
954      * WebKitSettings:media-playback-allows-inline
955      *
956      * Whether media playback is full-screen only or inline playback is allowed.
957      * This is %TRUE by default, so media playback can be inline. Setting it to
958      * %FALSE allows specifying that media playback should be always fullscreen.
959      */
960     g_object_class_install_property(gObjectClass,
961                                     PROP_MEDIA_PLAYBACK_ALLOWS_INLINE,
962                                     g_param_spec_boolean("media-playback-allows-inline",
963                                                          _("Media playback allows inline"),
964                                                          _("Whether media playback allows inline"),
965                                                          TRUE,
966                                                          readWriteConstructParamFlags));
967
968     /**
969      * WebKitSettings:draw-compositing-indicators:
970      *
971      * Whether to draw compositing borders and repaint counters on layers drawn
972      * with accelerated compositing. This is useful for debugging issues related
973      * to web content that is composited with the GPU.
974      */
975     g_object_class_install_property(gObjectClass,
976                                     PROP_DRAW_COMPOSITING_INDICATORS,
977                                     g_param_spec_boolean("draw-compositing-indicators",
978                                                          _("Draw compositing indicators"),
979                                                          _("Whether to draw compositing borders and repaint counters"),
980                                                          FALSE,
981                                                          readWriteConstructParamFlags));
982
983     /**
984      * WebKitSettings:enable-site-specific-quirks:
985      *
986      * Whether to turn on site-specific quirks. Turning this on will
987      * tell WebKit to use some site-specific workarounds for
988      * better web compatibility. For example, older versions of
989      * MediaWiki will incorrectly send to WebKit a css file with KHTML
990      * workarounds. By turning on site-specific quirks, WebKit will
991      * special-case this and other cases to make some specific sites work.
992      */
993     g_object_class_install_property(gObjectClass,
994                                     PROP_ENABLE_SITE_SPECIFIC_QUIRKS,
995                                     g_param_spec_boolean("enable-site-specific-quirks",
996                                                          _("Enable Site Specific Quirks"),
997                                                          _("Enables the site-specific compatibility workarounds"),
998                                                          FALSE,
999                                                          readWriteConstructParamFlags));
1000
1001     /**
1002      * WebKitSettings:enable-page-cache:
1003      *
1004      * Enable or disable the page cache. Disabling the page cache is
1005      * generally only useful for special circumstances like low-memory
1006      * scenarios or special purpose applications like static HTML
1007      * viewers. This setting only controls the Page Cache, this cache
1008      * is different than the disk-based or memory-based traditional
1009      * resource caches, its point is to make going back and forth
1010      * between pages much faster. For details about the different types
1011      * of caches and their purposes see:
1012      * http://webkit.org/blog/427/webkit-page-cache-i-the-basics/
1013      */
1014     g_object_class_install_property(gObjectClass,
1015                                     PROP_ENABLE_PAGE_CACHE,
1016                                     g_param_spec_boolean("enable-page-cache",
1017                                                          _("Enable page cache"),
1018                                                          _("Whether the page cache should be used"),
1019                                                          TRUE,
1020                                                          readWriteConstructParamFlags));
1021
1022     /**
1023      * WebKitSettings:user-agent:
1024      *
1025      * The user-agent string used by WebKit. Unusual user-agent strings may cause web
1026      * content to render incorrectly or fail to run, as many web pages are written to
1027      * parse the user-agent strings of only the most popular browsers. Therefore, it's
1028      * typically better to not completely override the standard user-agent, but to use
1029      * webkit_settings_set_user_agent_with_application_details() instead.
1030      *
1031      * If this property is set to the empty string or %NULL, it will revert to the standard
1032      * user-agent.
1033      */
1034     g_object_class_install_property(gObjectClass,
1035                                     PROP_USER_AGENT,
1036                                     g_param_spec_string("user-agent",
1037                                                         _("User agent string"),
1038                                                         _("The user agent string"),
1039                                                         0, // A null string forces the standard user agent.
1040                                                         readWriteConstructParamFlags));
1041
1042     g_type_class_add_private(klass, sizeof(WebKitSettingsPrivate));
1043 }
1044
1045 static void webkit_settings_init(WebKitSettings* settings)
1046 {
1047     WebKitSettingsPrivate* priv = G_TYPE_INSTANCE_GET_PRIVATE(settings, WEBKIT_TYPE_SETTINGS, WebKitSettingsPrivate);
1048     settings->priv = priv;
1049     new (priv) WebKitSettingsPrivate();
1050
1051     priv->preferences = adoptWK(WKPreferencesCreate());
1052
1053     WKRetainPtr<WKStringRef> defaultFontFamilyRef = adoptWK(WKPreferencesCopyStandardFontFamily(priv->preferences.get()));
1054     priv->defaultFontFamily =  WebKit::toImpl(defaultFontFamilyRef.get())->string().utf8();
1055
1056     WKRetainPtr<WKStringRef> monospaceFontFamilyRef = adoptWK(WKPreferencesCopyFixedFontFamily(priv->preferences.get()));
1057     priv->monospaceFontFamily = WebKit::toImpl(monospaceFontFamilyRef.get())->string().utf8();
1058
1059     WKRetainPtr<WKStringRef> serifFontFamilyRef = adoptWK(WKPreferencesCopySerifFontFamily(priv->preferences.get()));
1060     priv->serifFontFamily = WebKit::toImpl(serifFontFamilyRef.get())->string().utf8();
1061
1062     WKRetainPtr<WKStringRef> sansSerifFontFamilyRef = adoptWK(WKPreferencesCopySansSerifFontFamily(priv->preferences.get()));
1063     priv->sansSerifFontFamily = WebKit::toImpl(sansSerifFontFamilyRef.get())->string().utf8();
1064
1065     WKRetainPtr<WKStringRef> cursiveFontFamilyRef = adoptWK(WKPreferencesCopyCursiveFontFamily(priv->preferences.get()));
1066     priv->cursiveFontFamily = WebKit::toImpl(cursiveFontFamilyRef.get())->string().utf8();
1067
1068     WKRetainPtr<WKStringRef> fantasyFontFamilyRef = adoptWK(WKPreferencesCopyFantasyFontFamily(priv->preferences.get()));
1069     priv->fantasyFontFamily = WebKit::toImpl(fantasyFontFamilyRef.get())->string().utf8();
1070
1071     WKRetainPtr<WKStringRef> pictographFontFamilyRef = adoptWK(WKPreferencesCopyPictographFontFamily(priv->preferences.get()));
1072     priv->pictographFontFamily = WebKit::toImpl(pictographFontFamilyRef.get())->string().utf8();
1073
1074     WKRetainPtr<WKStringRef> defaultCharsetRef = adoptWK(WKPreferencesCopyDefaultTextEncodingName(priv->preferences.get()));
1075     priv->defaultCharset = WebKit::toImpl(defaultCharsetRef.get())->string().utf8();
1076 }
1077
1078 void webkitSettingsAttachSettingsToPage(WebKitSettings* settings, WKPageRef wkPage)
1079 {
1080     WebKitSettingsPrivate* priv = settings->priv;
1081     WKPageGroupSetPreferences(WKPageGetPageGroup(wkPage), priv->preferences.get());
1082     WebKit::toImpl(wkPage)->setCanRunModal(priv->allowModalDialogs);
1083
1084     ASSERT(!priv->userAgent.isNull());
1085     WKRetainPtr<WKStringRef> userAgent = adoptWK(WKStringCreateWithUTF8CString(priv->userAgent.data()));
1086     WKPageSetCustomUserAgent(wkPage, userAgent.get());
1087 }
1088
1089 /**
1090  * webkit_settings_new:
1091  *
1092  * Creates a new #WebKitSettings instance with default values. It must
1093  * be manually attached to a #WebKitWebView.
1094  * See also webkit_settings_new_with_settings().
1095  *
1096  * Returns: a new #WebKitSettings instance.
1097  */
1098 WebKitSettings* webkit_settings_new()
1099 {
1100     return WEBKIT_SETTINGS(g_object_new(WEBKIT_TYPE_SETTINGS, NULL));
1101 }
1102
1103 /**
1104  * webkit_settings_new_with_settings:
1105  * @first_setting_name: name of first setting to set
1106  * @...: value of first setting, followed by more settings,
1107  *    %NULL-terminated
1108  *
1109  * Creates a new #WebKitSettings instance with the given settings. It must
1110  * be manually attached to a #WebKitWebView.
1111  *
1112  * Returns: a new #WebKitSettings instance.
1113  */
1114 WebKitSettings* webkit_settings_new_with_settings(const gchar* firstSettingName, ...)
1115 {
1116     va_list args;
1117     va_start(args, firstSettingName);
1118     WebKitSettings* settings = WEBKIT_SETTINGS(g_object_new_valist(WEBKIT_TYPE_SETTINGS, firstSettingName, args));
1119     va_end(args);
1120     return settings;
1121 }
1122
1123 /**
1124  * webkit_settings_get_enable_javascript:
1125  * @settings: a #WebKitSettings
1126  *
1127  * Get the #WebKitSettings:enable-javascript property.
1128  *
1129  * Returns: %TRUE If JavaScript is enabled or %FALSE otherwise.
1130  */
1131 gboolean webkit_settings_get_enable_javascript(WebKitSettings* settings)
1132 {
1133     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
1134
1135     return WKPreferencesGetJavaScriptEnabled(settings->priv->preferences.get());
1136 }
1137
1138 /**
1139  * webkit_settings_set_enable_javascript:
1140  * @settings: a #WebKitSettings
1141  * @enabled: Value to be set
1142  *
1143  * Set the #WebKitSettings:enable-javascript property.
1144  */
1145 void webkit_settings_set_enable_javascript(WebKitSettings* settings, gboolean enabled)
1146 {
1147     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
1148
1149     WebKitSettingsPrivate* priv = settings->priv;
1150     bool currentValue = WKPreferencesGetJavaScriptEnabled(priv->preferences.get());
1151     if (currentValue == enabled)
1152         return;
1153
1154     WKPreferencesSetJavaScriptEnabled(priv->preferences.get(), enabled);
1155     g_object_notify(G_OBJECT(settings), "enable-javascript");
1156 }
1157
1158 /**
1159  * webkit_settings_get_auto_load_images:
1160  * @settings: a #WebKitSettings
1161  *
1162  * Get the #WebKitSettings:auto-load-images property.
1163  *
1164  * Returns: %TRUE If auto loading of images is enabled or %FALSE otherwise.
1165  */
1166 gboolean webkit_settings_get_auto_load_images(WebKitSettings* settings)
1167 {
1168     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
1169
1170     return WKPreferencesGetLoadsImagesAutomatically(settings->priv->preferences.get());
1171 }
1172
1173 /**
1174  * webkit_settings_set_auto_load_images:
1175  * @settings: a #WebKitSettings
1176  * @enabled: Value to be set
1177  *
1178  * Set the #WebKitSettings:auto-load-images property.
1179  */
1180 void webkit_settings_set_auto_load_images(WebKitSettings* settings, gboolean enabled)
1181 {
1182     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
1183
1184     WebKitSettingsPrivate* priv = settings->priv;
1185     bool currentValue = WKPreferencesGetLoadsImagesAutomatically(priv->preferences.get());
1186     if (currentValue == enabled)
1187         return;
1188
1189     WKPreferencesSetLoadsImagesAutomatically(priv->preferences.get(), enabled);
1190     g_object_notify(G_OBJECT(settings), "auto-load-images");
1191 }
1192
1193 /**
1194  * webkit_settings_get_load_icons_ignoring_image_load_setting:
1195  * @settings: a #WebKitSettings
1196  *
1197  * Get the #WebKitSettings:load-icons-ignoring-image-load-setting property.
1198  *
1199  * Returns: %TRUE If site icon can be loaded irrespective of image loading preference or %FALSE otherwise.
1200  */
1201 gboolean webkit_settings_get_load_icons_ignoring_image_load_setting(WebKitSettings* settings)
1202 {
1203     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
1204
1205     return WKPreferencesGetLoadsSiteIconsIgnoringImageLoadingPreference(settings->priv->preferences.get());
1206 }
1207
1208 /**
1209  * webkit_settings_set_load_icons_ignoring_image_load_setting:
1210  * @settings: a #WebKitSettings
1211  * @enabled: Value to be set
1212  *
1213  * Set the #WebKitSettings:load-icons-ignoring-image-load-setting property.
1214  */
1215 void webkit_settings_set_load_icons_ignoring_image_load_setting(WebKitSettings* settings, gboolean enabled)
1216 {
1217     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
1218
1219     WebKitSettingsPrivate* priv = settings->priv;
1220     bool currentValue = WKPreferencesGetLoadsSiteIconsIgnoringImageLoadingPreference(priv->preferences.get());
1221     if (currentValue == enabled)
1222         return;
1223
1224     WKPreferencesSetLoadsSiteIconsIgnoringImageLoadingPreference(priv->preferences.get(), enabled);
1225     g_object_notify(G_OBJECT(settings), "load-icons-ignoring-image-load-setting");
1226 }
1227
1228 /**
1229  * webkit_settings_get_enable_offline_web_application_cache:
1230  * @settings: a #WebKitSettings
1231  *
1232  * Get the #WebKitSettings:enable-offline-web-application-cache property.
1233  *
1234  * Returns: %TRUE If HTML5 offline web application cache support is enabled or %FALSE otherwise.
1235  */
1236 gboolean webkit_settings_get_enable_offline_web_application_cache(WebKitSettings* settings)
1237 {
1238     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
1239
1240     return WKPreferencesGetOfflineWebApplicationCacheEnabled(settings->priv->preferences.get());
1241 }
1242
1243 /**
1244  * webkit_settings_set_enable_offline_web_application_cache:
1245  * @settings: a #WebKitSettings
1246  * @enabled: Value to be set
1247  *
1248  * Set the #WebKitSettings:enable-offline-web-application-cache property.
1249  */
1250 void webkit_settings_set_enable_offline_web_application_cache(WebKitSettings* settings, gboolean enabled)
1251 {
1252     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
1253
1254     WebKitSettingsPrivate* priv = settings->priv;
1255     bool currentValue = WKPreferencesGetOfflineWebApplicationCacheEnabled(priv->preferences.get());
1256     if (currentValue == enabled)
1257         return;
1258
1259     WKPreferencesSetOfflineWebApplicationCacheEnabled(priv->preferences.get(), enabled);
1260     g_object_notify(G_OBJECT(settings), "enable-offline-web-application-cache");
1261 }
1262
1263 /**
1264  * webkit_settings_get_enable_html5_local_storage:
1265  * @settings: a #WebKitSettings
1266  *
1267  * Get the #WebKitSettings:enable-html5-local-storage property.
1268  *
1269  * Returns: %TRUE If HTML5 local storage support is enabled or %FALSE otherwise.
1270  */
1271 gboolean webkit_settings_get_enable_html5_local_storage(WebKitSettings* settings)
1272 {
1273     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
1274
1275     return WKPreferencesGetLocalStorageEnabled(settings->priv->preferences.get());
1276 }
1277
1278 /**
1279  * webkit_settings_set_enable_html5_local_storage:
1280  * @settings: a #WebKitSettings
1281  * @enabled: Value to be set
1282  *
1283  * Set the #WebKitSettings:enable-html5-local-storage property.
1284  */
1285 void webkit_settings_set_enable_html5_local_storage(WebKitSettings* settings, gboolean enabled)
1286 {
1287     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
1288
1289     WebKitSettingsPrivate* priv = settings->priv;
1290     bool currentValue = WKPreferencesGetLocalStorageEnabled(priv->preferences.get());
1291     if (currentValue == enabled)
1292         return;
1293
1294     WKPreferencesSetLocalStorageEnabled(priv->preferences.get(), enabled);
1295     g_object_notify(G_OBJECT(settings), "enable-html5-local-storage");
1296 }
1297
1298 /**
1299  * webkit_settings_get_enable_html5_database:
1300  * @settings: a #WebKitSettings
1301  *
1302  * Get the #WebKitSettings:enable-html5-database property.
1303  *
1304  * Returns: %TRUE If HTML5 database support is enabled or %FALSE otherwise.
1305  */
1306 gboolean webkit_settings_get_enable_html5_database(WebKitSettings* settings)
1307 {
1308     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
1309
1310     return WKPreferencesGetDatabasesEnabled(settings->priv->preferences.get());
1311 }
1312
1313 /**
1314  * webkit_settings_set_enable_html5_database:
1315  * @settings: a #WebKitSettings
1316  * @enabled: Value to be set
1317  *
1318  * Set the #WebKitSettings:enable-html5-database property.
1319  */
1320 void webkit_settings_set_enable_html5_database(WebKitSettings* settings, gboolean enabled)
1321 {
1322     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
1323
1324     WebKitSettingsPrivate* priv = settings->priv;
1325     bool currentValue = WKPreferencesGetDatabasesEnabled(priv->preferences.get());
1326     if (currentValue == enabled)
1327         return;
1328
1329     WKPreferencesSetDatabasesEnabled(priv->preferences.get(), enabled);
1330     g_object_notify(G_OBJECT(settings), "enable-html5-database");
1331 }
1332
1333 /**
1334  * webkit_settings_get_enable_xss_auditor:
1335  * @settings: a #WebKitSettings
1336  *
1337  * Get the #WebKitSettings:enable-xss-auditor property.
1338  *
1339  * Returns: %TRUE If XSS auditing is enabled or %FALSE otherwise.
1340  */
1341 gboolean webkit_settings_get_enable_xss_auditor(WebKitSettings* settings)
1342 {
1343     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
1344
1345     return WKPreferencesGetXSSAuditorEnabled(settings->priv->preferences.get());
1346 }
1347
1348 /**
1349  * webkit_settings_set_enable_xss_auditor:
1350  * @settings: a #WebKitSettings
1351  * @enabled: Value to be set
1352  *
1353  * Set the #WebKitSettings:enable-xss-auditor property.
1354  */
1355 void webkit_settings_set_enable_xss_auditor(WebKitSettings* settings, gboolean enabled)
1356 {
1357     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
1358
1359     WebKitSettingsPrivate* priv = settings->priv;
1360     bool currentValue = WKPreferencesGetXSSAuditorEnabled(priv->preferences.get());
1361     if (currentValue == enabled)
1362         return;
1363
1364     WKPreferencesSetXSSAuditorEnabled(priv->preferences.get(), enabled);
1365     g_object_notify(G_OBJECT(settings), "enable-xss-auditor");
1366 }
1367
1368 /**
1369  * webkit_settings_get_enable_frame_flattening:
1370  * @settings: a #WebKitSettings
1371  *
1372  * Get the #WebKitSettings:enable-frame-flattening property.
1373  *
1374  * Returns: %TRUE If frame flattening is enabled or %FALSE otherwise.
1375  *
1376  **/
1377 gboolean webkit_settings_get_enable_frame_flattening(WebKitSettings* settings)
1378 {
1379     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
1380
1381     return WKPreferencesGetFrameFlatteningEnabled(settings->priv->preferences.get());
1382 }
1383
1384 /**
1385  * webkit_settings_set_enable_frame_flattening:
1386  * @settings: a #WebKitSettings
1387  * @enabled: Value to be set
1388  *
1389  * Set the #WebKitSettings:enable-frame-flattening property.
1390  */
1391 void webkit_settings_set_enable_frame_flattening(WebKitSettings* settings, gboolean enabled)
1392 {
1393     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
1394
1395     WebKitSettingsPrivate* priv = settings->priv;
1396     bool currentValue = WKPreferencesGetFrameFlatteningEnabled(priv->preferences.get());
1397     if (currentValue == enabled)
1398         return;
1399
1400     WKPreferencesSetFrameFlatteningEnabled(priv->preferences.get(), enabled);
1401     g_object_notify(G_OBJECT(settings), "enable-frame-flattening");
1402 }
1403
1404 /**
1405  * webkit_settings_get_enable_plugins:
1406  * @settings: a #WebKitSettings
1407  *
1408  * Get the #WebKitSettings:enable-plugins property.
1409  *
1410  * Returns: %TRUE If plugins are enabled or %FALSE otherwise.
1411  */
1412 gboolean webkit_settings_get_enable_plugins(WebKitSettings* settings)
1413 {
1414     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
1415
1416     return WKPreferencesGetPluginsEnabled(settings->priv->preferences.get());
1417 }
1418
1419 /**
1420  * webkit_settings_set_enable_plugins:
1421  * @settings: a #WebKitSettings
1422  * @enabled: Value to be set
1423  *
1424  * Set the #WebKitSettings:enable-plugins property.
1425  */
1426 void webkit_settings_set_enable_plugins(WebKitSettings* settings, gboolean enabled)
1427 {
1428     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
1429
1430     WebKitSettingsPrivate* priv = settings->priv;
1431     bool currentValue = WKPreferencesGetPluginsEnabled(priv->preferences.get());
1432     if (currentValue == enabled)
1433         return;
1434
1435     WKPreferencesSetPluginsEnabled(priv->preferences.get(), enabled);
1436     g_object_notify(G_OBJECT(settings), "enable-plugins");
1437 }
1438
1439 /**
1440  * webkit_settings_get_enable_java:
1441  * @settings: a #WebKitSettings
1442  *
1443  * Get the #WebKitSettings:enable-java property.
1444  *
1445  * Returns: %TRUE If Java is enabled or %FALSE otherwise.
1446  */
1447 gboolean webkit_settings_get_enable_java(WebKitSettings* settings)
1448 {
1449     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
1450
1451     return WKPreferencesGetJavaEnabled(settings->priv->preferences.get());
1452 }
1453
1454 /**
1455  * webkit_settings_set_enable_java:
1456  * @settings: a #WebKitSettings
1457  * @enabled: Value to be set
1458  *
1459  * Set the #WebKitSettings:enable-java property.
1460  */
1461 void webkit_settings_set_enable_java(WebKitSettings* settings, gboolean enabled)
1462 {
1463     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
1464
1465     WebKitSettingsPrivate* priv = settings->priv;
1466     bool currentValue = WKPreferencesGetJavaEnabled(priv->preferences.get());
1467     if (currentValue == enabled)
1468         return;
1469
1470     WKPreferencesSetJavaEnabled(priv->preferences.get(), enabled);
1471     g_object_notify(G_OBJECT(settings), "enable-java");
1472 }
1473
1474 /**
1475  * webkit_settings_get_javascript_can_open_windows_automatically:
1476  * @settings: a #WebKitSettings
1477  *
1478  * Get the #WebKitSettings:javascript-can-open-windows-automatically property.
1479  *
1480  * Returns: %TRUE If JavaScript can open window automatically or %FALSE otherwise.
1481  */
1482 gboolean webkit_settings_get_javascript_can_open_windows_automatically(WebKitSettings* settings)
1483 {
1484     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
1485
1486     return WKPreferencesGetJavaScriptCanOpenWindowsAutomatically(settings->priv->preferences.get());
1487 }
1488
1489 /**
1490  * webkit_settings_set_javascript_can_open_windows_automatically:
1491  * @settings: a #WebKitSettings
1492  * @enabled: Value to be set
1493  *
1494  * Set the #WebKitSettings:javascript-can-open-windows-automatically property.
1495  */
1496 void webkit_settings_set_javascript_can_open_windows_automatically(WebKitSettings* settings, gboolean enabled)
1497 {
1498     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
1499
1500     WebKitSettingsPrivate* priv = settings->priv;
1501     bool currentValue = WKPreferencesGetJavaScriptCanOpenWindowsAutomatically(priv->preferences.get());
1502     if (currentValue == enabled)
1503         return;
1504
1505     WKPreferencesSetJavaScriptCanOpenWindowsAutomatically(priv->preferences.get(), enabled);
1506     g_object_notify(G_OBJECT(settings), "javascript-can-open-windows-automatically");
1507 }
1508
1509 /**
1510  * webkit_settings_get_enable_hyperlink_auditing:
1511  * @settings: a #WebKitSettings
1512  *
1513  * Get the #WebKitSettings:enable-hyperlink-auditing property.
1514  *
1515  * Returns: %TRUE If hyper link auditing is enabled or %FALSE otherwise.
1516  */
1517 gboolean webkit_settings_get_enable_hyperlink_auditing(WebKitSettings* settings)
1518 {
1519     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
1520
1521     return WKPreferencesGetHyperlinkAuditingEnabled(settings->priv->preferences.get());
1522 }
1523
1524 /**
1525  * webkit_settings_set_enable_hyperlink_auditing:
1526  * @settings: a #WebKitSettings
1527  * @enabled: Value to be set
1528  *
1529  * Set the #WebKitSettings:enable-hyperlink-auditing property.
1530  */
1531 void webkit_settings_set_enable_hyperlink_auditing(WebKitSettings* settings, gboolean enabled)
1532 {
1533     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
1534
1535     WebKitSettingsPrivate* priv = settings->priv;
1536     bool currentValue = WKPreferencesGetHyperlinkAuditingEnabled(priv->preferences.get());
1537     if (currentValue == enabled)
1538         return;
1539
1540     WKPreferencesSetHyperlinkAuditingEnabled(priv->preferences.get(), enabled);
1541     g_object_notify(G_OBJECT(settings), "enable-hyperlink-auditing");
1542 }
1543
1544 /**
1545  * webkit_web_settings_get_default_font_family:
1546  * @settings: a #WebKitSettings
1547  *
1548  * Gets the #WebKitSettings:default-font-family property.
1549  *
1550  * Returns: The default font family used to display content that does not specify a font.
1551  */
1552 const gchar* webkit_settings_get_default_font_family(WebKitSettings* settings)
1553 {
1554     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), 0);
1555
1556     return settings->priv->defaultFontFamily.data();
1557 }
1558
1559 /**
1560  * webkit_settings_set_default_font_family:
1561  * @settings: a #WebKitSettings
1562  * @default_font_family: the new default font family
1563  *
1564  * Set the #WebKitSettings:default-font-family property.
1565  */
1566 void webkit_settings_set_default_font_family(WebKitSettings* settings, const gchar* defaultFontFamily)
1567 {
1568     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
1569     g_return_if_fail(defaultFontFamily);
1570
1571     WebKitSettingsPrivate* priv = settings->priv;
1572     if (!g_strcmp0(priv->defaultFontFamily.data(), defaultFontFamily))
1573         return;
1574
1575     WKRetainPtr<WKStringRef> standardFontFamilyRef = adoptWK(WKStringCreateWithUTF8CString(defaultFontFamily));
1576     WKPreferencesSetStandardFontFamily(priv->preferences.get(), standardFontFamilyRef.get());
1577     priv->defaultFontFamily = WebKit::toImpl(standardFontFamilyRef.get())->string().utf8();
1578
1579     g_object_notify(G_OBJECT(settings), "default-font-family");
1580 }
1581
1582 /**
1583  * webkit_settings_get_monospace_font_family:
1584  * @settings: a #WebKitSettings
1585  *
1586  * Gets the #WebKitSettings:monospace-font-family property.
1587  *
1588  * Returns: Default font family used to display content marked with monospace font.
1589  */
1590 const gchar* webkit_settings_get_monospace_font_family(WebKitSettings* settings)
1591 {
1592     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), 0);
1593
1594     return settings->priv->monospaceFontFamily.data();
1595 }
1596
1597 /**
1598  * webkit_settings_set_monospace_font_family:
1599  * @settings: a #WebKitSettings
1600  * @monospace_font_family: the new default monospace font family
1601  *
1602  * Set the #WebKitSettings:monospace-font-family property.
1603  */
1604 void webkit_settings_set_monospace_font_family(WebKitSettings* settings, const gchar* monospaceFontFamily)
1605 {
1606     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
1607     g_return_if_fail(monospaceFontFamily);
1608
1609     WebKitSettingsPrivate* priv = settings->priv;
1610     if (!g_strcmp0(priv->monospaceFontFamily.data(), monospaceFontFamily))
1611         return;
1612
1613     WKRetainPtr<WKStringRef> fixedFontFamilyRef = adoptWK(WKStringCreateWithUTF8CString(monospaceFontFamily));
1614     WKPreferencesSetFixedFontFamily(priv->preferences.get(), fixedFontFamilyRef.get());
1615     priv->monospaceFontFamily = WebKit::toImpl(fixedFontFamilyRef.get())->string().utf8();
1616
1617     g_object_notify(G_OBJECT(settings), "monospace-font-family");
1618 }
1619
1620 /**
1621  * webkit_settings_get_serif_font_family:
1622  * @settings: a #WebKitSettings
1623  *
1624  * Gets the #WebKitSettings:serif-font-family property.
1625  *
1626  * Returns: The default font family used to display content marked with serif font.
1627  */
1628 const gchar* webkit_settings_get_serif_font_family(WebKitSettings* settings)
1629 {
1630     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), 0);
1631
1632     return settings->priv->serifFontFamily.data();
1633 }
1634
1635 /**
1636  * webkit_settings_set_serif_font_family:
1637  * @settings: a #WebKitSettings
1638  * @serif_font_family: the new default serif font family
1639  *
1640  * Set the #WebKitSettings:serif-font-family property.
1641  */
1642 void webkit_settings_set_serif_font_family(WebKitSettings* settings, const gchar* serifFontFamily)
1643 {
1644     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
1645     g_return_if_fail(serifFontFamily);
1646
1647     WebKitSettingsPrivate* priv = settings->priv;
1648     if (!g_strcmp0(priv->serifFontFamily.data(), serifFontFamily))
1649         return;
1650
1651     WKRetainPtr<WKStringRef> serifFontFamilyRef = adoptWK(WKStringCreateWithUTF8CString(serifFontFamily));
1652     WKPreferencesSetSerifFontFamily(priv->preferences.get(), serifFontFamilyRef.get());
1653     priv->serifFontFamily = WebKit::toImpl(serifFontFamilyRef.get())->string().utf8();
1654
1655     g_object_notify(G_OBJECT(settings), "serif-font-family");
1656 }
1657
1658 /**
1659  * webkit_settings_get_sans_serif_font_family:
1660  * @settings: a #WebKitSettings
1661  *
1662  * Gets the #WebKitSettings:sans-serif-font-family property.
1663  *
1664  * Returns: The default font family used to display content marked with sans-serif font.
1665  */
1666 const gchar* webkit_settings_get_sans_serif_font_family(WebKitSettings* settings)
1667 {
1668     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), 0);
1669
1670     return settings->priv->sansSerifFontFamily.data();
1671 }
1672
1673 /**
1674  * webkit_settings_set_sans_serif_font_family:
1675  * @settings: a #WebKitSettings
1676  * @sans_serif_font_family: the new default sans-serif font family
1677  *
1678  * Set the #WebKitSettings:sans-serif-font-family property.
1679  */
1680 void webkit_settings_set_sans_serif_font_family(WebKitSettings* settings, const gchar* sansSerifFontFamily)
1681 {
1682     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
1683     g_return_if_fail(sansSerifFontFamily);
1684
1685     WebKitSettingsPrivate* priv = settings->priv;
1686     if (!g_strcmp0(priv->sansSerifFontFamily.data(), sansSerifFontFamily))
1687         return;
1688
1689     WKRetainPtr<WKStringRef> sansSerifFontFamilyRef = adoptWK(WKStringCreateWithUTF8CString(sansSerifFontFamily));
1690     WKPreferencesSetSansSerifFontFamily(priv->preferences.get(), sansSerifFontFamilyRef.get());
1691     priv->sansSerifFontFamily = WebKit::toImpl(sansSerifFontFamilyRef.get())->string().utf8();
1692
1693     g_object_notify(G_OBJECT(settings), "sans-serif-font-family");
1694 }
1695
1696 /**
1697  * webkit_settings_get_cursive_font_family:
1698  * @settings: a #WebKitSettings
1699  *
1700  * Gets the #WebKitSettings:cursive-font-family property.
1701  *
1702  * Returns: The default font family used to display content marked with cursive font.
1703  */
1704 const gchar* webkit_settings_get_cursive_font_family(WebKitSettings* settings)
1705 {
1706     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), 0);
1707
1708     return settings->priv->cursiveFontFamily.data();
1709 }
1710
1711 /**
1712  * webkit_settings_set_cursive_font_family:
1713  * @settings: a #WebKitSettings
1714  * @cursive_font_family: the new default cursive font family
1715  *
1716  * Set the #WebKitSettings:cursive-font-family property.
1717  */
1718 void webkit_settings_set_cursive_font_family(WebKitSettings* settings, const gchar* cursiveFontFamily)
1719 {
1720     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
1721     g_return_if_fail(cursiveFontFamily);
1722
1723     WebKitSettingsPrivate* priv = settings->priv;
1724     if (!g_strcmp0(priv->cursiveFontFamily.data(), cursiveFontFamily))
1725         return;
1726
1727     WKRetainPtr<WKStringRef> cursiveFontFamilyRef = adoptWK(WKStringCreateWithUTF8CString(cursiveFontFamily));
1728     WKPreferencesSetCursiveFontFamily(priv->preferences.get(), cursiveFontFamilyRef.get());
1729     priv->cursiveFontFamily = WebKit::toImpl(cursiveFontFamilyRef.get())->string().utf8();
1730
1731     g_object_notify(G_OBJECT(settings), "cursive-font-family");
1732 }
1733
1734 /**
1735  * webkit_settings_get_fantasy_font_family:
1736  * @settings: a #WebKitSettings
1737  *
1738  * Gets the #WebKitSettings:fantasy-font-family property.
1739  *
1740  * Returns: The default font family used to display content marked with fantasy font.
1741  */
1742 const gchar* webkit_settings_get_fantasy_font_family(WebKitSettings* settings)
1743 {
1744     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), 0);
1745
1746     return settings->priv->fantasyFontFamily.data();
1747 }
1748
1749 /**
1750  * webkit_settings_set_fantasy_font_family:
1751  * @settings: a #WebKitSettings
1752  * @fantasy_font_family: the new default fantasy font family
1753  *
1754  * Set the #WebKitSettings:fantasy-font-family property.
1755  */
1756 void webkit_settings_set_fantasy_font_family(WebKitSettings* settings, const gchar* fantasyFontFamily)
1757 {
1758     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
1759     g_return_if_fail(fantasyFontFamily);
1760
1761     WebKitSettingsPrivate* priv = settings->priv;
1762     if (!g_strcmp0(priv->fantasyFontFamily.data(), fantasyFontFamily))
1763         return;
1764
1765     WKRetainPtr<WKStringRef> fantasyFontFamilyRef = adoptWK(WKStringCreateWithUTF8CString(fantasyFontFamily));
1766     WKPreferencesSetFantasyFontFamily(priv->preferences.get(), fantasyFontFamilyRef.get());
1767     priv->fantasyFontFamily = WebKit::toImpl(fantasyFontFamilyRef.get())->string().utf8();
1768
1769     g_object_notify(G_OBJECT(settings), "fantasy-font-family");
1770 }
1771
1772 /**
1773  * webkit_settings_get_pictograph_font_family:
1774  * @settings: a #WebKitSettings
1775  *
1776  * Gets the #WebKitSettings:pictograph-font-family property.
1777  *
1778  * Returns: The default font family used to display content marked with pictograph font.
1779  */
1780 const gchar* webkit_settings_get_pictograph_font_family(WebKitSettings* settings)
1781 {
1782     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), 0);
1783
1784     return settings->priv->pictographFontFamily.data();
1785 }
1786
1787 /**
1788  * webkit_settings_set_pictograph_font_family:
1789  * @settings: a #WebKitSettings
1790  * @pictograph_font_family: the new default pictograph font family
1791  *
1792  * Set the #WebKitSettings:pictograph-font-family property.
1793  */
1794 void webkit_settings_set_pictograph_font_family(WebKitSettings* settings, const gchar* pictographFontFamily)
1795 {
1796     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
1797     g_return_if_fail(pictographFontFamily);
1798
1799     WebKitSettingsPrivate* priv = settings->priv;
1800     if (!g_strcmp0(priv->pictographFontFamily.data(), pictographFontFamily))
1801         return;
1802
1803     WKRetainPtr<WKStringRef> pictographFontFamilyRef = adoptWK(WKStringCreateWithUTF8CString(pictographFontFamily));
1804     WKPreferencesSetPictographFontFamily(priv->preferences.get(), pictographFontFamilyRef.get());
1805     priv->pictographFontFamily = WebKit::toImpl(pictographFontFamilyRef.get())->string().utf8();
1806
1807     g_object_notify(G_OBJECT(settings), "pictograph-font-family");
1808 }
1809
1810 /**
1811  * webkit_settings_get_default_font_size:
1812  * @settings: a #WebKitSettings
1813  *
1814  * Gets the #WebKitSettings:default-font-size property.
1815  *
1816  * Returns: The default font size.
1817  */
1818 guint32 webkit_settings_get_default_font_size(WebKitSettings* settings)
1819 {
1820     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), 0);
1821
1822     return WKPreferencesGetDefaultFontSize(settings->priv->preferences.get());
1823 }
1824
1825 /**
1826  * webkit_settings_set_default_font_size:
1827  * @settings: a #WebKitSettings
1828  * @font_size: default font size to be set in pixels
1829  *
1830  * Set the #WebKitSettings:default-font-size property.
1831  */
1832 void webkit_settings_set_default_font_size(WebKitSettings* settings, guint32 fontSize)
1833 {
1834     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
1835
1836     WebKitSettingsPrivate* priv = settings->priv;
1837
1838     uint32_t currentSize = WKPreferencesGetDefaultFontSize(priv->preferences.get());
1839     if (currentSize == fontSize)
1840         return;
1841
1842     WKPreferencesSetDefaultFontSize(priv->preferences.get(), fontSize);
1843     g_object_notify(G_OBJECT(settings), "default-font-size");
1844 }
1845
1846 /**
1847  * webkit_settings_get_default_monospace_font_size:
1848  * @settings: a #WebKitSettings
1849  *
1850  * Gets the #WebKitSettings:default-monospace-font-size property.
1851  *
1852  * Returns: Default monospace font size.
1853  */
1854 guint32 webkit_settings_get_default_monospace_font_size(WebKitSettings* settings)
1855 {
1856     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), 0);
1857
1858     return WKPreferencesGetDefaultFixedFontSize(settings->priv->preferences.get());
1859 }
1860
1861 /**
1862  * webkit_settings_set_default_monospace_font_size:
1863  * @settings: a #WebKitSettings
1864  * @font_size: default monospace font size to be set in pixels
1865  *
1866  * Set the #WebKitSettings:default-monospace-font-size property.
1867  */
1868 void webkit_settings_set_default_monospace_font_size(WebKitSettings* settings, guint32 fontSize)
1869 {
1870     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
1871
1872     WebKitSettingsPrivate* priv = settings->priv;
1873
1874     uint32_t currentSize = WKPreferencesGetDefaultFixedFontSize(priv->preferences.get());
1875     if (currentSize == fontSize)
1876         return;
1877
1878     WKPreferencesSetDefaultFixedFontSize(priv->preferences.get(), fontSize);
1879     g_object_notify(G_OBJECT(settings), "default-monospace-font-size");
1880 }
1881
1882 /**
1883  * webkit_settings_get_minimum_font_size:
1884  * @settings: a #WebKitSettings
1885  *
1886  * Gets the #WebKitSettings:minimum-font-size property.
1887  *
1888  * Returns: Minimum font size.
1889  */
1890 guint32 webkit_settings_get_minimum_font_size(WebKitSettings* settings)
1891 {
1892     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), 0);
1893
1894     return WKPreferencesGetMinimumFontSize(settings->priv->preferences.get());
1895 }
1896
1897 /**
1898  * webkit_settings_set_minimum_font_size:
1899  * @settings: a #WebKitSettings
1900  * @font_size: minimum font size to be set in points
1901  *
1902  * Set the #WebKitSettings:minimum-font-size property.
1903  */
1904 void webkit_settings_set_minimum_font_size(WebKitSettings* settings, guint32 fontSize)
1905 {
1906     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
1907
1908     WebKitSettingsPrivate* priv = settings->priv;
1909
1910     uint32_t currentSize = WKPreferencesGetMinimumFontSize(priv->preferences.get());
1911     if (currentSize == fontSize)
1912         return;
1913
1914     WKPreferencesSetMinimumFontSize(priv->preferences.get(), fontSize);
1915     g_object_notify(G_OBJECT(settings), "minimum-font-size");
1916 }
1917
1918 /**
1919  * webkit_settings_get_default_charset:
1920  * @settings: a #WebKitSettings
1921  *
1922  * Gets the #WebKitSettings:default-charset property.
1923  *
1924  * Returns: Default charset.
1925  */
1926 const gchar* webkit_settings_get_default_charset(WebKitSettings* settings)
1927 {
1928     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), 0);
1929
1930     return settings->priv->defaultCharset.data();
1931 }
1932
1933 /**
1934  * webkit_settings_set_default_charset:
1935  * @settings: a #WebKitSettings
1936  * @default_charset: default charset to be set
1937  *
1938  * Set the #WebKitSettings:default-charset property.
1939  */
1940 void webkit_settings_set_default_charset(WebKitSettings* settings, const gchar* defaultCharset)
1941 {
1942     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
1943     g_return_if_fail(defaultCharset);
1944
1945     WebKitSettingsPrivate* priv = settings->priv;
1946     if (!g_strcmp0(priv->defaultCharset.data(), defaultCharset))
1947         return;
1948
1949     WKRetainPtr<WKStringRef> defaultCharsetRef = adoptWK(WKStringCreateWithUTF8CString(defaultCharset));
1950     WKPreferencesSetDefaultTextEncodingName(priv->preferences.get(), defaultCharsetRef.get());
1951     priv->defaultCharset = WebKit::toImpl(defaultCharsetRef.get())->string().utf8();
1952
1953     g_object_notify(G_OBJECT(settings), "default-charset");
1954 }
1955
1956 /**
1957  * webkit_settings_get_enable_private_browsing:
1958  * @settings: a #WebKitSettings
1959  *
1960  * Get the #WebKitSettings:enable-private-browsing property.
1961  *
1962  * Returns: %TRUE If private browsing is enabled or %FALSE otherwise.
1963  */
1964 gboolean webkit_settings_get_enable_private_browsing(WebKitSettings* settings)
1965 {
1966     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
1967
1968     return WKPreferencesGetPrivateBrowsingEnabled(settings->priv->preferences.get());
1969 }
1970
1971 /**
1972  * webkit_settings_set_private_caret_browsing:
1973  * @settings: a #WebKitSettings
1974  * @enabled: Value to be set
1975  *
1976  * Set the #WebKitSettings:enable-private-browsing property.
1977  */
1978 void webkit_settings_set_enable_private_browsing(WebKitSettings* settings, gboolean enabled)
1979 {
1980     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
1981
1982     WebKitSettingsPrivate* priv = settings->priv;
1983     bool currentValue = WKPreferencesGetPrivateBrowsingEnabled(priv->preferences.get());
1984     if (currentValue == enabled)
1985         return;
1986
1987     WKPreferencesSetPrivateBrowsingEnabled(priv->preferences.get(), enabled);
1988     g_object_notify(G_OBJECT(settings), "enable-private-browsing");
1989 }
1990
1991 /**
1992  * webkit_settings_get_enable_developer_extras:
1993  * @settings: a #WebKitSettings
1994  *
1995  * Get the #WebKitSettings:enable-developer-extras property.
1996  *
1997  * Returns: %TRUE If developer extras is enabled or %FALSE otherwise.
1998  */
1999 gboolean webkit_settings_get_enable_developer_extras(WebKitSettings* settings)
2000 {
2001     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
2002
2003     return WKPreferencesGetDeveloperExtrasEnabled(settings->priv->preferences.get());
2004 }
2005
2006 /**
2007  * webkit_settings_set_enable_developer_extras:
2008  * @settings: a #WebKitSettings
2009  * @enabled: Value to be set
2010  *
2011  * Set the #WebKitSettings:enable-developer-extras property.
2012  */
2013 void webkit_settings_set_enable_developer_extras(WebKitSettings* settings, gboolean enabled)
2014 {
2015     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2016
2017     WebKitSettingsPrivate* priv = settings->priv;
2018     bool currentValue = WKPreferencesGetDeveloperExtrasEnabled(priv->preferences.get());
2019     if (currentValue == enabled)
2020         return;
2021
2022     WKPreferencesSetDeveloperExtrasEnabled(priv->preferences.get(), enabled);
2023     g_object_notify(G_OBJECT(settings), "enable-developer-extras");
2024 }
2025
2026 /**
2027  * webkit_settings_get_enable_resizable_text_areas:
2028  * @settings: a #WebKitSettings
2029  *
2030  * Get the #WebKitSettings:enable-resizable-text-areas property.
2031  *
2032  * Returns: %TRUE If text areas can be resized or %FALSE otherwise.
2033  */
2034 gboolean webkit_settings_get_enable_resizable_text_areas(WebKitSettings* settings)
2035 {
2036     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
2037
2038     return WKPreferencesGetTextAreasAreResizable(settings->priv->preferences.get());
2039 }
2040
2041 /**
2042  * webkit_settings_set_enable_resizable_text_areas:
2043  * @settings: a #WebKitSettings
2044  * @enabled: Value to be set
2045  *
2046  * Set the #WebKitSettings:enable-resizable-text-areas property.
2047  */
2048 void webkit_settings_set_enable_resizable_text_areas(WebKitSettings* settings, gboolean enabled)
2049 {
2050     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2051
2052     WebKitSettingsPrivate* priv = settings->priv;
2053     bool currentValue = WKPreferencesGetTextAreasAreResizable(priv->preferences.get());
2054     if (currentValue == enabled)
2055         return;
2056
2057     WKPreferencesSetTextAreasAreResizable(priv->preferences.get(), enabled);
2058     g_object_notify(G_OBJECT(settings), "enable-resizable-text-areas");
2059 }
2060
2061 /**
2062  * webkit_settings_get_enable_tabs_to_links:
2063  * @settings: a #WebKitSettings
2064  *
2065  * Get the #WebKitSettings:enable-tabs-to-links property.
2066  *
2067  * Returns: %TRUE If tabs to link is enabled or %FALSE otherwise.
2068  */
2069 gboolean webkit_settings_get_enable_tabs_to_links(WebKitSettings* settings)
2070 {
2071     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
2072
2073     return WKPreferencesGetTabsToLinks(settings->priv->preferences.get());
2074 }
2075
2076 /**
2077  * webkit_settings_set_enable_tabs_to_links:
2078  * @settings: a #WebKitSettings
2079  * @enabled: Value to be set
2080  *
2081  * Set the #WebKitSettings:enable-tabs-to-links property.
2082  */
2083 void webkit_settings_set_enable_tabs_to_links(WebKitSettings* settings, gboolean enabled)
2084 {
2085     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2086
2087     WebKitSettingsPrivate* priv = settings->priv;
2088     bool currentValue = WKPreferencesGetTabsToLinks(priv->preferences.get());
2089     if (currentValue == enabled)
2090         return;
2091
2092     WKPreferencesSetTabsToLinks(priv->preferences.get(), enabled);
2093     g_object_notify(G_OBJECT(settings), "enable-tabs-to-links");
2094 }
2095
2096 /**
2097  * webkit_settings_get_enable_dns_prefetching:
2098  * @settings: a #WebKitSettings
2099  *
2100  * Get the #WebKitSettings:enable-dns-prefetching property.
2101  *
2102  * Returns: %TRUE If DNS prefetching is enabled or %FALSE otherwise.
2103  */
2104 gboolean webkit_settings_get_enable_dns_prefetching(WebKitSettings* settings)
2105 {
2106     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
2107
2108     return WKPreferencesGetDNSPrefetchingEnabled(settings->priv->preferences.get());
2109 }
2110
2111 /**
2112  * webkit_settings_set_enable_dns_prefetching:
2113  * @settings: a #WebKitSettings
2114  * @enabled: Value to be set
2115  *
2116  * Set the #WebKitSettings:enable-dns-prefetching property.
2117  */
2118 void webkit_settings_set_enable_dns_prefetching(WebKitSettings* settings, gboolean enabled)
2119 {
2120     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2121
2122     WebKitSettingsPrivate* priv = settings->priv;
2123     bool currentValue = WKPreferencesGetDNSPrefetchingEnabled(priv->preferences.get());
2124     if (currentValue == enabled)
2125         return;
2126
2127     WKPreferencesSetDNSPrefetchingEnabled(priv->preferences.get(), enabled);
2128     g_object_notify(G_OBJECT(settings), "enable-dns-prefetching");
2129 }
2130
2131 /**
2132  * webkit_settings_get_enable_caret_browsing:
2133  * @settings: a #WebKitSettings
2134  *
2135  * Get the #WebKitSettings:enable-caret-browsing property.
2136  *
2137  * Returns: %TRUE If caret browsing is enabled or %FALSE otherwise.
2138  */
2139 gboolean webkit_settings_get_enable_caret_browsing(WebKitSettings* settings)
2140 {
2141     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
2142
2143     return WKPreferencesGetCaretBrowsingEnabled(settings->priv->preferences.get());
2144 }
2145
2146 /**
2147  * webkit_settings_set_enable_caret_browsing:
2148  * @settings: a #WebKitSettings
2149  * @enabled: Value to be set
2150  *
2151  * Set the #WebKitSettings:enable-caret-browsing property.
2152  */
2153 void webkit_settings_set_enable_caret_browsing(WebKitSettings* settings, gboolean enabled)
2154 {
2155     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2156
2157     WebKitSettingsPrivate* priv = settings->priv;
2158     bool currentValue = WKPreferencesGetCaretBrowsingEnabled(priv->preferences.get());
2159     if (currentValue == enabled)
2160         return;
2161
2162     WKPreferencesSetCaretBrowsingEnabled(priv->preferences.get(), enabled);
2163     g_object_notify(G_OBJECT(settings), "enable-caret-browsing");
2164 }
2165
2166 /**
2167  * webkit_settings_get_enable_fullscreen:
2168  * @settings: a #WebKitSettings
2169  *
2170  * Get the #WebKitSettings:enable-fullscreen property.
2171  *
2172  * Returns: %TRUE If fullscreen support is enabled or %FALSE otherwise.
2173  */
2174 gboolean webkit_settings_get_enable_fullscreen(WebKitSettings* settings)
2175 {
2176     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
2177
2178     return WKPreferencesGetFullScreenEnabled(settings->priv->preferences.get());
2179 }
2180
2181 /**
2182  * webkit_settings_set_enable_fullscreen:
2183  * @settings: a #WebKitSettings
2184  * @enabled: Value to be set
2185  *
2186  * Set the #WebKitSettings:enable-fullscreen property.
2187  */
2188 void webkit_settings_set_enable_fullscreen(WebKitSettings* settings, gboolean enabled)
2189 {
2190     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2191
2192     WebKitSettingsPrivate* priv = settings->priv;
2193     bool currentValue = WKPreferencesGetFullScreenEnabled(priv->preferences.get());
2194     if (currentValue == enabled)
2195         return;
2196
2197     WKPreferencesSetFullScreenEnabled(priv->preferences.get(), enabled);
2198     g_object_notify(G_OBJECT(settings), "enable-fullscreen");
2199 }
2200
2201 /**
2202  * webkit_settings_get_print_backgrounds:
2203  * @settings: a #WebKitSettings
2204  *
2205  * Get the #WebKitSettings:print-backgrounds property.
2206  *
2207  * Returns: %TRUE If background images should be printed or %FALSE otherwise.
2208  */
2209 gboolean webkit_settings_get_print_backgrounds(WebKitSettings* settings)
2210 {
2211     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
2212
2213     return WKPreferencesGetShouldPrintBackgrounds(settings->priv->preferences.get());
2214 }
2215
2216 /**
2217  * webkit_settings_set_print_backgrounds:
2218  * @settings: a #WebKitSettings
2219  * @print_backgrounds: Value to be set
2220  *
2221  * Set the #WebKitSettings:print-backgrounds property.
2222  */
2223 void webkit_settings_set_print_backgrounds(WebKitSettings* settings, gboolean printBackgrounds)
2224 {
2225     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2226
2227     WebKitSettingsPrivate* priv = settings->priv;
2228     bool currentValue = WKPreferencesGetShouldPrintBackgrounds(priv->preferences.get());
2229     if (currentValue == printBackgrounds)
2230         return;
2231
2232     WKPreferencesSetShouldPrintBackgrounds(priv->preferences.get(), printBackgrounds);
2233     g_object_notify(G_OBJECT(settings), "print-backgrounds");
2234 }
2235
2236 /**
2237  * webkit_settings_get_enable_webaudio:
2238  * @settings: a #WebKitSettings
2239  *
2240  * Get the #WebKitSettings:enable-webaudio property.
2241  *
2242  * Returns: %TRUE If webaudio support is enabled or %FALSE otherwise.
2243  */
2244 gboolean webkit_settings_get_enable_webaudio(WebKitSettings* settings)
2245 {
2246     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
2247
2248     return WKPreferencesGetWebAudioEnabled(settings->priv->preferences.get());
2249 }
2250
2251 /**
2252  * webkit_settings_set_enable_webaudio:
2253  * @settings: a #WebKitSettings
2254  * @enabled: Value to be set
2255  *
2256  * Set the #WebKitSettings:enable-webaudio property.
2257  */
2258 void webkit_settings_set_enable_webaudio(WebKitSettings* settings, gboolean enabled)
2259 {
2260     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2261
2262     WebKitSettingsPrivate* priv = settings->priv;
2263     bool currentValue = WKPreferencesGetWebAudioEnabled(priv->preferences.get());
2264     if (currentValue == enabled)
2265         return;
2266
2267     WKPreferencesSetWebAudioEnabled(priv->preferences.get(), enabled);
2268     g_object_notify(G_OBJECT(settings), "enable-webaudio");
2269 }
2270
2271 /**
2272  * webkit_settings_get_enable_webgl:
2273  * @settings: a #WebKitSettings
2274  *
2275  * Get the #WebKitSettings:enable-webgl property.
2276  *
2277  * Returns: %TRUE If webgl support is enabled or %FALSE otherwise.
2278  */
2279 gboolean webkit_settings_get_enable_webgl(WebKitSettings* settings)
2280 {
2281     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
2282
2283     return WKPreferencesGetWebGLEnabled(settings->priv->preferences.get());
2284 }
2285
2286 /**
2287  * webkit_settings_set_enable_webgl:
2288  * @settings: a #WebKitSettings
2289  * @enabled: Value to be set
2290  *
2291  * Set the #WebKitSettings:enable-webgl property.
2292  */
2293 void webkit_settings_set_enable_webgl(WebKitSettings* settings, gboolean enabled)
2294 {
2295     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2296
2297     WebKitSettingsPrivate* priv = settings->priv;
2298     bool currentValue = WKPreferencesGetWebGLEnabled(priv->preferences.get());
2299     if (currentValue == enabled)
2300         return;
2301
2302     WKPreferencesSetWebGLEnabled(priv->preferences.get(), enabled);
2303     g_object_notify(G_OBJECT(settings), "enable-webgl");
2304 }
2305
2306 /**
2307  * webkit_settings_set_allow_modal_dialogs:
2308  * @settings: a #WebKitSettings
2309  * @allowed: Value to be set
2310  *
2311  * Set the #WebKitSettings:allow-modal-dialogs property.
2312  */
2313 void webkit_settings_set_allow_modal_dialogs(WebKitSettings* settings, gboolean allowed)
2314 {
2315     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2316
2317     WebKitSettingsPrivate* priv = settings->priv;
2318     if (priv->allowModalDialogs == allowed)
2319         return;
2320
2321     priv->allowModalDialogs = allowed;
2322     g_object_notify(G_OBJECT(settings), "allow-modal-dialogs");
2323 }
2324
2325 /**
2326  * webkit_settings_get_allow_modal_dialogs:
2327  * @settings: a #WebKitSettings
2328  *
2329  * Get the #WebKitSettings:allow-modal-dialogs property.
2330  *
2331  * Returns: %TRUE if it's allowed to create and run modal dialogs or %FALSE otherwise.
2332  */
2333 gboolean webkit_settings_get_allow_modal_dialogs(WebKitSettings* settings)
2334 {
2335     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
2336     return settings->priv->allowModalDialogs;
2337 }
2338
2339 /**
2340  * webkit_settings_set_zoom_text_only:
2341  * @settings: a #WebKitSettings
2342  * @zoom_text_only: Value to be set
2343  *
2344  * Set the #WebKitSettings:zoom-text-only property.
2345  */
2346 void webkit_settings_set_zoom_text_only(WebKitSettings* settings, gboolean zoomTextOnly)
2347 {
2348     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2349
2350     WebKitSettingsPrivate* priv = settings->priv;
2351     if (priv->zoomTextOnly == zoomTextOnly)
2352         return;
2353
2354     priv->zoomTextOnly = zoomTextOnly;
2355     g_object_notify(G_OBJECT(settings), "zoom-text-only");
2356 }
2357
2358 /**
2359  * webkit_settings_get_zoom_text_only:
2360  * @settings: a #WebKitSettings
2361  *
2362  * Get the #WebKitSettings:zoom-text-only property.
2363  *
2364  * Returns: %TRUE If zoom level of the view should only affect the text
2365  *    or %FALSE if all view contents should be scaled.
2366  */
2367 gboolean webkit_settings_get_zoom_text_only(WebKitSettings* settings)
2368 {
2369     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
2370
2371     return settings->priv->zoomTextOnly;
2372 }
2373
2374 /**
2375  * webkit_settings_get_javascript_can_access_clipboard:
2376  * @settings: a #WebKitSettings
2377  *
2378  * Get the #WebKitSettings:javascript-can-access-clipboard property.
2379  *
2380  * Returns: %TRUE If javascript-can-access-clipboard is enabled or %FALSE otherwise.
2381  */
2382 gboolean webkit_settings_get_javascript_can_access_clipboard(WebKitSettings* settings)
2383 {
2384     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
2385
2386     return WKPreferencesGetJavaScriptCanAccessClipboard(settings->priv->preferences.get())
2387             && WKPreferencesGetDOMPasteAllowed(settings->priv->preferences.get());
2388 }
2389
2390 /**
2391  * webkit_settings_set_javascript_can_access_clipboard:
2392  * @settings: a #WebKitSettings
2393  * @enabled: Value to be set
2394  *
2395  * Set the #WebKitSettings:javascript-can-access-clipboard property.
2396  */
2397 void webkit_settings_set_javascript_can_access_clipboard(WebKitSettings* settings, gboolean enabled)
2398 {
2399     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2400
2401     WebKitSettingsPrivate* priv = settings->priv;
2402     bool currentValue = WKPreferencesGetJavaScriptCanAccessClipboard(priv->preferences.get())
2403             && WKPreferencesGetDOMPasteAllowed(priv->preferences.get());
2404     if (currentValue == enabled)
2405         return;
2406
2407     WKPreferencesSetJavaScriptCanAccessClipboard(priv->preferences.get(), enabled);
2408     WKPreferencesSetDOMPasteAllowed(priv->preferences.get(), enabled);
2409
2410     g_object_notify(G_OBJECT(settings), "javascript-can-access-clipboard");
2411 }
2412
2413 /**
2414  * webkit_settings_set_media_playback_requires_user_gesture:
2415  * @settings: a #WebKitSettings
2416  * @enabled: Value to be set
2417  *
2418  * Set the #WebKitSettings:media-playback-requires-user-gesture property.
2419  */
2420 void webkit_settings_set_media_playback_requires_user_gesture(WebKitSettings* settings, gboolean enabled)
2421 {
2422     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2423
2424     WebKitSettingsPrivate* priv = settings->priv;
2425     bool currentValue = WKPreferencesGetMediaPlaybackRequiresUserGesture(priv->preferences.get());
2426     if (currentValue == enabled)
2427         return;
2428
2429     WKPreferencesSetMediaPlaybackRequiresUserGesture(priv->preferences.get(), enabled);
2430
2431     g_object_notify(G_OBJECT(settings), "media-playback-requires-user-gesture");
2432 }
2433
2434 /**
2435  * webkit_settings_get_media_playback_requires_user_gesture:
2436  * @settings: a #WebKitSettings
2437  *
2438  * Get the #WebKitSettings:media-playback-requires-user-gesture property.
2439  *
2440  * Returns: %TRUE If an user gesture is needed to play or load media
2441  *    or %FALSE if no user gesture is needed.
2442  */
2443 gboolean webkit_settings_get_media_playback_requires_user_gesture(WebKitSettings* settings)
2444 {
2445     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
2446
2447     return WKPreferencesGetMediaPlaybackRequiresUserGesture(settings->priv->preferences.get());
2448 }
2449
2450 /**
2451  * webkit_settings_set_media_playback_allows_inline:
2452  * @settings: a #WebKitSettings
2453  * @enabled: Value to be set
2454  *
2455  * Set the #WebKitSettings:media-playback-allows-inline property.
2456  */
2457 void webkit_settings_set_media_playback_allows_inline(WebKitSettings* settings, gboolean enabled)
2458 {
2459     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2460
2461     WebKitSettingsPrivate* priv = settings->priv;
2462     bool currentValue = WKPreferencesGetMediaPlaybackAllowsInline(priv->preferences.get());
2463     if (currentValue == enabled)
2464         return;
2465
2466     WKPreferencesSetMediaPlaybackAllowsInline(priv->preferences.get(), enabled);
2467
2468     g_object_notify(G_OBJECT(settings), "media-playback-allows-inline");
2469 }
2470
2471 /**
2472  * webkit_settings_get_media_playback_allows_inline:
2473  * @settings: a #WebKitSettings
2474  *
2475  * Get the #WebKitSettings:media-playback-allows-inline property.
2476  *
2477  * Returns: %TRUE If inline playback is allowed for media
2478  *    or %FALSE if only fullscreen playback is allowed.
2479  */
2480 gboolean webkit_settings_get_media_playback_allows_inline(WebKitSettings* settings)
2481 {
2482     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), TRUE);
2483
2484     return WKPreferencesGetMediaPlaybackAllowsInline(settings->priv->preferences.get());
2485 }
2486
2487 /**
2488  * webkit_settings_set_draw_compositing_indicators:
2489  * @settings: a #WebKitSettings
2490  * @enabled: Value to be set
2491  *
2492  * Set the #WebKitSettings:draw-compositing-indicators property.
2493  */
2494 void webkit_settings_set_draw_compositing_indicators(WebKitSettings* settings, gboolean enabled)
2495 {
2496     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2497
2498     WebKitSettingsPrivate* priv = settings->priv;
2499     if (WKPreferencesGetCompositingBordersVisible(priv->preferences.get()) == enabled
2500         && WKPreferencesGetCompositingRepaintCountersVisible(priv->preferences.get()) == enabled)
2501         return;
2502
2503     WKPreferencesSetCompositingBordersVisible(priv->preferences.get(), enabled);
2504     WKPreferencesSetCompositingRepaintCountersVisible(priv->preferences.get(), enabled);
2505     g_object_notify(G_OBJECT(settings), "draw-compositing-indicators");
2506 }
2507
2508 /**
2509  * webkit_settings_get_draw_compositing_indicators:
2510  * @settings: a #WebKitSettings
2511  *
2512  * Get the #WebKitSettings:draw-compositing-indicators property.
2513  *
2514  * Returns: %TRUE If compositing borders are drawn or %FALSE otherwise.
2515  */
2516 gboolean webkit_settings_get_draw_compositing_indicators(WebKitSettings* settings)
2517 {
2518     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
2519     return WKPreferencesGetCompositingBordersVisible(settings->priv->preferences.get())
2520            && WKPreferencesGetCompositingRepaintCountersVisible(settings->priv->preferences.get());
2521 }
2522
2523 /**
2524  * webkit_settings_get_enable_site_specific_quirks:
2525  * @settings: a #WebKitSettings
2526  *
2527  * Get the #WebKitSettings:enable-site-specific-quirks property.
2528  *
2529  * Returns: %TRUE if site specific quirks are enabled or %FALSE otherwise.
2530  */
2531 gboolean webkit_settings_get_enable_site_specific_quirks(WebKitSettings* settings)
2532 {
2533     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
2534
2535     return WKPreferencesGetNeedsSiteSpecificQuirks(settings->priv->preferences.get());
2536 }
2537
2538 /**
2539  * webkit_settings_set_enable_site_specific_quirks:
2540  * @settings: a #WebKitSettings
2541  * @enabled: Value to be set
2542  *
2543  * Set the #WebKitSettings:enable-site-specific-quirks property.
2544  */
2545 void webkit_settings_set_enable_site_specific_quirks(WebKitSettings* settings, gboolean enabled)
2546 {
2547     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2548
2549     WebKitSettingsPrivate* priv = settings->priv;
2550     bool currentValue = WKPreferencesGetNeedsSiteSpecificQuirks(priv->preferences.get());
2551     if (currentValue == enabled)
2552         return;
2553
2554     WKPreferencesSetNeedsSiteSpecificQuirks(priv->preferences.get(), enabled);
2555     g_object_notify(G_OBJECT(settings), "enable-site-specific-quirks");
2556 }
2557
2558 /**
2559  * webkit_settings_get_enable_page_cache:
2560  * @settings: a #WebKitSettings
2561  *
2562  * Get the #WebKitSettings:enable-page-cache property.
2563  *
2564  * Returns: %TRUE if page cache enabled or %FALSE otherwise.
2565  */
2566 gboolean webkit_settings_get_enable_page_cache(WebKitSettings* settings)
2567 {
2568     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
2569
2570     return WKPreferencesGetPageCacheEnabled(settings->priv->preferences.get());
2571 }
2572
2573 /**
2574  * webkit_settings_set_enable_page_cache:
2575  * @settings: a #WebKitSettings
2576  * @enabled: Value to be set
2577  *
2578  * Set the #WebKitSettings:enable-page-cache property.
2579  */
2580 void webkit_settings_set_enable_page_cache(WebKitSettings* settings, gboolean enabled)
2581 {
2582     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2583
2584     WebKitSettingsPrivate* priv = settings->priv;
2585     bool currentValue = WKPreferencesGetPageCacheEnabled(priv->preferences.get());
2586     if (currentValue == enabled)
2587         return;
2588
2589     WKPreferencesSetPageCacheEnabled(priv->preferences.get(), enabled);
2590     g_object_notify(G_OBJECT(settings), "enable-page-cache");
2591 }
2592
2593 /**
2594  * webkit_settings_get_user_agent:
2595  * @settings: a #WebKitSettings
2596  *
2597  * Get the #WebKitSettings:user-agent property.
2598  *
2599  * Returns: The current value of the user-agent property.
2600  */
2601 const char* webkit_settings_get_user_agent(WebKitSettings* settings)
2602 {
2603     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), 0);
2604
2605     WebKitSettingsPrivate* priv = settings->priv;
2606     ASSERT(!priv->userAgent.isNull());
2607     return priv->userAgent.data();
2608 }
2609
2610 /**
2611  * webkit_settings_set_user_agent:
2612  * @settings: a #WebKitSettings
2613  * @user_agent: (allow-none): The new custom user agent string or %NULL to use the default user agent
2614  *
2615  * Set the #WebKitSettings:user-agent property.
2616  */
2617 void webkit_settings_set_user_agent(WebKitSettings* settings, const char* userAgent)
2618 {
2619     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2620
2621     WebKitSettingsPrivate* priv = settings->priv;
2622     CString newUserAgent = (!userAgent || !strlen(userAgent)) ? WebCore::standardUserAgent("").utf8() : userAgent;
2623     if (newUserAgent == priv->userAgent)
2624         return;
2625
2626     priv->userAgent = newUserAgent;
2627     g_object_notify(G_OBJECT(settings), "user-agent");
2628 }
2629
2630 /**
2631  * webkit_settings_set_user_agent_with_application_details:
2632  * @settings: a #WebKitSettings
2633  * @application_name: (allow-none): The application name used for the user agent or %NULL to use the default user agent.
2634  * @application_version: (allow-none): The application version for the user agent or %NULL to user the default version.
2635  *
2636  * Set the #WebKitSettings:user-agent property by appending the application details to the default user
2637  * agent. If no application name or version is given, the default user agent used will be used. If only
2638  * the version is given, the default engine version is used with the given application name.
2639  */
2640 void webkit_settings_set_user_agent_with_application_details(WebKitSettings* settings, const char* applicationName, const char* applicationVersion)
2641 {
2642     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2643
2644     CString newUserAgent = WebCore::standardUserAgent(String::fromUTF8(applicationName), String::fromUTF8(applicationVersion)).utf8();
2645     webkit_settings_set_user_agent(settings, newUserAgent.data());
2646 }