[Settings] Remove all custom code from Settings.h/cpp
[WebKit.git] / Source / WebKit / UIProcess / API / glib / 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 "WebKitEnumTypes.h"
35 #include "WebKitSettingsPrivate.h"
36 #include "WebPageProxy.h"
37 #include "WebPreferences.h"
38 #include <WebCore/UserAgent.h>
39 #include <glib/gi18n-lib.h>
40 #include <wtf/glib/WTFGType.h>
41 #include <wtf/text/CString.h>
42
43 #if PLATFORM(GTK)
44 #include "HardwareAccelerationManager.h"
45 #endif
46
47 #if PLATFORM(WAYLAND)
48 #include <WebCore/PlatformDisplay.h>
49 #endif
50
51 using namespace WebKit;
52
53 struct _WebKitSettingsPrivate {
54     _WebKitSettingsPrivate()
55         : preferences(WebPreferences::create(String(), "WebKit2.", "WebKit2."))
56     {
57         defaultFontFamily = preferences->standardFontFamily().utf8();
58         monospaceFontFamily = preferences->fixedFontFamily().utf8();
59         serifFontFamily = preferences->serifFontFamily().utf8();
60         sansSerifFontFamily = preferences->sansSerifFontFamily().utf8();
61         cursiveFontFamily = preferences->cursiveFontFamily().utf8();
62         fantasyFontFamily = preferences->fantasyFontFamily().utf8();
63         pictographFontFamily = preferences->pictographFontFamily().utf8();
64         defaultCharset = preferences->defaultTextEncodingName().utf8();
65     }
66
67     RefPtr<WebPreferences> preferences;
68     CString defaultFontFamily;
69     CString monospaceFontFamily;
70     CString serifFontFamily;
71     CString sansSerifFontFamily;
72     CString cursiveFontFamily;
73     CString fantasyFontFamily;
74     CString pictographFontFamily;
75     CString defaultCharset;
76     CString userAgent;
77     bool allowModalDialogs { false };
78     bool zoomTextOnly { false };
79 };
80
81 /**
82  * SECTION:WebKitSettings
83  * @short_description: Control the behaviour of a #WebKitWebView
84  *
85  * #WebKitSettings can be applied to a #WebKitWebView to control text charset,
86  * color, font sizes, printing mode, script support, loading of images and various
87  * other things on a #WebKitWebView. After creation, a #WebKitSettings object
88  * contains default settings.
89  *
90  * <informalexample><programlisting>
91  * /<!-- -->* Disable JavaScript. *<!-- -->/
92  * WebKitSettings *settings = webkit_web_view_group_get_settings (my_view_group);
93  * webkit_settings_set_enable_javascript (settings, FALSE);
94  *
95  * </programlisting></informalexample>
96  */
97
98 WEBKIT_DEFINE_TYPE(WebKitSettings, webkit_settings, G_TYPE_OBJECT)
99
100 enum {
101     PROP_0,
102
103     PROP_ENABLE_JAVASCRIPT,
104     PROP_AUTO_LOAD_IMAGES,
105     PROP_LOAD_ICONS_IGNORING_IMAGE_LOAD_SETTING,
106     PROP_ENABLE_OFFLINE_WEB_APPLICATION_CACHE,
107     PROP_ENABLE_HTML5_LOCAL_STORAGE,
108     PROP_ENABLE_HTML5_DATABASE,
109     PROP_ENABLE_XSS_AUDITOR,
110     PROP_ENABLE_FRAME_FLATTENING,
111     PROP_ENABLE_PLUGINS,
112     PROP_ENABLE_JAVA,
113     PROP_JAVASCRIPT_CAN_OPEN_WINDOWS_AUTOMATICALLY,
114     PROP_ENABLE_HYPERLINK_AUDITING,
115     PROP_DEFAULT_FONT_FAMILY,
116     PROP_MONOSPACE_FONT_FAMILY,
117     PROP_SERIF_FONT_FAMILY,
118     PROP_SANS_SERIF_FONT_FAMILY,
119     PROP_CURSIVE_FONT_FAMILY,
120     PROP_FANTASY_FONT_FAMILY,
121     PROP_PICTOGRAPH_FONT_FAMILY,
122     PROP_DEFAULT_FONT_SIZE,
123     PROP_DEFAULT_MONOSPACE_FONT_SIZE,
124     PROP_MINIMUM_FONT_SIZE,
125     PROP_DEFAULT_CHARSET,
126     PROP_ENABLE_PRIVATE_BROWSING,
127     PROP_ENABLE_DEVELOPER_EXTRAS,
128     PROP_ENABLE_RESIZABLE_TEXT_AREAS,
129     PROP_ENABLE_TABS_TO_LINKS,
130     PROP_ENABLE_DNS_PREFETCHING,
131     PROP_ENABLE_CARET_BROWSING,
132     PROP_ENABLE_FULLSCREEN,
133     PROP_PRINT_BACKGROUNDS,
134     PROP_ENABLE_WEBAUDIO,
135     PROP_ENABLE_WEBGL,
136     PROP_ALLOW_MODAL_DIALOGS,
137     PROP_ZOOM_TEXT_ONLY,
138     PROP_JAVASCRIPT_CAN_ACCESS_CLIPBOARD,
139     PROP_MEDIA_PLAYBACK_REQUIRES_USER_GESTURE,
140     PROP_MEDIA_PLAYBACK_ALLOWS_INLINE,
141     PROP_DRAW_COMPOSITING_INDICATORS,
142     PROP_ENABLE_SITE_SPECIFIC_QUIRKS,
143     PROP_ENABLE_PAGE_CACHE,
144     PROP_USER_AGENT,
145     PROP_ENABLE_SMOOTH_SCROLLING,
146     PROP_ENABLE_ACCELERATED_2D_CANVAS,
147     PROP_ENABLE_WRITE_CONSOLE_MESSAGES_TO_STDOUT,
148     PROP_ENABLE_MEDIA_STREAM,
149     PROP_ENABLE_SPATIAL_NAVIGATION,
150     PROP_ENABLE_MEDIASOURCE,
151     PROP_ALLOW_FILE_ACCESS_FROM_FILE_URLS,
152     PROP_ALLOW_UNIVERSAL_ACCESS_FROM_FILE_URLS,
153 #if PLATFORM(GTK)
154     PROP_HARDWARE_ACCELERATION_POLICY,
155 #endif
156 };
157
158 static void webKitSettingsConstructed(GObject* object)
159 {
160     G_OBJECT_CLASS(webkit_settings_parent_class)->constructed(object);
161
162     WebPreferences* prefs = WEBKIT_SETTINGS(object)->priv->preferences.get();
163     prefs->setShouldRespectImageOrientation(true);
164 }
165
166 static void webKitSettingsSetProperty(GObject* object, guint propId, const GValue* value, GParamSpec* paramSpec)
167 {
168     WebKitSettings* settings = WEBKIT_SETTINGS(object);
169
170     switch (propId) {
171     case PROP_ENABLE_JAVASCRIPT:
172         webkit_settings_set_enable_javascript(settings, g_value_get_boolean(value));
173         break;
174     case PROP_AUTO_LOAD_IMAGES:
175         webkit_settings_set_auto_load_images(settings, g_value_get_boolean(value));
176         break;
177     case PROP_LOAD_ICONS_IGNORING_IMAGE_LOAD_SETTING:
178         webkit_settings_set_load_icons_ignoring_image_load_setting(settings, g_value_get_boolean(value));
179         break;
180     case PROP_ENABLE_OFFLINE_WEB_APPLICATION_CACHE:
181         webkit_settings_set_enable_offline_web_application_cache(settings, g_value_get_boolean(value));
182         break;
183     case PROP_ENABLE_HTML5_LOCAL_STORAGE:
184         webkit_settings_set_enable_html5_local_storage(settings, g_value_get_boolean(value));
185         break;
186     case PROP_ENABLE_HTML5_DATABASE:
187         webkit_settings_set_enable_html5_database(settings, g_value_get_boolean(value));
188         break;
189     case PROP_ENABLE_XSS_AUDITOR:
190         webkit_settings_set_enable_xss_auditor(settings, g_value_get_boolean(value));
191         break;
192     case PROP_ENABLE_FRAME_FLATTENING:
193         webkit_settings_set_enable_frame_flattening(settings, g_value_get_boolean(value));
194         break;
195     case PROP_ENABLE_PLUGINS:
196         webkit_settings_set_enable_plugins(settings, g_value_get_boolean(value));
197         break;
198     case PROP_ENABLE_JAVA:
199         webkit_settings_set_enable_java(settings, g_value_get_boolean(value));
200         break;
201     case PROP_JAVASCRIPT_CAN_OPEN_WINDOWS_AUTOMATICALLY:
202         webkit_settings_set_javascript_can_open_windows_automatically(settings, g_value_get_boolean(value));
203         break;
204     case PROP_ENABLE_HYPERLINK_AUDITING:
205         webkit_settings_set_enable_hyperlink_auditing(settings, g_value_get_boolean(value));
206         break;
207     case PROP_DEFAULT_FONT_FAMILY:
208         webkit_settings_set_default_font_family(settings, g_value_get_string(value));
209         break;
210     case PROP_MONOSPACE_FONT_FAMILY:
211         webkit_settings_set_monospace_font_family(settings, g_value_get_string(value));
212         break;
213     case PROP_SERIF_FONT_FAMILY:
214         webkit_settings_set_serif_font_family(settings, g_value_get_string(value));
215         break;
216     case PROP_SANS_SERIF_FONT_FAMILY:
217         webkit_settings_set_sans_serif_font_family(settings, g_value_get_string(value));
218         break;
219     case PROP_CURSIVE_FONT_FAMILY:
220         webkit_settings_set_cursive_font_family(settings, g_value_get_string(value));
221         break;
222     case PROP_FANTASY_FONT_FAMILY:
223         webkit_settings_set_fantasy_font_family(settings, g_value_get_string(value));
224         break;
225     case PROP_PICTOGRAPH_FONT_FAMILY:
226         webkit_settings_set_pictograph_font_family(settings, g_value_get_string(value));
227         break;
228     case PROP_DEFAULT_FONT_SIZE:
229         webkit_settings_set_default_font_size(settings, g_value_get_uint(value));
230         break;
231     case PROP_DEFAULT_MONOSPACE_FONT_SIZE:
232         webkit_settings_set_default_monospace_font_size(settings, g_value_get_uint(value));
233         break;
234     case PROP_MINIMUM_FONT_SIZE:
235         webkit_settings_set_minimum_font_size(settings, g_value_get_uint(value));
236         break;
237     case PROP_DEFAULT_CHARSET:
238         webkit_settings_set_default_charset(settings, g_value_get_string(value));
239         break;
240     case PROP_ENABLE_PRIVATE_BROWSING:
241         G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
242         webkit_settings_set_enable_private_browsing(settings, g_value_get_boolean(value));
243         G_GNUC_END_IGNORE_DEPRECATIONS;
244         break;
245     case PROP_ENABLE_DEVELOPER_EXTRAS:
246         webkit_settings_set_enable_developer_extras(settings, g_value_get_boolean(value));
247         break;
248     case PROP_ENABLE_RESIZABLE_TEXT_AREAS:
249         webkit_settings_set_enable_resizable_text_areas(settings, g_value_get_boolean(value));
250         break;
251     case PROP_ENABLE_TABS_TO_LINKS:
252         webkit_settings_set_enable_tabs_to_links(settings, g_value_get_boolean(value));
253         break;
254     case PROP_ENABLE_DNS_PREFETCHING:
255         webkit_settings_set_enable_dns_prefetching(settings, g_value_get_boolean(value));
256         break;
257     case PROP_ENABLE_CARET_BROWSING:
258         webkit_settings_set_enable_caret_browsing(settings, g_value_get_boolean(value));
259         break;
260     case PROP_ENABLE_FULLSCREEN:
261         webkit_settings_set_enable_fullscreen(settings, g_value_get_boolean(value));
262         break;
263     case PROP_PRINT_BACKGROUNDS:
264         webkit_settings_set_print_backgrounds(settings, g_value_get_boolean(value));
265         break;
266     case PROP_ENABLE_WEBAUDIO:
267         webkit_settings_set_enable_webaudio(settings, g_value_get_boolean(value));
268         break;
269     case PROP_ENABLE_WEBGL:
270         webkit_settings_set_enable_webgl(settings, g_value_get_boolean(value));
271         break;
272     case PROP_ALLOW_MODAL_DIALOGS:
273         webkit_settings_set_allow_modal_dialogs(settings, g_value_get_boolean(value));
274         break;
275     case PROP_ZOOM_TEXT_ONLY:
276         webkit_settings_set_zoom_text_only(settings, g_value_get_boolean(value));
277         break;
278     case PROP_JAVASCRIPT_CAN_ACCESS_CLIPBOARD:
279         webkit_settings_set_javascript_can_access_clipboard(settings, g_value_get_boolean(value));
280         break;
281     case PROP_MEDIA_PLAYBACK_REQUIRES_USER_GESTURE:
282         webkit_settings_set_media_playback_requires_user_gesture(settings, g_value_get_boolean(value));
283         break;
284     case PROP_MEDIA_PLAYBACK_ALLOWS_INLINE:
285         webkit_settings_set_media_playback_allows_inline(settings, g_value_get_boolean(value));
286         break;
287     case PROP_DRAW_COMPOSITING_INDICATORS:
288         if (g_value_get_boolean(value))
289             webkit_settings_set_draw_compositing_indicators(settings, g_value_get_boolean(value));
290         else {
291             char* debugVisualsEnvironment = getenv("WEBKIT_SHOW_COMPOSITING_DEBUG_VISUALS");
292             bool showDebugVisuals = debugVisualsEnvironment && !strcmp(debugVisualsEnvironment, "1");
293             webkit_settings_set_draw_compositing_indicators(settings, showDebugVisuals);
294         }
295         break;
296     case PROP_ENABLE_SITE_SPECIFIC_QUIRKS:
297         webkit_settings_set_enable_site_specific_quirks(settings, g_value_get_boolean(value));
298         break;
299     case PROP_ENABLE_PAGE_CACHE:
300         webkit_settings_set_enable_page_cache(settings, g_value_get_boolean(value));
301         break;
302     case PROP_USER_AGENT:
303         webkit_settings_set_user_agent(settings, g_value_get_string(value));
304         break;
305     case PROP_ENABLE_SMOOTH_SCROLLING:
306         webkit_settings_set_enable_smooth_scrolling(settings, g_value_get_boolean(value));
307         break;
308     case PROP_ENABLE_ACCELERATED_2D_CANVAS:
309         webkit_settings_set_enable_accelerated_2d_canvas(settings, g_value_get_boolean(value));
310         break;
311     case PROP_ENABLE_WRITE_CONSOLE_MESSAGES_TO_STDOUT:
312         webkit_settings_set_enable_write_console_messages_to_stdout(settings, g_value_get_boolean(value));
313         break;
314     case PROP_ENABLE_MEDIA_STREAM:
315         webkit_settings_set_enable_media_stream(settings, g_value_get_boolean(value));
316         break;
317     case PROP_ENABLE_SPATIAL_NAVIGATION:
318         webkit_settings_set_enable_spatial_navigation(settings, g_value_get_boolean(value));
319         break;
320     case PROP_ENABLE_MEDIASOURCE:
321         webkit_settings_set_enable_mediasource(settings, g_value_get_boolean(value));
322         break;
323     case PROP_ALLOW_FILE_ACCESS_FROM_FILE_URLS:
324         webkit_settings_set_allow_file_access_from_file_urls(settings, g_value_get_boolean(value));
325         break;
326     case PROP_ALLOW_UNIVERSAL_ACCESS_FROM_FILE_URLS:
327         webkit_settings_set_allow_universal_access_from_file_urls(settings, g_value_get_boolean(value));
328         break;
329 #if PLATFORM(GTK)
330     case PROP_HARDWARE_ACCELERATION_POLICY:
331         webkit_settings_set_hardware_acceleration_policy(settings, static_cast<WebKitHardwareAccelerationPolicy>(g_value_get_enum(value)));
332         break;
333 #endif
334     default:
335         G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, paramSpec);
336         break;
337     }
338 }
339
340 static void webKitSettingsGetProperty(GObject* object, guint propId, GValue* value, GParamSpec* paramSpec)
341 {
342     WebKitSettings* settings = WEBKIT_SETTINGS(object);
343
344     switch (propId) {
345     case PROP_ENABLE_JAVASCRIPT:
346         g_value_set_boolean(value, webkit_settings_get_enable_javascript(settings));
347         break;
348     case PROP_AUTO_LOAD_IMAGES:
349         g_value_set_boolean(value, webkit_settings_get_auto_load_images(settings));
350         break;
351     case PROP_LOAD_ICONS_IGNORING_IMAGE_LOAD_SETTING:
352         g_value_set_boolean(value, webkit_settings_get_load_icons_ignoring_image_load_setting(settings));
353         break;
354     case PROP_ENABLE_OFFLINE_WEB_APPLICATION_CACHE:
355         g_value_set_boolean(value, webkit_settings_get_enable_offline_web_application_cache(settings));
356         break;
357     case PROP_ENABLE_HTML5_LOCAL_STORAGE:
358         g_value_set_boolean(value, webkit_settings_get_enable_html5_local_storage(settings));
359         break;
360     case PROP_ENABLE_HTML5_DATABASE:
361         g_value_set_boolean(value, webkit_settings_get_enable_html5_database(settings));
362         break;
363     case PROP_ENABLE_XSS_AUDITOR:
364         g_value_set_boolean(value, webkit_settings_get_enable_xss_auditor(settings));
365         break;
366     case PROP_ENABLE_FRAME_FLATTENING:
367         g_value_set_boolean(value, webkit_settings_get_enable_frame_flattening(settings));
368         break;
369     case PROP_ENABLE_PLUGINS:
370         g_value_set_boolean(value, webkit_settings_get_enable_plugins(settings));
371         break;
372     case PROP_ENABLE_JAVA:
373         g_value_set_boolean(value, webkit_settings_get_enable_java(settings));
374         break;
375     case PROP_JAVASCRIPT_CAN_OPEN_WINDOWS_AUTOMATICALLY:
376         g_value_set_boolean(value, webkit_settings_get_javascript_can_open_windows_automatically(settings));
377         break;
378     case PROP_ENABLE_HYPERLINK_AUDITING:
379         g_value_set_boolean(value, webkit_settings_get_enable_hyperlink_auditing(settings));
380         break;
381     case PROP_DEFAULT_FONT_FAMILY:
382         g_value_set_string(value, webkit_settings_get_default_font_family(settings));
383         break;
384     case PROP_MONOSPACE_FONT_FAMILY:
385         g_value_set_string(value, webkit_settings_get_monospace_font_family(settings));
386         break;
387     case PROP_SERIF_FONT_FAMILY:
388         g_value_set_string(value, webkit_settings_get_serif_font_family(settings));
389         break;
390     case PROP_SANS_SERIF_FONT_FAMILY:
391         g_value_set_string(value, webkit_settings_get_sans_serif_font_family(settings));
392         break;
393     case PROP_CURSIVE_FONT_FAMILY:
394         g_value_set_string(value, webkit_settings_get_cursive_font_family(settings));
395         break;
396     case PROP_FANTASY_FONT_FAMILY:
397         g_value_set_string(value, webkit_settings_get_fantasy_font_family(settings));
398         break;
399     case PROP_PICTOGRAPH_FONT_FAMILY:
400         g_value_set_string(value, webkit_settings_get_pictograph_font_family(settings));
401         break;
402     case PROP_DEFAULT_FONT_SIZE:
403         g_value_set_uint(value, webkit_settings_get_default_font_size(settings));
404         break;
405     case PROP_DEFAULT_MONOSPACE_FONT_SIZE:
406         g_value_set_uint(value, webkit_settings_get_default_monospace_font_size(settings));
407         break;
408     case PROP_MINIMUM_FONT_SIZE:
409         g_value_set_uint(value, webkit_settings_get_minimum_font_size(settings));
410         break;
411     case PROP_DEFAULT_CHARSET:
412         g_value_set_string(value, webkit_settings_get_default_charset(settings));
413         break;
414     case PROP_ENABLE_PRIVATE_BROWSING:
415         G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
416         g_value_set_boolean(value, webkit_settings_get_enable_private_browsing(settings));
417         G_GNUC_END_IGNORE_DEPRECATIONS;
418         break;
419     case PROP_ENABLE_DEVELOPER_EXTRAS:
420         g_value_set_boolean(value, webkit_settings_get_enable_developer_extras(settings));
421         break;
422     case PROP_ENABLE_RESIZABLE_TEXT_AREAS:
423         g_value_set_boolean(value, webkit_settings_get_enable_resizable_text_areas(settings));
424         break;
425     case PROP_ENABLE_TABS_TO_LINKS:
426         g_value_set_boolean(value, webkit_settings_get_enable_tabs_to_links(settings));
427         break;
428     case PROP_ENABLE_DNS_PREFETCHING:
429         g_value_set_boolean(value, webkit_settings_get_enable_dns_prefetching(settings));
430         break;
431     case PROP_ENABLE_CARET_BROWSING:
432         g_value_set_boolean(value, webkit_settings_get_enable_caret_browsing(settings));
433         break;
434     case PROP_ENABLE_FULLSCREEN:
435         g_value_set_boolean(value, webkit_settings_get_enable_fullscreen(settings));
436         break;
437     case PROP_PRINT_BACKGROUNDS:
438         g_value_set_boolean(value, webkit_settings_get_print_backgrounds(settings));
439         break;
440     case PROP_ENABLE_WEBAUDIO:
441         g_value_set_boolean(value, webkit_settings_get_enable_webaudio(settings));
442         break;
443     case PROP_ENABLE_WEBGL:
444         g_value_set_boolean(value, webkit_settings_get_enable_webgl(settings));
445         break;
446     case PROP_ALLOW_MODAL_DIALOGS:
447         g_value_set_boolean(value, webkit_settings_get_allow_modal_dialogs(settings));
448         break;
449     case PROP_ZOOM_TEXT_ONLY:
450         g_value_set_boolean(value, webkit_settings_get_zoom_text_only(settings));
451         break;
452     case PROP_JAVASCRIPT_CAN_ACCESS_CLIPBOARD:
453         g_value_set_boolean(value, webkit_settings_get_javascript_can_access_clipboard(settings));
454         break;
455     case PROP_MEDIA_PLAYBACK_REQUIRES_USER_GESTURE:
456         g_value_set_boolean(value, webkit_settings_get_media_playback_requires_user_gesture(settings));
457         break;
458     case PROP_MEDIA_PLAYBACK_ALLOWS_INLINE:
459         g_value_set_boolean(value, webkit_settings_get_media_playback_allows_inline(settings));
460         break;
461     case PROP_DRAW_COMPOSITING_INDICATORS:
462         g_value_set_boolean(value, webkit_settings_get_draw_compositing_indicators(settings));
463         break;
464     case PROP_ENABLE_SITE_SPECIFIC_QUIRKS:
465         g_value_set_boolean(value, webkit_settings_get_enable_site_specific_quirks(settings));
466         break;
467     case PROP_ENABLE_PAGE_CACHE:
468         g_value_set_boolean(value, webkit_settings_get_enable_page_cache(settings));
469         break;
470     case PROP_USER_AGENT:
471         g_value_set_string(value, webkit_settings_get_user_agent(settings));
472         break;
473     case PROP_ENABLE_SMOOTH_SCROLLING:
474         g_value_set_boolean(value, webkit_settings_get_enable_smooth_scrolling(settings));
475         break;
476     case PROP_ENABLE_ACCELERATED_2D_CANVAS:
477         g_value_set_boolean(value, webkit_settings_get_enable_accelerated_2d_canvas(settings));
478         break;
479     case PROP_ENABLE_WRITE_CONSOLE_MESSAGES_TO_STDOUT:
480         g_value_set_boolean(value, webkit_settings_get_enable_write_console_messages_to_stdout(settings));
481         break;
482     case PROP_ENABLE_MEDIA_STREAM:
483         g_value_set_boolean(value, webkit_settings_get_enable_media_stream(settings));
484         break;
485     case PROP_ENABLE_SPATIAL_NAVIGATION:
486         g_value_set_boolean(value, webkit_settings_get_enable_spatial_navigation(settings));
487         break;
488     case PROP_ENABLE_MEDIASOURCE:
489         g_value_set_boolean(value, webkit_settings_get_enable_mediasource(settings));
490         break;
491     case PROP_ALLOW_FILE_ACCESS_FROM_FILE_URLS:
492         g_value_set_boolean(value, webkit_settings_get_allow_file_access_from_file_urls(settings));
493         break;
494     case PROP_ALLOW_UNIVERSAL_ACCESS_FROM_FILE_URLS:
495         g_value_set_boolean(value, webkit_settings_get_allow_universal_access_from_file_urls(settings));
496         break;
497 #if PLATFORM(GTK)
498     case PROP_HARDWARE_ACCELERATION_POLICY:
499         g_value_set_enum(value, webkit_settings_get_hardware_acceleration_policy(settings));
500         break;
501 #endif
502     default:
503         G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, paramSpec);
504         break;
505     }
506 }
507
508 static void webkit_settings_class_init(WebKitSettingsClass* klass)
509 {
510     GObjectClass* gObjectClass = G_OBJECT_CLASS(klass);
511     gObjectClass->constructed = webKitSettingsConstructed;
512     gObjectClass->set_property = webKitSettingsSetProperty;
513     gObjectClass->get_property = webKitSettingsGetProperty;
514
515     GParamFlags readWriteConstructParamFlags = static_cast<GParamFlags>(WEBKIT_PARAM_READWRITE | G_PARAM_CONSTRUCT);
516
517     /**
518      * WebKitSettings:enable-javascript:
519      *
520      * Determines whether or not JavaScript executes within a page.
521      */
522     g_object_class_install_property(gObjectClass,
523                                     PROP_ENABLE_JAVASCRIPT,
524                                     g_param_spec_boolean("enable-javascript",
525                                                          _("Enable JavaScript"),
526                                                          _("Enable JavaScript."),
527                                                          TRUE,
528                                                          readWriteConstructParamFlags));
529
530     /**
531      * WebKitSettings:auto-load-images:
532      *
533      * Determines whether images should be automatically loaded or not.
534      * On devices where network bandwidth is of concern, it might be
535      * useful to turn this property off.
536      */
537     g_object_class_install_property(gObjectClass,
538                                     PROP_AUTO_LOAD_IMAGES,
539                                     g_param_spec_boolean("auto-load-images",
540                                                          _("Auto load images"),
541                                                          _("Load images automatically."),
542                                                          TRUE,
543                                                          readWriteConstructParamFlags));
544
545     /**
546      * WebKitSettings:load-icons-ignoring-image-load-setting:
547      *
548      * Determines whether a site can load favicons irrespective
549      * of the value of #WebKitSettings:auto-load-images.
550      */
551     g_object_class_install_property(gObjectClass,
552                                     PROP_LOAD_ICONS_IGNORING_IMAGE_LOAD_SETTING,
553                                     g_param_spec_boolean("load-icons-ignoring-image-load-setting",
554                                                          _("Load icons ignoring image load setting"),
555                                                          _("Whether to load site icons ignoring image load setting."),
556                                                          FALSE,
557                                                          readWriteConstructParamFlags));
558
559     /**
560      * WebKitSettings:enable-offline-web-application-cache:
561      *
562      * Whether to enable HTML5 offline web application cache support. Offline
563      * web application cache allows web applications to run even when
564      * the user is not connected to the network.
565      *
566      * HTML5 offline web application specification is available at
567      * http://dev.w3.org/html5/spec/offline.html.
568      */
569     g_object_class_install_property(gObjectClass,
570                                     PROP_ENABLE_OFFLINE_WEB_APPLICATION_CACHE,
571                                     g_param_spec_boolean("enable-offline-web-application-cache",
572                                                          _("Enable offline web application cache"),
573                                                          _("Whether to enable offline web application cache."),
574                                                          TRUE,
575                                                          readWriteConstructParamFlags));
576
577     /**
578      * WebKitSettings:enable-html5-local-storage:
579      *
580      * Whether to enable HTML5 local storage support. Local storage provides
581      * simple synchronous storage access.
582      *
583      * HTML5 local storage specification is available at
584      * http://dev.w3.org/html5/webstorage/.
585      */
586     g_object_class_install_property(gObjectClass,
587                                     PROP_ENABLE_HTML5_LOCAL_STORAGE,
588                                     g_param_spec_boolean("enable-html5-local-storage",
589                                                          _("Enable HTML5 local storage"),
590                                                          _("Whether to enable HTML5 Local Storage support."),
591                                                          TRUE,
592                                                          readWriteConstructParamFlags));
593
594     /**
595      * WebKitSettings:enable-html5-database:
596      *
597      * Whether to enable HTML5 client-side SQL database support. Client-side
598      * SQL database allows web pages to store structured data and be able to
599      * use SQL to manipulate that data asynchronously.
600      *
601      * HTML5 database specification is available at
602      * http://www.w3.org/TR/webdatabase/.
603      */
604     g_object_class_install_property(gObjectClass,
605                                     PROP_ENABLE_HTML5_DATABASE,
606                                     g_param_spec_boolean("enable-html5-database",
607                                                          _("Enable HTML5 database"),
608                                                          _("Whether to enable HTML5 database support."),
609                                                          TRUE,
610                                                          readWriteConstructParamFlags));
611
612     /**
613      * WebKitSettings:enable-xss-auditor:
614      *
615      * Whether to enable the XSS auditor. This feature filters some kinds of
616      * reflective XSS attacks on vulnerable web sites.
617      */
618     g_object_class_install_property(gObjectClass,
619                                     PROP_ENABLE_XSS_AUDITOR,
620                                     g_param_spec_boolean("enable-xss-auditor",
621                                                          _("Enable XSS auditor"),
622                                                          _("Whether to enable the XSS auditor."),
623                                                          TRUE,
624                                                          readWriteConstructParamFlags));
625
626
627     /**
628      * WebKitSettings:enable-frame-flattening:
629      *
630      * Whether to enable the frame flattening. With this setting each subframe is expanded
631      * to its contents, which will flatten all the frames to become one scrollable page.
632      * On touch devices scrollable subframes on a page can result in a confusing user experience.
633      */
634     g_object_class_install_property(gObjectClass,
635                                     PROP_ENABLE_FRAME_FLATTENING,
636                                     g_param_spec_boolean("enable-frame-flattening",
637                                                          _("Enable frame flattening"),
638                                                          _("Whether to enable frame flattening."),
639                                                          FALSE,
640                                                          readWriteConstructParamFlags));
641
642     /**
643      * WebKitSettings:enable-plugins:
644      *
645      * Determines whether or not plugins on the page are enabled.
646      */
647     g_object_class_install_property(gObjectClass,
648                                     PROP_ENABLE_PLUGINS,
649                                     g_param_spec_boolean("enable-plugins",
650                                                          _("Enable plugins"),
651                                                          _("Enable embedded plugin objects."),
652                                                          TRUE,
653                                                          readWriteConstructParamFlags));
654
655     /**
656      * WebKitSettings:enable-java:
657      *
658      * Determines whether or not Java is enabled on the page.
659      */
660     g_object_class_install_property(gObjectClass,
661                                     PROP_ENABLE_JAVA,
662                                     g_param_spec_boolean("enable-java",
663                                                          _("Enable Java"),
664                                                          _("Whether Java support should be enabled."),
665                                                          TRUE,
666                                                          readWriteConstructParamFlags));
667
668     /**
669      * WebKitSettings:javascript-can-open-windows-automatically:
670      *
671      * Whether JavaScript can open popup windows automatically without user
672      * intervention.
673      */
674     g_object_class_install_property(gObjectClass,
675                                     PROP_JAVASCRIPT_CAN_OPEN_WINDOWS_AUTOMATICALLY,
676                                     g_param_spec_boolean("javascript-can-open-windows-automatically",
677                                                          _("JavaScript can open windows automatically"),
678                                                          _("Whether JavaScript can open windows automatically."),
679                                                          FALSE,
680                                                          readWriteConstructParamFlags));
681
682     /**
683      * WebKitSettings:enable-hyperlink-auditing:
684      *
685      * Determines whether or not hyperlink auditing is enabled.
686      *
687      * The hyperlink auditing specification is available at
688      * http://www.whatwg.org/specs/web-apps/current-work/multipage/links.html#hyperlink-auditing.
689      */
690     g_object_class_install_property(gObjectClass,
691                                     PROP_ENABLE_HYPERLINK_AUDITING,
692                                     g_param_spec_boolean("enable-hyperlink-auditing",
693                                                          _("Enable hyperlink auditing"),
694                                                          _("Whether <a ping> should be able to send pings."),
695                                                          FALSE,
696                                                          readWriteConstructParamFlags));
697
698     /**
699      * WebKitSettings:default-font-family:
700      *
701      * The font family to use as the default for content that does not specify a font.
702      */
703     g_object_class_install_property(gObjectClass,
704                                     PROP_DEFAULT_FONT_FAMILY,
705                                     g_param_spec_string("default-font-family",
706                                                         _("Default font family"),
707                                                         _("The font family to use as the default for content that does not specify a font."),
708                                                         "sans-serif",
709                                                         readWriteConstructParamFlags));
710
711     /**
712      * WebKitSettings:monospace-font-family:
713      *
714      * The font family used as the default for content using a monospace font.
715      *
716      */
717     g_object_class_install_property(gObjectClass,
718                                     PROP_MONOSPACE_FONT_FAMILY,
719                                     g_param_spec_string("monospace-font-family",
720                                                         _("Monospace font family"),
721                                                         _("The font family used as the default for content using monospace font."),
722                                                         "monospace",
723                                                         readWriteConstructParamFlags));
724
725     /**
726      * WebKitSettings:serif-font-family:
727      *
728      * The font family used as the default for content using a serif font.
729      */
730     g_object_class_install_property(gObjectClass,
731                                     PROP_SERIF_FONT_FAMILY,
732                                     g_param_spec_string("serif-font-family",
733                                                         _("Serif font family"),
734                                                         _("The font family used as the default for content using serif font."),
735                                                         "serif",
736                                                         readWriteConstructParamFlags));
737
738     /**
739      * WebKitSettings:sans-serif-font-family:
740      *
741      * The font family used as the default for content using a sans-serif font.
742      */
743     g_object_class_install_property(gObjectClass,
744                                     PROP_SANS_SERIF_FONT_FAMILY,
745                                     g_param_spec_string("sans-serif-font-family",
746                                                         _("Sans-serif font family"),
747                                                         _("The font family used as the default for content using sans-serif font."),
748                                                         "sans-serif",
749                                                         readWriteConstructParamFlags));
750
751     /**
752      * WebKitSettings:cursive-font-family:
753      *
754      * The font family used as the default for content using a cursive font.
755      */
756     g_object_class_install_property(gObjectClass,
757                                     PROP_CURSIVE_FONT_FAMILY,
758                                     g_param_spec_string("cursive-font-family",
759                                                         _("Cursive font family"),
760                                                         _("The font family used as the default for content using cursive font."),
761                                                         "serif",
762                                                         readWriteConstructParamFlags));
763
764     /**
765      * WebKitSettings:fantasy-font-family:
766      *
767      * The font family used as the default for content using a fantasy font.
768      */
769     g_object_class_install_property(gObjectClass,
770                                     PROP_FANTASY_FONT_FAMILY,
771                                     g_param_spec_string("fantasy-font-family",
772                                                         _("Fantasy font family"),
773                                                         _("The font family used as the default for content using fantasy font."),
774                                                         "serif",
775                                                         readWriteConstructParamFlags));
776
777     /**
778      * WebKitSettings:pictograph-font-family:
779      *
780      * The font family used as the default for content using a pictograph font.
781      */
782     g_object_class_install_property(gObjectClass,
783                                     PROP_PICTOGRAPH_FONT_FAMILY,
784                                     g_param_spec_string("pictograph-font-family",
785                                                         _("Pictograph font family"),
786                                                         _("The font family used as the default for content using pictograph font."),
787                                                         "serif",
788                                                         readWriteConstructParamFlags));
789
790     /**
791      * WebKitSettings:default-font-size:
792      *
793      * The default font size in pixels to use for content displayed if
794      * no font size is specified.
795      */
796     g_object_class_install_property(gObjectClass,
797                                     PROP_DEFAULT_FONT_SIZE,
798                                     g_param_spec_uint("default-font-size",
799                                                       _("Default font size"),
800                                                       _("The default font size used to display text."),
801                                                       0, G_MAXUINT, 16,
802                                                       readWriteConstructParamFlags));
803
804     /**
805      * WebKitSettings:default-monospace-font-size:
806      *
807      * The default font size in pixels to use for content displayed in
808      * monospace font if no font size is specified.
809      */
810     g_object_class_install_property(gObjectClass,
811                                     PROP_DEFAULT_MONOSPACE_FONT_SIZE,
812                                     g_param_spec_uint("default-monospace-font-size",
813                                                       _("Default monospace font size"),
814                                                       _("The default font size used to display monospace text."),
815                                                       0, G_MAXUINT, 13,
816                                                       readWriteConstructParamFlags));
817
818     /**
819      * WebKitSettings:minimum-font-size:
820      *
821      * The minimum font size in points used to display text. This setting
822      * controls the absolute smallest size. Values other than 0 can
823      * potentially break page layouts.
824      */
825     g_object_class_install_property(gObjectClass,
826                                     PROP_MINIMUM_FONT_SIZE,
827                                     g_param_spec_uint("minimum-font-size",
828                                                       _("Minimum font size"),
829                                                       _("The minimum font size used to display text."),
830                                                       0, G_MAXUINT, 0,
831                                                       readWriteConstructParamFlags));
832
833     /**
834      * WebKitSettings:default-charset:
835      *
836      * The default text charset used when interpreting content with an unspecified charset.
837      */
838     g_object_class_install_property(gObjectClass,
839                                     PROP_DEFAULT_CHARSET,
840                                     g_param_spec_string("default-charset",
841                                                         _("Default charset"),
842                                                         _("The default text charset used when interpreting content with unspecified charset."),
843                                                         "iso-8859-1",
844                                                         readWriteConstructParamFlags));
845
846     /**
847      * WebKitSettings:enable-private-browsing:
848      *
849      * Determines whether or not private browsing is enabled. Private browsing
850      * will disable history, cache and form auto-fill for any pages visited.
851      *
852      * Deprecated: 2.16. Use #WebKitWebView:is-ephemeral or #WebKitWebsiteDataManager:is-ephemeral instead.
853      */
854     g_object_class_install_property(gObjectClass,
855                                     PROP_ENABLE_PRIVATE_BROWSING,
856                                     g_param_spec_boolean("enable-private-browsing",
857                                                          _("Enable private browsing"),
858                                                          _("Whether to enable private browsing"),
859                                                          FALSE,
860                                                          readWriteConstructParamFlags));
861
862     /**
863      * WebKitSettings:enable-developer-extras:
864      *
865      * Determines whether or not developer tools, such as the Web Inspector, are enabled.
866      */
867     g_object_class_install_property(gObjectClass,
868                                     PROP_ENABLE_DEVELOPER_EXTRAS,
869                                     g_param_spec_boolean("enable-developer-extras",
870                                                          _("Enable developer extras"),
871                                                          _("Whether to enable developer extras"),
872                                                          FALSE,
873                                                          readWriteConstructParamFlags));
874
875     /**
876      * WebKitSettings:enable-resizable-text-areas:
877      *
878      * Determines whether or not text areas can be resized.
879      */
880     g_object_class_install_property(gObjectClass,
881                                     PROP_ENABLE_RESIZABLE_TEXT_AREAS,
882                                     g_param_spec_boolean("enable-resizable-text-areas",
883                                                          _("Enable resizable text areas"),
884                                                          _("Whether to enable resizable text areas"),
885                                                          TRUE,
886                                                          readWriteConstructParamFlags));
887
888     /**
889      * WebKitSettings:enable-tabs-to-links:
890      *
891      * Determines whether the tab key cycles through the elements on the page.
892      * When this setting is enabled, users will be able to focus the next element
893      * in the page by pressing the tab key. If the selected element is editable,
894      * then pressing tab key will insert the tab character.
895      */
896     g_object_class_install_property(gObjectClass,
897                                     PROP_ENABLE_TABS_TO_LINKS,
898                                     g_param_spec_boolean("enable-tabs-to-links",
899                                                          _("Enable tabs to links"),
900                                                          _("Whether to enable tabs to links"),
901                                                          TRUE,
902                                                          readWriteConstructParamFlags));
903
904     /**
905      * WebKitSettings:enable-dns-prefetching:
906      *
907      * Determines whether or not to prefetch domain names. DNS prefetching attempts
908      * to resolve domain names before a user tries to follow a link.
909      */
910     g_object_class_install_property(gObjectClass,
911                                     PROP_ENABLE_DNS_PREFETCHING,
912                                     g_param_spec_boolean("enable-dns-prefetching",
913                                                          _("Enable DNS prefetching"),
914                                                          _("Whether to enable DNS prefetching"),
915                                                          FALSE,
916                                                          readWriteConstructParamFlags));
917
918     /**
919      * WebKitSettings:enable-caret-browsing:
920      *
921      * Whether to enable accessibility enhanced keyboard navigation.
922      */
923     g_object_class_install_property(gObjectClass,
924                                     PROP_ENABLE_CARET_BROWSING,
925                                     g_param_spec_boolean("enable-caret-browsing",
926                                                          _("Enable Caret Browsing"),
927                                                          _("Whether to enable accessibility enhanced keyboard navigation"),
928                                                          FALSE,
929                                                          readWriteConstructParamFlags));
930
931     /**
932      * WebKitSettings:enable-fullscreen:
933      *
934      * Whether to enable the Javascript Fullscreen API. The API
935      * allows any HTML element to request fullscreen display. See also
936      * the current draft of the spec:
937      * http://www.w3.org/TR/fullscreen/
938      */
939     g_object_class_install_property(gObjectClass,
940         PROP_ENABLE_FULLSCREEN,
941         g_param_spec_boolean("enable-fullscreen",
942             _("Enable Fullscreen"),
943             _("Whether to enable the Javascript Fullscreen API"),
944             TRUE,
945             readWriteConstructParamFlags));
946
947     /**
948      * WebKitSettings:print-backgrounds:
949      *
950      * Whether background images should be drawn during printing.
951      */
952     g_object_class_install_property(gObjectClass,
953                                     PROP_PRINT_BACKGROUNDS,
954                                     g_param_spec_boolean("print-backgrounds",
955                                                          _("Print Backgrounds"),
956                                                          _("Whether background images should be drawn during printing"),
957                                                          TRUE,
958                                                          readWriteConstructParamFlags));
959
960     /**
961      * WebKitSettings:enable-webaudio:
962      *
963      *
964      * Enable or disable support for WebAudio on pages. WebAudio is an
965      * experimental proposal for allowing web pages to generate Audio
966      * WAVE data from JavaScript. The standard is currently a
967      * work-in-progress by the W3C Audio Working Group.
968      *
969      * See also https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html
970      */
971     g_object_class_install_property(gObjectClass,
972                                     PROP_ENABLE_WEBAUDIO,
973                                     g_param_spec_boolean("enable-webaudio",
974                                                          _("Enable WebAudio"),
975                                                          _("Whether WebAudio content should be handled"),
976                                                          FALSE,
977                                                          readWriteConstructParamFlags));
978
979     /**
980     * WebKitSettings:enable-webgl:
981     *
982     * Enable or disable support for WebGL on pages. WebGL is an experimental
983     * proposal for allowing web pages to use OpenGL ES-like calls directly. The
984     * standard is currently a work-in-progress by the Khronos Group.
985     */
986     g_object_class_install_property(gObjectClass,
987                                     PROP_ENABLE_WEBGL,
988                                     g_param_spec_boolean("enable-webgl",
989                                                          _("Enable WebGL"),
990                                                          _("Whether WebGL content should be rendered"),
991                                                          FALSE,
992                                                          readWriteConstructParamFlags));
993
994     /**
995      * WebKitSettings:allow-modal-dialogs:
996      *
997      * Determine whether it's allowed to create and run modal dialogs
998      * from a #WebKitWebView through JavaScript with
999      * <function>window.showModalDialog</function>. If it's set to
1000      * %FALSE, the associated #WebKitWebView won't be able to create
1001      * new modal dialogs, so not even the #WebKitWebView::create
1002      * signal will be emitted.
1003      */
1004     g_object_class_install_property(gObjectClass,
1005                                     PROP_ALLOW_MODAL_DIALOGS,
1006                                     g_param_spec_boolean("allow-modal-dialogs",
1007                                                          _("Allow modal dialogs"),
1008                                                          _("Whether it is possible to create modal dialogs"),
1009                                                          FALSE,
1010                                                          readWriteConstructParamFlags));
1011
1012     /**
1013      * WebKitSettings:zoom-text-only:
1014      *
1015      * Whether #WebKitWebView:zoom-level affects only the
1016      * text of the page or all the contents. Other contents containing text
1017      * like form controls will be also affected by zoom factor when
1018      * this property is enabled.
1019      */
1020     g_object_class_install_property(gObjectClass,
1021                                     PROP_ZOOM_TEXT_ONLY,
1022                                     g_param_spec_boolean("zoom-text-only",
1023                                                          _("Zoom Text Only"),
1024                                                          _("Whether zoom level of web view changes only the text size"),
1025                                                          FALSE,
1026                                                          readWriteConstructParamFlags));
1027
1028     /**
1029      * WebKitSettings:javascript-can-access-clipboard:
1030      *
1031      * Whether JavaScript can access the clipboard. The default value is %FALSE. If
1032      * set to %TRUE, document.execCommand() allows cut, copy and paste commands.
1033      *
1034      */
1035     g_object_class_install_property(gObjectClass,
1036                                     PROP_JAVASCRIPT_CAN_ACCESS_CLIPBOARD,
1037                                     g_param_spec_boolean("javascript-can-access-clipboard",
1038                                                          _("JavaScript can access clipboard"),
1039                                                          _("Whether JavaScript can access Clipboard"),
1040                                                          FALSE,
1041                                                          readWriteConstructParamFlags));
1042
1043     /**
1044      * WebKitSettings:media-playback-requires-user-gesture:
1045      *
1046      * Whether a user gesture (such as clicking the play button)
1047      * would be required to start media playback or load media. This is off
1048      * by default, so media playback could start automatically.
1049      * Setting it on requires a gesture by the user to start playback, or to
1050      * load the media.
1051      */
1052     g_object_class_install_property(gObjectClass,
1053                                     PROP_MEDIA_PLAYBACK_REQUIRES_USER_GESTURE,
1054                                     g_param_spec_boolean("media-playback-requires-user-gesture",
1055                                                          _("Media playback requires user gesture"),
1056                                                          _("Whether media playback requires user gesture"),
1057                                                          FALSE,
1058                                                          readWriteConstructParamFlags));
1059
1060     /**
1061      * WebKitSettings:media-playback-allows-inline:
1062      *
1063      * Whether media playback is full-screen only or inline playback is allowed.
1064      * This is %TRUE by default, so media playback can be inline. Setting it to
1065      * %FALSE allows specifying that media playback should be always fullscreen.
1066      */
1067     g_object_class_install_property(gObjectClass,
1068                                     PROP_MEDIA_PLAYBACK_ALLOWS_INLINE,
1069                                     g_param_spec_boolean("media-playback-allows-inline",
1070                                                          _("Media playback allows inline"),
1071                                                          _("Whether media playback allows inline"),
1072                                                          TRUE,
1073                                                          readWriteConstructParamFlags));
1074
1075     /**
1076      * WebKitSettings:draw-compositing-indicators:
1077      *
1078      * Whether to draw compositing borders and repaint counters on layers drawn
1079      * with accelerated compositing. This is useful for debugging issues related
1080      * to web content that is composited with the GPU.
1081      */
1082     g_object_class_install_property(gObjectClass,
1083                                     PROP_DRAW_COMPOSITING_INDICATORS,
1084                                     g_param_spec_boolean("draw-compositing-indicators",
1085                                                          _("Draw compositing indicators"),
1086                                                          _("Whether to draw compositing borders and repaint counters"),
1087                                                          FALSE,
1088                                                          readWriteConstructParamFlags));
1089
1090     /**
1091      * WebKitSettings:enable-site-specific-quirks:
1092      *
1093      * Whether to turn on site-specific quirks. Turning this on will
1094      * tell WebKit to use some site-specific workarounds for
1095      * better web compatibility. For example, older versions of
1096      * MediaWiki will incorrectly send to WebKit a CSS file with KHTML
1097      * workarounds. By turning on site-specific quirks, WebKit will
1098      * special-case this and other cases to make some specific sites work.
1099      */
1100     g_object_class_install_property(
1101         gObjectClass,
1102         PROP_ENABLE_SITE_SPECIFIC_QUIRKS,
1103         g_param_spec_boolean(
1104             "enable-site-specific-quirks",
1105             _("Enable Site Specific Quirks"),
1106             _("Enables the site-specific compatibility workarounds"),
1107             TRUE,
1108             readWriteConstructParamFlags));
1109
1110     /**
1111      * WebKitSettings:enable-page-cache:
1112      *
1113      * Enable or disable the page cache. Disabling the page cache is
1114      * generally only useful for special circumstances like low-memory
1115      * scenarios or special purpose applications like static HTML
1116      * viewers. This setting only controls the Page Cache, this cache
1117      * is different than the disk-based or memory-based traditional
1118      * resource caches, its point is to make going back and forth
1119      * between pages much faster. For details about the different types
1120      * of caches and their purposes see:
1121      * http://webkit.org/blog/427/webkit-page-cache-i-the-basics/
1122      */
1123     g_object_class_install_property(gObjectClass,
1124                                     PROP_ENABLE_PAGE_CACHE,
1125                                     g_param_spec_boolean("enable-page-cache",
1126                                                          _("Enable page cache"),
1127                                                          _("Whether the page cache should be used"),
1128                                                          TRUE,
1129                                                          readWriteConstructParamFlags));
1130
1131     /**
1132      * WebKitSettings:user-agent:
1133      *
1134      * The user-agent string used by WebKit. Unusual user-agent strings may cause web
1135      * content to render incorrectly or fail to run, as many web pages are written to
1136      * parse the user-agent strings of only the most popular browsers. Therefore, it's
1137      * typically better to not completely override the standard user-agent, but to use
1138      * webkit_settings_set_user_agent_with_application_details() instead.
1139      *
1140      * If this property is set to the empty string or %NULL, it will revert to the standard
1141      * user-agent.
1142      */
1143     g_object_class_install_property(gObjectClass,
1144                                     PROP_USER_AGENT,
1145                                     g_param_spec_string("user-agent",
1146                                                         _("User agent string"),
1147                                                         _("The user agent string"),
1148                                                         0, // A null string forces the standard user agent.
1149                                                         readWriteConstructParamFlags));
1150
1151     /**
1152      * WebKitSettings:enable-smooth-scrolling:
1153      *
1154      * Enable or disable smooth scrolling.
1155      */
1156     g_object_class_install_property(gObjectClass,
1157                                     PROP_ENABLE_SMOOTH_SCROLLING,
1158                                     g_param_spec_boolean("enable-smooth-scrolling",
1159                                                          _("Enable smooth scrolling"),
1160                                                          _("Whether to enable smooth scrolling"),
1161                                                          FALSE,
1162                                                          readWriteConstructParamFlags));
1163
1164     /**
1165      * WebKitSettings:enable-accelerated-2d-canvas:
1166      *
1167      * Enable or disable accelerated 2D canvas. Accelerated 2D canvas is only available
1168      * if WebKitGTK+ was compiled with a version of Cairo including the unstable CairoGL API.
1169      * When accelerated 2D canvas is enabled, WebKit may render some 2D canvas content
1170      * using hardware accelerated drawing operations.
1171      *
1172      * Since: 2.2
1173      */
1174     g_object_class_install_property(gObjectClass,
1175         PROP_ENABLE_ACCELERATED_2D_CANVAS,
1176         g_param_spec_boolean("enable-accelerated-2d-canvas",
1177             _("Enable accelerated 2D canvas"),
1178             _("Whether to enable accelerated 2D canvas"),
1179             FALSE,
1180             readWriteConstructParamFlags));
1181
1182     /**
1183      * WebKitSettings:enable-write-console-messages-to-stdout:
1184      *
1185      * Enable or disable writing console messages to stdout. These are messages
1186      * sent to the console with console.log and related methods.
1187      *
1188      * Since: 2.2
1189      */
1190     g_object_class_install_property(gObjectClass,
1191         PROP_ENABLE_WRITE_CONSOLE_MESSAGES_TO_STDOUT,
1192         g_param_spec_boolean("enable-write-console-messages-to-stdout",
1193             _("Write console messages on stdout"),
1194             _("Whether to write console messages on stdout"),
1195             FALSE,
1196             readWriteConstructParamFlags));
1197
1198     /**
1199      * WebKitSettings:enable-media-stream:
1200      *
1201      * Enable or disable support for MediaStream on pages. MediaStream
1202      * is an experimental proposal for allowing web pages to access
1203      * audio and video devices for capture.
1204      *
1205      * See also http://dev.w3.org/2011/webrtc/editor/getusermedia.html
1206      *
1207      * Since: 2.4
1208      */
1209     g_object_class_install_property(gObjectClass,
1210         PROP_ENABLE_MEDIA_STREAM,
1211         g_param_spec_boolean("enable-media-stream",
1212             _("Enable MediaStream"),
1213             _("Whether MediaStream content should be handled"),
1214             FALSE,
1215             readWriteConstructParamFlags));
1216
1217    /**
1218      * WebKitSettings:enable-spatial-navigation:
1219      *
1220      * Whether to enable Spatial Navigation. This feature consists in the ability
1221      * to navigate between focusable elements in a Web page, such as hyperlinks
1222      * and form controls, by using Left, Right, Up and Down arrow keys.
1223      * For example, if an user presses the Right key, heuristics determine whether
1224      * there is an element they might be trying to reach towards the right, and if
1225      * there are multiple elements, which element they probably wants.
1226      *
1227      * Since: 2.4
1228      */
1229     g_object_class_install_property(gObjectClass,
1230         PROP_ENABLE_SPATIAL_NAVIGATION,
1231         g_param_spec_boolean("enable-spatial-navigation",
1232             _("Enable Spatial Navigation"),
1233             _("Whether to enable Spatial Navigation support."),
1234             FALSE,
1235             readWriteConstructParamFlags));
1236
1237     /**
1238      * WebKitSettings:enable-mediasource:
1239      *
1240      * Enable or disable support for MediaSource on pages. MediaSource is an
1241      * experimental proposal which extends HTMLMediaElement to allow
1242      * JavaScript to generate media streams for playback.  The standard is
1243      * currently a work-in-progress by the W3C HTML Media Task Force.
1244      *
1245      * See also http://www.w3.org/TR/media-source/
1246      *
1247      * Since: 2.4
1248      */
1249     g_object_class_install_property(gObjectClass,
1250         PROP_ENABLE_MEDIASOURCE,
1251         g_param_spec_boolean("enable-mediasource",
1252             _("Enable MediaSource"),
1253             _("Whether MediaSource should be enabled."),
1254             FALSE,
1255             readWriteConstructParamFlags));
1256
1257     /**
1258      * WebKitSettings:allow-file-access-from-file-urls:
1259      *
1260      * Whether file access is allowed from file URLs. By default, when
1261      * something is loaded in a #WebKitWebView using a file URI, cross
1262      * origin requests to other file resources are not allowed. This
1263      * setting allows you to change that behaviour, so that it would be
1264      * possible to do a XMLHttpRequest of a local file, for example.
1265      *
1266      * Since: 2.10
1267      */
1268     g_object_class_install_property(gObjectClass,
1269         PROP_ALLOW_FILE_ACCESS_FROM_FILE_URLS,
1270         g_param_spec_boolean("allow-file-access-from-file-urls",
1271             _("Allow file access from file URLs"),
1272             _("Whether file access is allowed from file URLs."),
1273             FALSE,
1274             readWriteConstructParamFlags));
1275
1276     /**
1277      * WebKitSettings:allow-universal-access-from-file-urls:
1278      *
1279      * Whether or not JavaScript running in the context of a file scheme URL
1280      * should be allowed to access content from any origin.  By default, when
1281      * something is loaded in a #WebKitWebView using a file scheme URL,
1282      * access to the local file system and arbitrary local storage is not
1283      * allowed. This setting allows you to change that behaviour, so that
1284      * it would be possible to use local storage, for example.
1285      *
1286      * Since: 2.14
1287      */
1288     g_object_class_install_property(gObjectClass,
1289         PROP_ALLOW_UNIVERSAL_ACCESS_FROM_FILE_URLS,
1290         g_param_spec_boolean("allow-universal-access-from-file-urls",
1291             _("Allow universal access from the context of file scheme URLs"),
1292             _("Whether or not universal access is allowed from the context of file scheme URLs"),
1293             FALSE,
1294             readWriteConstructParamFlags));
1295
1296 #if PLATFORM(GTK)
1297     /**
1298      * WebKitSettings:hardware-acceleration-policy:
1299      *
1300      * The #WebKitHardwareAccelerationPolicy to decide how to enable and disable
1301      * hardware acceleration. The default value %WEBKIT_HARDWARE_ACCELERATION_POLICY_ON_DEMAND
1302      * enables the hardware acceleration when the web contents request it, disabling it again
1303      * when no longer needed. It's possible to enforce hardware acceleration to be always enabled
1304      * by using %WEBKIT_HARDWARE_ACCELERATION_POLICY_ALWAYS. And it's also possible to disable it
1305      * completely using %WEBKIT_HARDWARE_ACCELERATION_POLICY_NEVER. Note that disabling hardware
1306      * acceleration might cause some websites to not render correctly or consume more CPU.
1307      *
1308      * Note that changing this setting might not be possible if hardware acceleration is not
1309      * supported by the hardware or the system. In that case you can get the value to know the
1310      * actual policy being used, but changing the setting will not have any effect.
1311      *
1312      * Since: 2.16
1313      */
1314     g_object_class_install_property(gObjectClass,
1315         PROP_HARDWARE_ACCELERATION_POLICY,
1316         g_param_spec_enum("hardware-acceleration-policy",
1317             _("Hardware Acceleration Policy"),
1318             _("The policy to decide how to enable and disable hardware acceleration"),
1319             WEBKIT_TYPE_HARDWARE_ACCELERATION_POLICY,
1320             WEBKIT_HARDWARE_ACCELERATION_POLICY_ON_DEMAND,
1321             readWriteConstructParamFlags));
1322 #endif // PLATFOTM(GTK)
1323 }
1324
1325 WebPreferences* webkitSettingsGetPreferences(WebKitSettings* settings)
1326 {
1327     return settings->priv->preferences.get();
1328 }
1329
1330 /**
1331  * webkit_settings_new:
1332  *
1333  * Creates a new #WebKitSettings instance with default values. It must
1334  * be manually attached to a #WebKitWebView.
1335  * See also webkit_settings_new_with_settings().
1336  *
1337  * Returns: a new #WebKitSettings instance.
1338  */
1339 WebKitSettings* webkit_settings_new()
1340 {
1341     return WEBKIT_SETTINGS(g_object_new(WEBKIT_TYPE_SETTINGS, NULL));
1342 }
1343
1344 /**
1345  * webkit_settings_new_with_settings:
1346  * @first_setting_name: name of first setting to set
1347  * @...: value of first setting, followed by more settings,
1348  *    %NULL-terminated
1349  *
1350  * Creates a new #WebKitSettings instance with the given settings. It must
1351  * be manually attached to a #WebKitWebView.
1352  *
1353  * Returns: a new #WebKitSettings instance.
1354  */
1355 WebKitSettings* webkit_settings_new_with_settings(const gchar* firstSettingName, ...)
1356 {
1357     va_list args;
1358     va_start(args, firstSettingName);
1359     WebKitSettings* settings = WEBKIT_SETTINGS(g_object_new_valist(WEBKIT_TYPE_SETTINGS, firstSettingName, args));
1360     va_end(args);
1361     return settings;
1362 }
1363
1364 /**
1365  * webkit_settings_get_enable_javascript:
1366  * @settings: a #WebKitSettings
1367  *
1368  * Get the #WebKitSettings:enable-javascript property.
1369  *
1370  * Returns: %TRUE If JavaScript is enabled or %FALSE otherwise.
1371  */
1372 gboolean webkit_settings_get_enable_javascript(WebKitSettings* settings)
1373 {
1374     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
1375
1376     return settings->priv->preferences->javaScriptEnabled();
1377 }
1378
1379 /**
1380  * webkit_settings_set_enable_javascript:
1381  * @settings: a #WebKitSettings
1382  * @enabled: Value to be set
1383  *
1384  * Set the #WebKitSettings:enable-javascript property.
1385  */
1386 void webkit_settings_set_enable_javascript(WebKitSettings* settings, gboolean enabled)
1387 {
1388     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
1389
1390     WebKitSettingsPrivate* priv = settings->priv;
1391     bool currentValue = priv->preferences->javaScriptEnabled();
1392     if (currentValue == enabled)
1393         return;
1394
1395     priv->preferences->setJavaScriptEnabled(enabled);
1396     g_object_notify(G_OBJECT(settings), "enable-javascript");
1397 }
1398
1399 /**
1400  * webkit_settings_get_auto_load_images:
1401  * @settings: a #WebKitSettings
1402  *
1403  * Get the #WebKitSettings:auto-load-images property.
1404  *
1405  * Returns: %TRUE If auto loading of images is enabled or %FALSE otherwise.
1406  */
1407 gboolean webkit_settings_get_auto_load_images(WebKitSettings* settings)
1408 {
1409     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
1410
1411     return settings->priv->preferences->loadsImagesAutomatically();
1412 }
1413
1414 /**
1415  * webkit_settings_set_auto_load_images:
1416  * @settings: a #WebKitSettings
1417  * @enabled: Value to be set
1418  *
1419  * Set the #WebKitSettings:auto-load-images property.
1420  */
1421 void webkit_settings_set_auto_load_images(WebKitSettings* settings, gboolean enabled)
1422 {
1423     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
1424
1425     WebKitSettingsPrivate* priv = settings->priv;
1426     bool currentValue = priv->preferences->loadsImagesAutomatically();
1427     if (currentValue == enabled)
1428         return;
1429
1430     priv->preferences->setLoadsImagesAutomatically(enabled);
1431     g_object_notify(G_OBJECT(settings), "auto-load-images");
1432 }
1433
1434 /**
1435  * webkit_settings_get_load_icons_ignoring_image_load_setting:
1436  * @settings: a #WebKitSettings
1437  *
1438  * Get the #WebKitSettings:load-icons-ignoring-image-load-setting property.
1439  *
1440  * Returns: %TRUE If site icon can be loaded irrespective of image loading preference or %FALSE otherwise.
1441  */
1442 gboolean webkit_settings_get_load_icons_ignoring_image_load_setting(WebKitSettings* settings)
1443 {
1444     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
1445
1446     return settings->priv->preferences->loadsSiteIconsIgnoringImageLoadingPreference();
1447 }
1448
1449 /**
1450  * webkit_settings_set_load_icons_ignoring_image_load_setting:
1451  * @settings: a #WebKitSettings
1452  * @enabled: Value to be set
1453  *
1454  * Set the #WebKitSettings:load-icons-ignoring-image-load-setting property.
1455  */
1456 void webkit_settings_set_load_icons_ignoring_image_load_setting(WebKitSettings* settings, gboolean enabled)
1457 {
1458     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
1459
1460     WebKitSettingsPrivate* priv = settings->priv;
1461     bool currentValue = priv->preferences->loadsSiteIconsIgnoringImageLoadingPreference();
1462     if (currentValue == enabled)
1463         return;
1464
1465     priv->preferences->setLoadsSiteIconsIgnoringImageLoadingPreference(enabled);
1466     g_object_notify(G_OBJECT(settings), "load-icons-ignoring-image-load-setting");
1467 }
1468
1469 /**
1470  * webkit_settings_get_enable_offline_web_application_cache:
1471  * @settings: a #WebKitSettings
1472  *
1473  * Get the #WebKitSettings:enable-offline-web-application-cache property.
1474  *
1475  * Returns: %TRUE If HTML5 offline web application cache support is enabled or %FALSE otherwise.
1476  */
1477 gboolean webkit_settings_get_enable_offline_web_application_cache(WebKitSettings* settings)
1478 {
1479     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
1480
1481     return settings->priv->preferences->offlineWebApplicationCacheEnabled();
1482 }
1483
1484 /**
1485  * webkit_settings_set_enable_offline_web_application_cache:
1486  * @settings: a #WebKitSettings
1487  * @enabled: Value to be set
1488  *
1489  * Set the #WebKitSettings:enable-offline-web-application-cache property.
1490  */
1491 void webkit_settings_set_enable_offline_web_application_cache(WebKitSettings* settings, gboolean enabled)
1492 {
1493     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
1494
1495     WebKitSettingsPrivate* priv = settings->priv;
1496     bool currentValue = priv->preferences->offlineWebApplicationCacheEnabled();
1497     if (currentValue == enabled)
1498         return;
1499
1500     priv->preferences->setOfflineWebApplicationCacheEnabled(enabled);
1501     g_object_notify(G_OBJECT(settings), "enable-offline-web-application-cache");
1502 }
1503
1504 /**
1505  * webkit_settings_get_enable_html5_local_storage:
1506  * @settings: a #WebKitSettings
1507  *
1508  * Get the #WebKitSettings:enable-html5-local-storage property.
1509  *
1510  * Returns: %TRUE If HTML5 local storage support is enabled or %FALSE otherwise.
1511  */
1512 gboolean webkit_settings_get_enable_html5_local_storage(WebKitSettings* settings)
1513 {
1514     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
1515
1516     return settings->priv->preferences->localStorageEnabled();
1517 }
1518
1519 /**
1520  * webkit_settings_set_enable_html5_local_storage:
1521  * @settings: a #WebKitSettings
1522  * @enabled: Value to be set
1523  *
1524  * Set the #WebKitSettings:enable-html5-local-storage property.
1525  */
1526 void webkit_settings_set_enable_html5_local_storage(WebKitSettings* settings, gboolean enabled)
1527 {
1528     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
1529
1530     WebKitSettingsPrivate* priv = settings->priv;
1531     bool currentValue = priv->preferences->localStorageEnabled();
1532     if (currentValue == enabled)
1533         return;
1534
1535     priv->preferences->setLocalStorageEnabled(enabled);
1536     g_object_notify(G_OBJECT(settings), "enable-html5-local-storage");
1537 }
1538
1539 /**
1540  * webkit_settings_get_enable_html5_database:
1541  * @settings: a #WebKitSettings
1542  *
1543  * Get the #WebKitSettings:enable-html5-database property.
1544  *
1545  * Returns: %TRUE If HTML5 database support is enabled or %FALSE otherwise.
1546  */
1547 gboolean webkit_settings_get_enable_html5_database(WebKitSettings* settings)
1548 {
1549     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
1550
1551     return settings->priv->preferences->databasesEnabled();
1552 }
1553
1554 /**
1555  * webkit_settings_set_enable_html5_database:
1556  * @settings: a #WebKitSettings
1557  * @enabled: Value to be set
1558  *
1559  * Set the #WebKitSettings:enable-html5-database property.
1560  */
1561 void webkit_settings_set_enable_html5_database(WebKitSettings* settings, gboolean enabled)
1562 {
1563     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
1564
1565     WebKitSettingsPrivate* priv = settings->priv;
1566     bool currentValue = priv->preferences->databasesEnabled();
1567     if (currentValue == enabled)
1568         return;
1569
1570     priv->preferences->setDatabasesEnabled(enabled);
1571     g_object_notify(G_OBJECT(settings), "enable-html5-database");
1572 }
1573
1574 /**
1575  * webkit_settings_get_enable_xss_auditor:
1576  * @settings: a #WebKitSettings
1577  *
1578  * Get the #WebKitSettings:enable-xss-auditor property.
1579  *
1580  * Returns: %TRUE If XSS auditing is enabled or %FALSE otherwise.
1581  */
1582 gboolean webkit_settings_get_enable_xss_auditor(WebKitSettings* settings)
1583 {
1584     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
1585
1586     return settings->priv->preferences->xssAuditorEnabled();
1587 }
1588
1589 /**
1590  * webkit_settings_set_enable_xss_auditor:
1591  * @settings: a #WebKitSettings
1592  * @enabled: Value to be set
1593  *
1594  * Set the #WebKitSettings:enable-xss-auditor property.
1595  */
1596 void webkit_settings_set_enable_xss_auditor(WebKitSettings* settings, gboolean enabled)
1597 {
1598     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
1599
1600     WebKitSettingsPrivate* priv = settings->priv;
1601     bool currentValue = priv->preferences->xssAuditorEnabled();
1602     if (currentValue == enabled)
1603         return;
1604
1605     priv->preferences->setXSSAuditorEnabled(enabled);
1606     g_object_notify(G_OBJECT(settings), "enable-xss-auditor");
1607 }
1608
1609 /**
1610  * webkit_settings_get_enable_frame_flattening:
1611  * @settings: a #WebKitSettings
1612  *
1613  * Get the #WebKitSettings:enable-frame-flattening property.
1614  *
1615  * Returns: %TRUE If frame flattening is enabled or %FALSE otherwise.
1616  *
1617  **/
1618 gboolean webkit_settings_get_enable_frame_flattening(WebKitSettings* settings)
1619 {
1620     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
1621
1622     // FIXME: Expose more frame flattening values.
1623     return settings->priv->preferences->frameFlattening() != static_cast<uint32_t>(WebCore::FrameFlattening::Disabled);
1624 }
1625
1626 /**
1627  * webkit_settings_set_enable_frame_flattening:
1628  * @settings: a #WebKitSettings
1629  * @enabled: Value to be set
1630  *
1631  * Set the #WebKitSettings:enable-frame-flattening property.
1632  */
1633 void webkit_settings_set_enable_frame_flattening(WebKitSettings* settings, gboolean enabled)
1634 {
1635     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
1636
1637     WebKitSettingsPrivate* priv = settings->priv;
1638     bool currentValue = priv->preferences->frameFlattening() != static_cast<uint32_t>(WebCore::FrameFlattening::Disabled);
1639     if (currentValue == enabled)
1640         return;
1641
1642     // FIXME: Expose more frame flattening values.
1643     priv->preferences->setFrameFlattening(enabled ? static_cast<uint32_t>(WebCore::FrameFlattening::FullyEnabled) : static_cast<uint32_t>(WebCore::FrameFlattening::Disabled));
1644     g_object_notify(G_OBJECT(settings), "enable-frame-flattening");
1645 }
1646
1647 /**
1648  * webkit_settings_get_enable_plugins:
1649  * @settings: a #WebKitSettings
1650  *
1651  * Get the #WebKitSettings:enable-plugins property.
1652  *
1653  * Returns: %TRUE If plugins are enabled or %FALSE otherwise.
1654  */
1655 gboolean webkit_settings_get_enable_plugins(WebKitSettings* settings)
1656 {
1657     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
1658
1659     return settings->priv->preferences->pluginsEnabled();
1660 }
1661
1662 /**
1663  * webkit_settings_set_enable_plugins:
1664  * @settings: a #WebKitSettings
1665  * @enabled: Value to be set
1666  *
1667  * Set the #WebKitSettings:enable-plugins property.
1668  */
1669 void webkit_settings_set_enable_plugins(WebKitSettings* settings, gboolean enabled)
1670 {
1671     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
1672
1673     WebKitSettingsPrivate* priv = settings->priv;
1674     bool currentValue = priv->preferences->pluginsEnabled();
1675     if (currentValue == enabled)
1676         return;
1677
1678     priv->preferences->setPluginsEnabled(enabled);
1679     g_object_notify(G_OBJECT(settings), "enable-plugins");
1680 }
1681
1682 /**
1683  * webkit_settings_get_enable_java:
1684  * @settings: a #WebKitSettings
1685  *
1686  * Get the #WebKitSettings:enable-java property.
1687  *
1688  * Returns: %TRUE If Java is enabled or %FALSE otherwise.
1689  */
1690 gboolean webkit_settings_get_enable_java(WebKitSettings* settings)
1691 {
1692     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
1693
1694     return settings->priv->preferences->javaEnabled();
1695 }
1696
1697 /**
1698  * webkit_settings_set_enable_java:
1699  * @settings: a #WebKitSettings
1700  * @enabled: Value to be set
1701  *
1702  * Set the #WebKitSettings:enable-java property.
1703  */
1704 void webkit_settings_set_enable_java(WebKitSettings* settings, gboolean enabled)
1705 {
1706     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
1707
1708     WebKitSettingsPrivate* priv = settings->priv;
1709     bool currentValue = priv->preferences->javaEnabled();
1710     if (currentValue == enabled)
1711         return;
1712
1713     priv->preferences->setJavaEnabled(enabled);
1714     g_object_notify(G_OBJECT(settings), "enable-java");
1715 }
1716
1717 /**
1718  * webkit_settings_get_javascript_can_open_windows_automatically:
1719  * @settings: a #WebKitSettings
1720  *
1721  * Get the #WebKitSettings:javascript-can-open-windows-automatically property.
1722  *
1723  * Returns: %TRUE If JavaScript can open window automatically or %FALSE otherwise.
1724  */
1725 gboolean webkit_settings_get_javascript_can_open_windows_automatically(WebKitSettings* settings)
1726 {
1727     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
1728
1729     return settings->priv->preferences->javaScriptCanOpenWindowsAutomatically();
1730 }
1731
1732 /**
1733  * webkit_settings_set_javascript_can_open_windows_automatically:
1734  * @settings: a #WebKitSettings
1735  * @enabled: Value to be set
1736  *
1737  * Set the #WebKitSettings:javascript-can-open-windows-automatically property.
1738  */
1739 void webkit_settings_set_javascript_can_open_windows_automatically(WebKitSettings* settings, gboolean enabled)
1740 {
1741     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
1742
1743     WebKitSettingsPrivate* priv = settings->priv;
1744     bool currentValue = priv->preferences->javaScriptCanOpenWindowsAutomatically();
1745     if (currentValue == enabled)
1746         return;
1747
1748     priv->preferences->setJavaScriptCanOpenWindowsAutomatically(enabled);
1749     g_object_notify(G_OBJECT(settings), "javascript-can-open-windows-automatically");
1750 }
1751
1752 /**
1753  * webkit_settings_get_enable_hyperlink_auditing:
1754  * @settings: a #WebKitSettings
1755  *
1756  * Get the #WebKitSettings:enable-hyperlink-auditing property.
1757  *
1758  * Returns: %TRUE If hyper link auditing is enabled or %FALSE otherwise.
1759  */
1760 gboolean webkit_settings_get_enable_hyperlink_auditing(WebKitSettings* settings)
1761 {
1762     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
1763
1764     return settings->priv->preferences->hyperlinkAuditingEnabled();
1765 }
1766
1767 /**
1768  * webkit_settings_set_enable_hyperlink_auditing:
1769  * @settings: a #WebKitSettings
1770  * @enabled: Value to be set
1771  *
1772  * Set the #WebKitSettings:enable-hyperlink-auditing property.
1773  */
1774 void webkit_settings_set_enable_hyperlink_auditing(WebKitSettings* settings, gboolean enabled)
1775 {
1776     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
1777
1778     WebKitSettingsPrivate* priv = settings->priv;
1779     bool currentValue = priv->preferences->hyperlinkAuditingEnabled();
1780     if (currentValue == enabled)
1781         return;
1782
1783     priv->preferences->setHyperlinkAuditingEnabled(enabled);
1784     g_object_notify(G_OBJECT(settings), "enable-hyperlink-auditing");
1785 }
1786
1787 /**
1788  * webkit_web_settings_get_default_font_family:
1789  * @settings: a #WebKitSettings
1790  *
1791  * Gets the #WebKitSettings:default-font-family property.
1792  *
1793  * Returns: The default font family used to display content that does not specify a font.
1794  */
1795 const gchar* webkit_settings_get_default_font_family(WebKitSettings* settings)
1796 {
1797     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), 0);
1798
1799     return settings->priv->defaultFontFamily.data();
1800 }
1801
1802 /**
1803  * webkit_settings_set_default_font_family:
1804  * @settings: a #WebKitSettings
1805  * @default_font_family: the new default font family
1806  *
1807  * Set the #WebKitSettings:default-font-family property.
1808  */
1809 void webkit_settings_set_default_font_family(WebKitSettings* settings, const gchar* defaultFontFamily)
1810 {
1811     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
1812     g_return_if_fail(defaultFontFamily);
1813
1814     WebKitSettingsPrivate* priv = settings->priv;
1815     if (!g_strcmp0(priv->defaultFontFamily.data(), defaultFontFamily))
1816         return;
1817
1818     String standardFontFamily = String::fromUTF8(defaultFontFamily);
1819     priv->preferences->setStandardFontFamily(standardFontFamily);
1820     priv->defaultFontFamily = standardFontFamily.utf8();
1821     g_object_notify(G_OBJECT(settings), "default-font-family");
1822 }
1823
1824 /**
1825  * webkit_settings_get_monospace_font_family:
1826  * @settings: a #WebKitSettings
1827  *
1828  * Gets the #WebKitSettings:monospace-font-family property.
1829  *
1830  * Returns: Default font family used to display content marked with monospace font.
1831  */
1832 const gchar* webkit_settings_get_monospace_font_family(WebKitSettings* settings)
1833 {
1834     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), 0);
1835
1836     return settings->priv->monospaceFontFamily.data();
1837 }
1838
1839 /**
1840  * webkit_settings_set_monospace_font_family:
1841  * @settings: a #WebKitSettings
1842  * @monospace_font_family: the new default monospace font family
1843  *
1844  * Set the #WebKitSettings:monospace-font-family property.
1845  */
1846 void webkit_settings_set_monospace_font_family(WebKitSettings* settings, const gchar* monospaceFontFamily)
1847 {
1848     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
1849     g_return_if_fail(monospaceFontFamily);
1850
1851     WebKitSettingsPrivate* priv = settings->priv;
1852     if (!g_strcmp0(priv->monospaceFontFamily.data(), monospaceFontFamily))
1853         return;
1854
1855     String fixedFontFamily = String::fromUTF8(monospaceFontFamily);
1856     priv->preferences->setFixedFontFamily(fixedFontFamily);
1857     priv->monospaceFontFamily = fixedFontFamily.utf8();
1858     g_object_notify(G_OBJECT(settings), "monospace-font-family");
1859 }
1860
1861 /**
1862  * webkit_settings_get_serif_font_family:
1863  * @settings: a #WebKitSettings
1864  *
1865  * Gets the #WebKitSettings:serif-font-family property.
1866  *
1867  * Returns: The default font family used to display content marked with serif font.
1868  */
1869 const gchar* webkit_settings_get_serif_font_family(WebKitSettings* settings)
1870 {
1871     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), 0);
1872
1873     return settings->priv->serifFontFamily.data();
1874 }
1875
1876 /**
1877  * webkit_settings_set_serif_font_family:
1878  * @settings: a #WebKitSettings
1879  * @serif_font_family: the new default serif font family
1880  *
1881  * Set the #WebKitSettings:serif-font-family property.
1882  */
1883 void webkit_settings_set_serif_font_family(WebKitSettings* settings, const gchar* serifFontFamily)
1884 {
1885     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
1886     g_return_if_fail(serifFontFamily);
1887
1888     WebKitSettingsPrivate* priv = settings->priv;
1889     if (!g_strcmp0(priv->serifFontFamily.data(), serifFontFamily))
1890         return;
1891
1892     String serifFontFamilyString = String::fromUTF8(serifFontFamily);
1893     priv->preferences->setSerifFontFamily(serifFontFamilyString);
1894     priv->serifFontFamily = serifFontFamilyString.utf8();
1895     g_object_notify(G_OBJECT(settings), "serif-font-family");
1896 }
1897
1898 /**
1899  * webkit_settings_get_sans_serif_font_family:
1900  * @settings: a #WebKitSettings
1901  *
1902  * Gets the #WebKitSettings:sans-serif-font-family property.
1903  *
1904  * Returns: The default font family used to display content marked with sans-serif font.
1905  */
1906 const gchar* webkit_settings_get_sans_serif_font_family(WebKitSettings* settings)
1907 {
1908     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), 0);
1909
1910     return settings->priv->sansSerifFontFamily.data();
1911 }
1912
1913 /**
1914  * webkit_settings_set_sans_serif_font_family:
1915  * @settings: a #WebKitSettings
1916  * @sans_serif_font_family: the new default sans-serif font family
1917  *
1918  * Set the #WebKitSettings:sans-serif-font-family property.
1919  */
1920 void webkit_settings_set_sans_serif_font_family(WebKitSettings* settings, const gchar* sansSerifFontFamily)
1921 {
1922     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
1923     g_return_if_fail(sansSerifFontFamily);
1924
1925     WebKitSettingsPrivate* priv = settings->priv;
1926     if (!g_strcmp0(priv->sansSerifFontFamily.data(), sansSerifFontFamily))
1927         return;
1928
1929     String sansSerifFontFamilyString = String::fromUTF8(sansSerifFontFamily);
1930     priv->preferences->setSansSerifFontFamily(sansSerifFontFamilyString);
1931     priv->sansSerifFontFamily = sansSerifFontFamilyString.utf8();
1932     g_object_notify(G_OBJECT(settings), "sans-serif-font-family");
1933 }
1934
1935 /**
1936  * webkit_settings_get_cursive_font_family:
1937  * @settings: a #WebKitSettings
1938  *
1939  * Gets the #WebKitSettings:cursive-font-family property.
1940  *
1941  * Returns: The default font family used to display content marked with cursive font.
1942  */
1943 const gchar* webkit_settings_get_cursive_font_family(WebKitSettings* settings)
1944 {
1945     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), 0);
1946
1947     return settings->priv->cursiveFontFamily.data();
1948 }
1949
1950 /**
1951  * webkit_settings_set_cursive_font_family:
1952  * @settings: a #WebKitSettings
1953  * @cursive_font_family: the new default cursive font family
1954  *
1955  * Set the #WebKitSettings:cursive-font-family property.
1956  */
1957 void webkit_settings_set_cursive_font_family(WebKitSettings* settings, const gchar* cursiveFontFamily)
1958 {
1959     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
1960     g_return_if_fail(cursiveFontFamily);
1961
1962     WebKitSettingsPrivate* priv = settings->priv;
1963     if (!g_strcmp0(priv->cursiveFontFamily.data(), cursiveFontFamily))
1964         return;
1965
1966     String cursiveFontFamilyString = String::fromUTF8(cursiveFontFamily);
1967     priv->preferences->setCursiveFontFamily(cursiveFontFamilyString);
1968     priv->cursiveFontFamily = cursiveFontFamilyString.utf8();
1969     g_object_notify(G_OBJECT(settings), "cursive-font-family");
1970 }
1971
1972 /**
1973  * webkit_settings_get_fantasy_font_family:
1974  * @settings: a #WebKitSettings
1975  *
1976  * Gets the #WebKitSettings:fantasy-font-family property.
1977  *
1978  * Returns: The default font family used to display content marked with fantasy font.
1979  */
1980 const gchar* webkit_settings_get_fantasy_font_family(WebKitSettings* settings)
1981 {
1982     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), 0);
1983
1984     return settings->priv->fantasyFontFamily.data();
1985 }
1986
1987 /**
1988  * webkit_settings_set_fantasy_font_family:
1989  * @settings: a #WebKitSettings
1990  * @fantasy_font_family: the new default fantasy font family
1991  *
1992  * Set the #WebKitSettings:fantasy-font-family property.
1993  */
1994 void webkit_settings_set_fantasy_font_family(WebKitSettings* settings, const gchar* fantasyFontFamily)
1995 {
1996     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
1997     g_return_if_fail(fantasyFontFamily);
1998
1999     WebKitSettingsPrivate* priv = settings->priv;
2000     if (!g_strcmp0(priv->fantasyFontFamily.data(), fantasyFontFamily))
2001         return;
2002
2003     String fantasyFontFamilyString = String::fromUTF8(fantasyFontFamily);
2004     priv->preferences->setFantasyFontFamily(fantasyFontFamilyString);
2005     priv->fantasyFontFamily = fantasyFontFamilyString.utf8();
2006     g_object_notify(G_OBJECT(settings), "fantasy-font-family");
2007 }
2008
2009 /**
2010  * webkit_settings_get_pictograph_font_family:
2011  * @settings: a #WebKitSettings
2012  *
2013  * Gets the #WebKitSettings:pictograph-font-family property.
2014  *
2015  * Returns: The default font family used to display content marked with pictograph font.
2016  */
2017 const gchar* webkit_settings_get_pictograph_font_family(WebKitSettings* settings)
2018 {
2019     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), 0);
2020
2021     return settings->priv->pictographFontFamily.data();
2022 }
2023
2024 /**
2025  * webkit_settings_set_pictograph_font_family:
2026  * @settings: a #WebKitSettings
2027  * @pictograph_font_family: the new default pictograph font family
2028  *
2029  * Set the #WebKitSettings:pictograph-font-family property.
2030  */
2031 void webkit_settings_set_pictograph_font_family(WebKitSettings* settings, const gchar* pictographFontFamily)
2032 {
2033     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2034     g_return_if_fail(pictographFontFamily);
2035
2036     WebKitSettingsPrivate* priv = settings->priv;
2037     if (!g_strcmp0(priv->pictographFontFamily.data(), pictographFontFamily))
2038         return;
2039
2040     String pictographFontFamilyString = String::fromUTF8(pictographFontFamily);
2041     priv->preferences->setPictographFontFamily(pictographFontFamilyString);
2042     priv->pictographFontFamily = pictographFontFamilyString.utf8();
2043     g_object_notify(G_OBJECT(settings), "pictograph-font-family");
2044 }
2045
2046 /**
2047  * webkit_settings_get_default_font_size:
2048  * @settings: a #WebKitSettings
2049  *
2050  * Gets the #WebKitSettings:default-font-size property.
2051  *
2052  * Returns: The default font size.
2053  */
2054 guint32 webkit_settings_get_default_font_size(WebKitSettings* settings)
2055 {
2056     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), 0);
2057
2058     return settings->priv->preferences->defaultFontSize();
2059 }
2060
2061 /**
2062  * webkit_settings_set_default_font_size:
2063  * @settings: a #WebKitSettings
2064  * @font_size: default font size to be set in pixels
2065  *
2066  * Set the #WebKitSettings:default-font-size property.
2067  */
2068 void webkit_settings_set_default_font_size(WebKitSettings* settings, guint32 fontSize)
2069 {
2070     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2071
2072     WebKitSettingsPrivate* priv = settings->priv;
2073     uint32_t currentSize = priv->preferences->defaultFontSize();
2074     if (currentSize == fontSize)
2075         return;
2076
2077     priv->preferences->setDefaultFontSize(fontSize);
2078     g_object_notify(G_OBJECT(settings), "default-font-size");
2079 }
2080
2081 /**
2082  * webkit_settings_get_default_monospace_font_size:
2083  * @settings: a #WebKitSettings
2084  *
2085  * Gets the #WebKitSettings:default-monospace-font-size property.
2086  *
2087  * Returns: Default monospace font size.
2088  */
2089 guint32 webkit_settings_get_default_monospace_font_size(WebKitSettings* settings)
2090 {
2091     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), 0);
2092
2093     return settings->priv->preferences->defaultFixedFontSize();
2094 }
2095
2096 /**
2097  * webkit_settings_set_default_monospace_font_size:
2098  * @settings: a #WebKitSettings
2099  * @font_size: default monospace font size to be set in pixels
2100  *
2101  * Set the #WebKitSettings:default-monospace-font-size property.
2102  */
2103 void webkit_settings_set_default_monospace_font_size(WebKitSettings* settings, guint32 fontSize)
2104 {
2105     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2106
2107     WebKitSettingsPrivate* priv = settings->priv;
2108     uint32_t currentSize = priv->preferences->defaultFixedFontSize();
2109     if (currentSize == fontSize)
2110         return;
2111
2112     priv->preferences->setDefaultFixedFontSize(fontSize);
2113     g_object_notify(G_OBJECT(settings), "default-monospace-font-size");
2114 }
2115
2116 /**
2117  * webkit_settings_get_minimum_font_size:
2118  * @settings: a #WebKitSettings
2119  *
2120  * Gets the #WebKitSettings:minimum-font-size property.
2121  *
2122  * Returns: Minimum font size.
2123  */
2124 guint32 webkit_settings_get_minimum_font_size(WebKitSettings* settings)
2125 {
2126     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), 0);
2127
2128     return settings->priv->preferences->minimumFontSize();
2129 }
2130
2131 /**
2132  * webkit_settings_set_minimum_font_size:
2133  * @settings: a #WebKitSettings
2134  * @font_size: minimum font size to be set in points
2135  *
2136  * Set the #WebKitSettings:minimum-font-size property.
2137  */
2138 void webkit_settings_set_minimum_font_size(WebKitSettings* settings, guint32 fontSize)
2139 {
2140     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2141
2142     WebKitSettingsPrivate* priv = settings->priv;
2143     uint32_t currentSize = priv->preferences->minimumFontSize();
2144     if (currentSize == fontSize)
2145         return;
2146
2147     priv->preferences->setMinimumFontSize(fontSize);
2148     g_object_notify(G_OBJECT(settings), "minimum-font-size");
2149 }
2150
2151 /**
2152  * webkit_settings_get_default_charset:
2153  * @settings: a #WebKitSettings
2154  *
2155  * Gets the #WebKitSettings:default-charset property.
2156  *
2157  * Returns: Default charset.
2158  */
2159 const gchar* webkit_settings_get_default_charset(WebKitSettings* settings)
2160 {
2161     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), 0);
2162
2163     return settings->priv->defaultCharset.data();
2164 }
2165
2166 /**
2167  * webkit_settings_set_default_charset:
2168  * @settings: a #WebKitSettings
2169  * @default_charset: default charset to be set
2170  *
2171  * Set the #WebKitSettings:default-charset property.
2172  */
2173 void webkit_settings_set_default_charset(WebKitSettings* settings, const gchar* defaultCharset)
2174 {
2175     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2176     g_return_if_fail(defaultCharset);
2177
2178     WebKitSettingsPrivate* priv = settings->priv;
2179     if (!g_strcmp0(priv->defaultCharset.data(), defaultCharset))
2180         return;
2181
2182     String defaultCharsetString = String::fromUTF8(defaultCharset);
2183     priv->preferences->setDefaultTextEncodingName(defaultCharsetString);
2184     priv->defaultCharset = defaultCharsetString.utf8();
2185     g_object_notify(G_OBJECT(settings), "default-charset");
2186 }
2187
2188 /**
2189  * webkit_settings_get_enable_private_browsing:
2190  * @settings: a #WebKitSettings
2191  *
2192  * Get the #WebKitSettings:enable-private-browsing property.
2193  *
2194  * Returns: %TRUE If private browsing is enabled or %FALSE otherwise.
2195  *
2196  * Deprecated: 2.16. Use #WebKitWebView:is-ephemeral or #WebKitWebContext:is-ephemeral instead.
2197  */
2198 gboolean webkit_settings_get_enable_private_browsing(WebKitSettings* settings)
2199 {
2200     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
2201
2202     return settings->priv->preferences->privateBrowsingEnabled();
2203 }
2204
2205 /**
2206  * webkit_settings_set_enable_private_browsing:
2207  * @settings: a #WebKitSettings
2208  * @enabled: Value to be set
2209  *
2210  * Set the #WebKitSettings:enable-private-browsing property.
2211  *
2212  * Deprecated: 2.16. Use #WebKitWebView:is-ephemeral or #WebKitWebContext:is-ephemeral instead.
2213  */
2214 void webkit_settings_set_enable_private_browsing(WebKitSettings* settings, gboolean enabled)
2215 {
2216     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2217
2218     WebKitSettingsPrivate* priv = settings->priv;
2219     bool currentValue = priv->preferences->privateBrowsingEnabled();
2220     if (currentValue == enabled)
2221         return;
2222
2223     priv->preferences->setPrivateBrowsingEnabled(enabled);
2224     g_object_notify(G_OBJECT(settings), "enable-private-browsing");
2225 }
2226
2227 /**
2228  * webkit_settings_get_enable_developer_extras:
2229  * @settings: a #WebKitSettings
2230  *
2231  * Get the #WebKitSettings:enable-developer-extras property.
2232  *
2233  * Returns: %TRUE If developer extras is enabled or %FALSE otherwise.
2234  */
2235 gboolean webkit_settings_get_enable_developer_extras(WebKitSettings* settings)
2236 {
2237     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
2238
2239     return settings->priv->preferences->developerExtrasEnabled();
2240 }
2241
2242 /**
2243  * webkit_settings_set_enable_developer_extras:
2244  * @settings: a #WebKitSettings
2245  * @enabled: Value to be set
2246  *
2247  * Set the #WebKitSettings:enable-developer-extras property.
2248  */
2249 void webkit_settings_set_enable_developer_extras(WebKitSettings* settings, gboolean enabled)
2250 {
2251     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2252
2253     WebKitSettingsPrivate* priv = settings->priv;
2254     bool currentValue = priv->preferences->developerExtrasEnabled();
2255     if (currentValue == enabled)
2256         return;
2257
2258     priv->preferences->setDeveloperExtrasEnabled(enabled);
2259     g_object_notify(G_OBJECT(settings), "enable-developer-extras");
2260 }
2261
2262 /**
2263  * webkit_settings_get_enable_resizable_text_areas:
2264  * @settings: a #WebKitSettings
2265  *
2266  * Get the #WebKitSettings:enable-resizable-text-areas property.
2267  *
2268  * Returns: %TRUE If text areas can be resized or %FALSE otherwise.
2269  */
2270 gboolean webkit_settings_get_enable_resizable_text_areas(WebKitSettings* settings)
2271 {
2272     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
2273
2274     return settings->priv->preferences->textAreasAreResizable();
2275 }
2276
2277 /**
2278  * webkit_settings_set_enable_resizable_text_areas:
2279  * @settings: a #WebKitSettings
2280  * @enabled: Value to be set
2281  *
2282  * Set the #WebKitSettings:enable-resizable-text-areas property.
2283  */
2284 void webkit_settings_set_enable_resizable_text_areas(WebKitSettings* settings, gboolean enabled)
2285 {
2286     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2287
2288     WebKitSettingsPrivate* priv = settings->priv;
2289     bool currentValue = priv->preferences->textAreasAreResizable();
2290     if (currentValue == enabled)
2291         return;
2292
2293     priv->preferences->setTextAreasAreResizable(enabled);
2294     g_object_notify(G_OBJECT(settings), "enable-resizable-text-areas");
2295 }
2296
2297 /**
2298  * webkit_settings_get_enable_tabs_to_links:
2299  * @settings: a #WebKitSettings
2300  *
2301  * Get the #WebKitSettings:enable-tabs-to-links property.
2302  *
2303  * Returns: %TRUE If tabs to link is enabled or %FALSE otherwise.
2304  */
2305 gboolean webkit_settings_get_enable_tabs_to_links(WebKitSettings* settings)
2306 {
2307     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
2308
2309     return settings->priv->preferences->tabsToLinks();
2310 }
2311
2312 /**
2313  * webkit_settings_set_enable_tabs_to_links:
2314  * @settings: a #WebKitSettings
2315  * @enabled: Value to be set
2316  *
2317  * Set the #WebKitSettings:enable-tabs-to-links property.
2318  */
2319 void webkit_settings_set_enable_tabs_to_links(WebKitSettings* settings, gboolean enabled)
2320 {
2321     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2322
2323     WebKitSettingsPrivate* priv = settings->priv;
2324     bool currentValue = priv->preferences->tabsToLinks();
2325     if (currentValue == enabled)
2326         return;
2327
2328     priv->preferences->setTabsToLinks(enabled);
2329     g_object_notify(G_OBJECT(settings), "enable-tabs-to-links");
2330 }
2331
2332 /**
2333  * webkit_settings_get_enable_dns_prefetching:
2334  * @settings: a #WebKitSettings
2335  *
2336  * Get the #WebKitSettings:enable-dns-prefetching property.
2337  *
2338  * Returns: %TRUE If DNS prefetching is enabled or %FALSE otherwise.
2339  */
2340 gboolean webkit_settings_get_enable_dns_prefetching(WebKitSettings* settings)
2341 {
2342     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
2343
2344     return settings->priv->preferences->dnsPrefetchingEnabled();
2345 }
2346
2347 /**
2348  * webkit_settings_set_enable_dns_prefetching:
2349  * @settings: a #WebKitSettings
2350  * @enabled: Value to be set
2351  *
2352  * Set the #WebKitSettings:enable-dns-prefetching property.
2353  */
2354 void webkit_settings_set_enable_dns_prefetching(WebKitSettings* settings, gboolean enabled)
2355 {
2356     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2357
2358     WebKitSettingsPrivate* priv = settings->priv;
2359     bool currentValue = priv->preferences->dnsPrefetchingEnabled();
2360     if (currentValue == enabled)
2361         return;
2362
2363     priv->preferences->setDNSPrefetchingEnabled(enabled);
2364     g_object_notify(G_OBJECT(settings), "enable-dns-prefetching");
2365 }
2366
2367 /**
2368  * webkit_settings_get_enable_caret_browsing:
2369  * @settings: a #WebKitSettings
2370  *
2371  * Get the #WebKitSettings:enable-caret-browsing property.
2372  *
2373  * Returns: %TRUE If caret browsing is enabled or %FALSE otherwise.
2374  */
2375 gboolean webkit_settings_get_enable_caret_browsing(WebKitSettings* settings)
2376 {
2377     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
2378
2379     return settings->priv->preferences->caretBrowsingEnabled();
2380 }
2381
2382 /**
2383  * webkit_settings_set_enable_caret_browsing:
2384  * @settings: a #WebKitSettings
2385  * @enabled: Value to be set
2386  *
2387  * Set the #WebKitSettings:enable-caret-browsing property.
2388  */
2389 void webkit_settings_set_enable_caret_browsing(WebKitSettings* settings, gboolean enabled)
2390 {
2391     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2392
2393     WebKitSettingsPrivate* priv = settings->priv;
2394     bool currentValue = priv->preferences->caretBrowsingEnabled();
2395     if (currentValue == enabled)
2396         return;
2397
2398     priv->preferences->setCaretBrowsingEnabled(enabled);
2399     g_object_notify(G_OBJECT(settings), "enable-caret-browsing");
2400 }
2401
2402 /**
2403  * webkit_settings_get_enable_fullscreen:
2404  * @settings: a #WebKitSettings
2405  *
2406  * Get the #WebKitSettings:enable-fullscreen property.
2407  *
2408  * Returns: %TRUE If fullscreen support is enabled or %FALSE otherwise.
2409  */
2410 gboolean webkit_settings_get_enable_fullscreen(WebKitSettings* settings)
2411 {
2412     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
2413
2414     return settings->priv->preferences->fullScreenEnabled();
2415 }
2416
2417 /**
2418  * webkit_settings_set_enable_fullscreen:
2419  * @settings: a #WebKitSettings
2420  * @enabled: Value to be set
2421  *
2422  * Set the #WebKitSettings:enable-fullscreen property.
2423  */
2424 void webkit_settings_set_enable_fullscreen(WebKitSettings* settings, gboolean enabled)
2425 {
2426     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2427
2428     WebKitSettingsPrivate* priv = settings->priv;
2429     bool currentValue = priv->preferences->fullScreenEnabled();
2430     if (currentValue == enabled)
2431         return;
2432
2433     priv->preferences->setFullScreenEnabled(enabled);
2434     g_object_notify(G_OBJECT(settings), "enable-fullscreen");
2435 }
2436
2437 /**
2438  * webkit_settings_get_print_backgrounds:
2439  * @settings: a #WebKitSettings
2440  *
2441  * Get the #WebKitSettings:print-backgrounds property.
2442  *
2443  * Returns: %TRUE If background images should be printed or %FALSE otherwise.
2444  */
2445 gboolean webkit_settings_get_print_backgrounds(WebKitSettings* settings)
2446 {
2447     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
2448
2449     return settings->priv->preferences->shouldPrintBackgrounds();
2450 }
2451
2452 /**
2453  * webkit_settings_set_print_backgrounds:
2454  * @settings: a #WebKitSettings
2455  * @print_backgrounds: Value to be set
2456  *
2457  * Set the #WebKitSettings:print-backgrounds property.
2458  */
2459 void webkit_settings_set_print_backgrounds(WebKitSettings* settings, gboolean printBackgrounds)
2460 {
2461     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2462
2463     WebKitSettingsPrivate* priv = settings->priv;
2464     bool currentValue = priv->preferences->shouldPrintBackgrounds();
2465     if (currentValue == printBackgrounds)
2466         return;
2467
2468     priv->preferences->setShouldPrintBackgrounds(printBackgrounds);
2469     g_object_notify(G_OBJECT(settings), "print-backgrounds");
2470 }
2471
2472 /**
2473  * webkit_settings_get_enable_webaudio:
2474  * @settings: a #WebKitSettings
2475  *
2476  * Get the #WebKitSettings:enable-webaudio property.
2477  *
2478  * Returns: %TRUE If webaudio support is enabled or %FALSE otherwise.
2479  */
2480 gboolean webkit_settings_get_enable_webaudio(WebKitSettings* settings)
2481 {
2482     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
2483
2484     return settings->priv->preferences->webAudioEnabled();
2485 }
2486
2487 /**
2488  * webkit_settings_set_enable_webaudio:
2489  * @settings: a #WebKitSettings
2490  * @enabled: Value to be set
2491  *
2492  * Set the #WebKitSettings:enable-webaudio property.
2493  */
2494 void webkit_settings_set_enable_webaudio(WebKitSettings* settings, gboolean enabled)
2495 {
2496     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2497
2498     WebKitSettingsPrivate* priv = settings->priv;
2499     bool currentValue = priv->preferences->webAudioEnabled();
2500     if (currentValue == enabled)
2501         return;
2502
2503     priv->preferences->setWebAudioEnabled(enabled);
2504     g_object_notify(G_OBJECT(settings), "enable-webaudio");
2505 }
2506
2507 /**
2508  * webkit_settings_get_enable_webgl:
2509  * @settings: a #WebKitSettings
2510  *
2511  * Get the #WebKitSettings:enable-webgl property.
2512  *
2513  * Returns: %TRUE If WebGL support is enabled or %FALSE otherwise.
2514  */
2515 gboolean webkit_settings_get_enable_webgl(WebKitSettings* settings)
2516 {
2517     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
2518
2519     return settings->priv->preferences->webGLEnabled();
2520 }
2521
2522 /**
2523  * webkit_settings_set_enable_webgl:
2524  * @settings: a #WebKitSettings
2525  * @enabled: Value to be set
2526  *
2527  * Set the #WebKitSettings:enable-webgl property.
2528  */
2529 void webkit_settings_set_enable_webgl(WebKitSettings* settings, gboolean enabled)
2530 {
2531     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2532
2533     WebKitSettingsPrivate* priv = settings->priv;
2534     bool currentValue = priv->preferences->webGLEnabled();
2535     if (currentValue == enabled)
2536         return;
2537
2538     priv->preferences->setWebGLEnabled(enabled);
2539     g_object_notify(G_OBJECT(settings), "enable-webgl");
2540 }
2541
2542 /**
2543  * webkit_settings_get_allow_modal_dialogs:
2544  * @settings: a #WebKitSettings
2545  *
2546  * Get the #WebKitSettings:allow-modal-dialogs property.
2547  *
2548  * Returns: %TRUE if it's allowed to create and run modal dialogs or %FALSE otherwise.
2549  */
2550 gboolean webkit_settings_get_allow_modal_dialogs(WebKitSettings* settings)
2551 {
2552     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
2553     return settings->priv->allowModalDialogs;
2554 }
2555
2556 /**
2557  * webkit_settings_set_allow_modal_dialogs:
2558  * @settings: a #WebKitSettings
2559  * @allowed: Value to be set
2560  *
2561  * Set the #WebKitSettings:allow-modal-dialogs property.
2562  */
2563 void webkit_settings_set_allow_modal_dialogs(WebKitSettings* settings, gboolean allowed)
2564 {
2565     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2566
2567     WebKitSettingsPrivate* priv = settings->priv;
2568     if (priv->allowModalDialogs == allowed)
2569         return;
2570
2571     priv->allowModalDialogs = allowed;
2572     g_object_notify(G_OBJECT(settings), "allow-modal-dialogs");
2573 }
2574
2575 /**
2576  * webkit_settings_get_zoom_text_only:
2577  * @settings: a #WebKitSettings
2578  *
2579  * Get the #WebKitSettings:zoom-text-only property.
2580  *
2581  * Returns: %TRUE If zoom level of the view should only affect the text
2582  *    or %FALSE if all view contents should be scaled.
2583  */
2584 gboolean webkit_settings_get_zoom_text_only(WebKitSettings* settings)
2585 {
2586     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
2587
2588     return settings->priv->zoomTextOnly;
2589 }
2590
2591 /**
2592  * webkit_settings_set_zoom_text_only:
2593  * @settings: a #WebKitSettings
2594  * @zoom_text_only: Value to be set
2595  *
2596  * Set the #WebKitSettings:zoom-text-only property.
2597  */
2598 void webkit_settings_set_zoom_text_only(WebKitSettings* settings, gboolean zoomTextOnly)
2599 {
2600     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2601
2602     WebKitSettingsPrivate* priv = settings->priv;
2603     if (priv->zoomTextOnly == zoomTextOnly)
2604         return;
2605
2606     priv->zoomTextOnly = zoomTextOnly;
2607     g_object_notify(G_OBJECT(settings), "zoom-text-only");
2608 }
2609
2610 /**
2611  * webkit_settings_get_javascript_can_access_clipboard:
2612  * @settings: a #WebKitSettings
2613  *
2614  * Get the #WebKitSettings:javascript-can-access-clipboard property.
2615  *
2616  * Returns: %TRUE If javascript-can-access-clipboard is enabled or %FALSE otherwise.
2617  */
2618 gboolean webkit_settings_get_javascript_can_access_clipboard(WebKitSettings* settings)
2619 {
2620     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
2621
2622     return settings->priv->preferences->javaScriptCanAccessClipboard()
2623         && settings->priv->preferences->domPasteAllowed();
2624 }
2625
2626 /**
2627  * webkit_settings_set_javascript_can_access_clipboard:
2628  * @settings: a #WebKitSettings
2629  * @enabled: Value to be set
2630  *
2631  * Set the #WebKitSettings:javascript-can-access-clipboard property.
2632  */
2633 void webkit_settings_set_javascript_can_access_clipboard(WebKitSettings* settings, gboolean enabled)
2634 {
2635     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2636
2637     WebKitSettingsPrivate* priv = settings->priv;
2638     bool currentValue = priv->preferences->javaScriptCanAccessClipboard() && priv->preferences->domPasteAllowed();
2639     if (currentValue == enabled)
2640         return;
2641
2642     priv->preferences->setJavaScriptCanAccessClipboard(enabled);
2643     priv->preferences->setDOMPasteAllowed(enabled);
2644     g_object_notify(G_OBJECT(settings), "javascript-can-access-clipboard");
2645 }
2646
2647 /**
2648  * webkit_settings_get_media_playback_requires_user_gesture:
2649  * @settings: a #WebKitSettings
2650  *
2651  * Get the #WebKitSettings:media-playback-requires-user-gesture property.
2652  *
2653  * Returns: %TRUE If an user gesture is needed to play or load media
2654  *    or %FALSE if no user gesture is needed.
2655  */
2656 gboolean webkit_settings_get_media_playback_requires_user_gesture(WebKitSettings* settings)
2657 {
2658     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
2659
2660     return settings->priv->preferences->requiresUserGestureForMediaPlayback();
2661 }
2662
2663 /**
2664  * webkit_settings_set_media_playback_requires_user_gesture:
2665  * @settings: a #WebKitSettings
2666  * @enabled: Value to be set
2667  *
2668  * Set the #WebKitSettings:media-playback-requires-user-gesture property.
2669  */
2670 void webkit_settings_set_media_playback_requires_user_gesture(WebKitSettings* settings, gboolean enabled)
2671 {
2672     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2673
2674     WebKitSettingsPrivate* priv = settings->priv;
2675     bool currentValue = priv->preferences->requiresUserGestureForMediaPlayback();
2676     if (currentValue == enabled)
2677         return;
2678
2679     priv->preferences->setRequiresUserGestureForMediaPlayback(enabled);
2680     g_object_notify(G_OBJECT(settings), "media-playback-requires-user-gesture");
2681 }
2682
2683 /**
2684  * webkit_settings_get_media_playback_allows_inline:
2685  * @settings: a #WebKitSettings
2686  *
2687  * Get the #WebKitSettings:media-playback-allows-inline property.
2688  *
2689  * Returns: %TRUE If inline playback is allowed for media
2690  *    or %FALSE if only fullscreen playback is allowed.
2691  */
2692 gboolean webkit_settings_get_media_playback_allows_inline(WebKitSettings* settings)
2693 {
2694     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), TRUE);
2695
2696     return settings->priv->preferences->allowsInlineMediaPlayback();
2697 }
2698
2699 /**
2700  * webkit_settings_set_media_playback_allows_inline:
2701  * @settings: a #WebKitSettings
2702  * @enabled: Value to be set
2703  *
2704  * Set the #WebKitSettings:media-playback-allows-inline property.
2705  */
2706 void webkit_settings_set_media_playback_allows_inline(WebKitSettings* settings, gboolean enabled)
2707 {
2708     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2709
2710     WebKitSettingsPrivate* priv = settings->priv;
2711     bool currentValue = priv->preferences->allowsInlineMediaPlayback();
2712     if (currentValue == enabled)
2713         return;
2714
2715     priv->preferences->setAllowsInlineMediaPlayback(enabled);
2716     g_object_notify(G_OBJECT(settings), "media-playback-allows-inline");
2717 }
2718
2719 /**
2720  * webkit_settings_get_draw_compositing_indicators:
2721  * @settings: a #WebKitSettings
2722  *
2723  * Get the #WebKitSettings:draw-compositing-indicators property.
2724  *
2725  * Returns: %TRUE If compositing borders are drawn or %FALSE otherwise.
2726  */
2727 gboolean webkit_settings_get_draw_compositing_indicators(WebKitSettings* settings)
2728 {
2729     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
2730     return settings->priv->preferences->compositingBordersVisible()
2731         && settings->priv->preferences->compositingRepaintCountersVisible();
2732 }
2733
2734 /**
2735  * webkit_settings_set_draw_compositing_indicators:
2736  * @settings: a #WebKitSettings
2737  * @enabled: Value to be set
2738  *
2739  * Set the #WebKitSettings:draw-compositing-indicators property.
2740  */
2741 void webkit_settings_set_draw_compositing_indicators(WebKitSettings* settings, gboolean enabled)
2742 {
2743     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2744
2745     WebKitSettingsPrivate* priv = settings->priv;
2746     if (priv->preferences->compositingBordersVisible() == enabled
2747         && priv->preferences->compositingRepaintCountersVisible() == enabled)
2748         return;
2749
2750     priv->preferences->setCompositingBordersVisible(enabled);
2751     priv->preferences->setCompositingRepaintCountersVisible(enabled);
2752     g_object_notify(G_OBJECT(settings), "draw-compositing-indicators");
2753 }
2754
2755 /**
2756  * webkit_settings_get_enable_site_specific_quirks:
2757  * @settings: a #WebKitSettings
2758  *
2759  * Get the #WebKitSettings:enable-site-specific-quirks property.
2760  *
2761  * Returns: %TRUE if site specific quirks are enabled or %FALSE otherwise.
2762  */
2763 gboolean webkit_settings_get_enable_site_specific_quirks(WebKitSettings* settings)
2764 {
2765     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
2766
2767     return settings->priv->preferences->needsSiteSpecificQuirks();
2768 }
2769
2770 /**
2771  * webkit_settings_set_enable_site_specific_quirks:
2772  * @settings: a #WebKitSettings
2773  * @enabled: Value to be set
2774  *
2775  * Set the #WebKitSettings:enable-site-specific-quirks property.
2776  */
2777 void webkit_settings_set_enable_site_specific_quirks(WebKitSettings* settings, gboolean enabled)
2778 {
2779     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2780
2781     WebKitSettingsPrivate* priv = settings->priv;
2782     bool currentValue = priv->preferences->needsSiteSpecificQuirks();
2783     if (currentValue == enabled)
2784         return;
2785
2786     priv->preferences->setNeedsSiteSpecificQuirks(enabled);
2787     g_object_notify(G_OBJECT(settings), "enable-site-specific-quirks");
2788 }
2789
2790 /**
2791  * webkit_settings_get_enable_page_cache:
2792  * @settings: a #WebKitSettings
2793  *
2794  * Get the #WebKitSettings:enable-page-cache property.
2795  *
2796  * Returns: %TRUE if page cache enabled or %FALSE otherwise.
2797  */
2798 gboolean webkit_settings_get_enable_page_cache(WebKitSettings* settings)
2799 {
2800     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
2801
2802     return settings->priv->preferences->usesPageCache();
2803 }
2804
2805 /**
2806  * webkit_settings_set_enable_page_cache:
2807  * @settings: a #WebKitSettings
2808  * @enabled: Value to be set
2809  *
2810  * Set the #WebKitSettings:enable-page-cache property.
2811  */
2812 void webkit_settings_set_enable_page_cache(WebKitSettings* settings, gboolean enabled)
2813 {
2814     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2815
2816     WebKitSettingsPrivate* priv = settings->priv;
2817     bool currentValue = priv->preferences->usesPageCache();
2818     if (currentValue == enabled)
2819         return;
2820
2821     priv->preferences->setUsesPageCache(enabled);
2822     g_object_notify(G_OBJECT(settings), "enable-page-cache");
2823 }
2824
2825 /**
2826  * webkit_settings_get_user_agent:
2827  * @settings: a #WebKitSettings
2828  *
2829  * Get the #WebKitSettings:user-agent property.
2830  *
2831  * Returns: The current value of the user-agent property.
2832  */
2833 const char* webkit_settings_get_user_agent(WebKitSettings* settings)
2834 {
2835     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), 0);
2836
2837     WebKitSettingsPrivate* priv = settings->priv;
2838     ASSERT(!priv->userAgent.isNull());
2839     return priv->userAgent.data();
2840 }
2841
2842 /**
2843  * webkit_settings_set_user_agent:
2844  * @settings: a #WebKitSettings
2845  * @user_agent: (allow-none): The new custom user agent string or %NULL to use the default user agent
2846  *
2847  * Set the #WebKitSettings:user-agent property.
2848  */
2849 void webkit_settings_set_user_agent(WebKitSettings* settings, const char* userAgent)
2850 {
2851     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2852
2853     WebKitSettingsPrivate* priv = settings->priv;
2854     CString newUserAgent = (!userAgent || !strlen(userAgent)) ? WebCore::standardUserAgent("").utf8() : userAgent;
2855     if (newUserAgent == priv->userAgent)
2856         return;
2857
2858     priv->userAgent = newUserAgent;
2859     g_object_notify(G_OBJECT(settings), "user-agent");
2860 }
2861
2862 /**
2863  * webkit_settings_set_user_agent_with_application_details:
2864  * @settings: a #WebKitSettings
2865  * @application_name: (allow-none): The application name used for the user agent or %NULL to use the default user agent.
2866  * @application_version: (allow-none): The application version for the user agent or %NULL to user the default version.
2867  *
2868  * Set the #WebKitSettings:user-agent property by appending the application details to the default user
2869  * agent. If no application name or version is given, the default user agent used will be used. If only
2870  * the version is given, the default engine version is used with the given application name.
2871  */
2872 void webkit_settings_set_user_agent_with_application_details(WebKitSettings* settings, const char* applicationName, const char* applicationVersion)
2873 {
2874     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2875
2876     CString newUserAgent = WebCore::standardUserAgent(String::fromUTF8(applicationName), String::fromUTF8(applicationVersion)).utf8();
2877     webkit_settings_set_user_agent(settings, newUserAgent.data());
2878 }
2879
2880 /**
2881  * webkit_settings_get_enable_smooth_scrolling:
2882  * @settings: a #WebKitSettings
2883  *
2884  * Get the #WebKitSettings:enable-smooth-scrolling property.
2885  *
2886  * Returns: %TRUE if smooth scrolling is enabled or %FALSE otherwise.
2887  */
2888 gboolean webkit_settings_get_enable_smooth_scrolling(WebKitSettings* settings)
2889 {
2890     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
2891
2892     return settings->priv->preferences->scrollAnimatorEnabled();
2893 }
2894
2895 /**
2896  * webkit_settings_set_enable_smooth_scrolling:
2897  * @settings: a #WebKitSettings
2898  * @enabled: Value to be set
2899  *
2900  * Set the #WebKitSettings:enable-smooth-scrolling property.
2901  */
2902 void webkit_settings_set_enable_smooth_scrolling(WebKitSettings* settings, gboolean enabled)
2903 {
2904     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2905
2906     WebKitSettingsPrivate* priv = settings->priv;
2907     bool currentValue = priv->preferences->scrollAnimatorEnabled();
2908     if (currentValue == enabled)
2909         return;
2910
2911     priv->preferences->setScrollAnimatorEnabled(enabled);
2912     g_object_notify(G_OBJECT(settings), "enable-smooth-scrolling");
2913 }
2914
2915 /**
2916  * webkit_settings_get_enable_accelerated_2d_canvas:
2917  * @settings: a #WebKitSettings
2918  *
2919  * Get the #WebKitSettings:enable-accelerated-2d-canvas property.
2920  *
2921  * Returns: %TRUE if accelerated 2D canvas is enabled or %FALSE otherwise.
2922  *
2923  * Since: 2.2
2924  */
2925 gboolean webkit_settings_get_enable_accelerated_2d_canvas(WebKitSettings* settings)
2926 {
2927     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
2928
2929     return settings->priv->preferences->accelerated2dCanvasEnabled();
2930 }
2931
2932 /**
2933  * webkit_settings_set_enable_accelerated_2d_canvas:
2934  * @settings: a #WebKitSettings
2935  * @enabled: Value to be set
2936  *
2937  * Set the #WebKitSettings:enable-accelerated-2d-canvas property.
2938  *
2939  * Since: 2.2
2940  */
2941 void webkit_settings_set_enable_accelerated_2d_canvas(WebKitSettings* settings, gboolean enabled)
2942 {
2943     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2944
2945     WebKitSettingsPrivate* priv = settings->priv;
2946     if (priv->preferences->accelerated2dCanvasEnabled() == enabled)
2947         return;
2948
2949     priv->preferences->setAccelerated2dCanvasEnabled(enabled);
2950     g_object_notify(G_OBJECT(settings), "enable-accelerated-2d-canvas");
2951 }
2952
2953 /**
2954  * webkit_settings_get_enable_write_console_messages_to_stdout:
2955  * @settings: a #WebKitSettings
2956  *
2957  * Get the #WebKitSettings:enable-write-console-messages-to-stdout property.
2958  *
2959  * Returns: %TRUE if writing console messages to stdout is enabled or %FALSE
2960  * otherwise.
2961  *
2962  * Since: 2.2
2963  */
2964 gboolean webkit_settings_get_enable_write_console_messages_to_stdout(WebKitSettings* settings)
2965 {
2966     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
2967
2968     return settings->priv->preferences->logsPageMessagesToSystemConsoleEnabled();
2969 }
2970
2971 /**
2972  * webkit_settings_set_enable_write_console_messages_to_stdout:
2973  * @settings: a #WebKitSettings
2974  * @enabled: Value to be set
2975  *
2976  * Set the #WebKitSettings:enable-write-console-messages-to-stdout property.
2977  *
2978  * Since: 2.2
2979  */
2980 void webkit_settings_set_enable_write_console_messages_to_stdout(WebKitSettings* settings, gboolean enabled)
2981 {
2982     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2983
2984     WebKitSettingsPrivate* priv = settings->priv;
2985     bool currentValue = priv->preferences->logsPageMessagesToSystemConsoleEnabled();
2986     if (currentValue == enabled)
2987         return;
2988
2989     priv->preferences->setLogsPageMessagesToSystemConsoleEnabled(enabled);
2990     g_object_notify(G_OBJECT(settings), "enable-write-console-messages-to-stdout");
2991 }
2992
2993 /**
2994  * webkit_settings_get_enable_media_stream:
2995  * @settings: a #WebKitSettings
2996  *
2997  * Get the #WebKitSettings:enable-media-stream property.
2998  *
2999  * Returns: %TRUE If mediastream support is enabled or %FALSE otherwise.
3000  *
3001  * Since: 2.4
3002  */
3003 gboolean webkit_settings_get_enable_media_stream(WebKitSettings* settings)
3004 {
3005     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
3006
3007     return settings->priv->preferences->mediaStreamEnabled();
3008 }
3009
3010 /**
3011  * webkit_settings_set_enable_media_stream:
3012  * @settings: a #WebKitSettings
3013  * @enabled: Value to be set
3014  *
3015  * Set the #WebKitSettings:enable-media-stream property.
3016  *
3017  * Since: 2.4
3018  */
3019 void webkit_settings_set_enable_media_stream(WebKitSettings* settings, gboolean enabled)
3020 {
3021     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
3022
3023     WebKitSettingsPrivate* priv = settings->priv;
3024     bool currentValue = priv->preferences->mediaStreamEnabled();
3025     if (currentValue == enabled)
3026         return;
3027
3028     priv->preferences->setMediaDevicesEnabled(enabled);
3029     priv->preferences->setMediaStreamEnabled(enabled);
3030     priv->preferences->setPeerConnectionEnabled(enabled);
3031     g_object_notify(G_OBJECT(settings), "enable-media-stream");
3032 }
3033
3034 /**
3035  * webkit_settings_set_enable_spatial_navigation:
3036  * @settings: a #WebKitSettings
3037  * @enabled: Value to be set
3038  *
3039  * Set the #WebKitSettings:enable-spatial-navigation property.
3040  *
3041  * Since: 2.2
3042  */
3043 void webkit_settings_set_enable_spatial_navigation(WebKitSettings* settings, gboolean enabled)
3044 {
3045     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
3046
3047     WebKitSettingsPrivate* priv = settings->priv;
3048     bool currentValue = priv->preferences->spatialNavigationEnabled();
3049
3050     if (currentValue == enabled)
3051         return;
3052
3053     priv->preferences->setSpatialNavigationEnabled(enabled);
3054     g_object_notify(G_OBJECT(settings), "enable-spatial-navigation");
3055 }
3056
3057
3058 /**
3059  * webkit_settings_get_enable_spatial_navigation:
3060  * @settings: a #WebKitSettings
3061  *
3062  * Get the #WebKitSettings:enable-spatial-navigation property.
3063  *
3064  * Returns: %TRUE If HTML5 spatial navigation support is enabled or %FALSE otherwise.
3065  *
3066  * Since: 2.2
3067  */
3068 gboolean webkit_settings_get_enable_spatial_navigation(WebKitSettings* settings)
3069 {
3070     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
3071
3072     return settings->priv->preferences->spatialNavigationEnabled();
3073 }
3074
3075 /**
3076  * webkit_settings_get_enable_mediasource:
3077  * @settings: a #WebKitSettings
3078  *
3079  * Get the #WebKitSettings:enable-mediasource property.
3080  *
3081  * Returns: %TRUE If MediaSource support is enabled or %FALSE otherwise.
3082  *
3083  * Since: 2.4
3084  */
3085 gboolean webkit_settings_get_enable_mediasource(WebKitSettings* settings)
3086 {
3087     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
3088
3089     return settings->priv->preferences->mediaSourceEnabled();
3090 }
3091
3092 /**
3093  * webkit_settings_set_enable_mediasource:
3094  * @settings: a #WebKitSettings
3095  * @enabled: Value to be set
3096  *
3097  * Set the #WebKitSettings:enable-mediasource property.
3098  *
3099  * Since: 2.4
3100  */
3101 void webkit_settings_set_enable_mediasource(WebKitSettings* settings, gboolean enabled)
3102 {
3103     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
3104
3105     WebKitSettingsPrivate* priv = settings->priv;
3106     bool currentValue = priv->preferences->mediaSourceEnabled();
3107     if (currentValue == enabled)
3108         return;
3109
3110     priv->preferences->setMediaSourceEnabled(enabled);
3111     g_object_notify(G_OBJECT(settings), "enable-mediasource");
3112 }
3113
3114 /**
3115  * webkit_settings_get_allow_file_access_from_file_urls:
3116  * @settings: a #WebKitSettings
3117  *
3118  * Get the #WebKitSettings:allow-file-access-from-file-urls property.
3119  *
3120  * Returns: %TRUE If file access from file URLs is allowed or %FALSE otherwise.
3121  *
3122  * Since: 2.10
3123  */
3124 gboolean webkit_settings_get_allow_file_access_from_file_urls(WebKitSettings* settings)
3125 {
3126     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
3127
3128     return settings->priv->preferences->allowFileAccessFromFileURLs();
3129 }
3130
3131 /**
3132  * webkit_settings_set_allow_file_access_from_file_urls:
3133  * @settings: a #WebKitSettings
3134  * @allowed: Value to be set
3135  *
3136  * Set the #WebKitSettings:allow-file-access-from-file-urls property.
3137  *
3138  * Since: 2.10
3139  */
3140 void webkit_settings_set_allow_file_access_from_file_urls(WebKitSettings* settings, gboolean allowed)
3141 {
3142     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
3143
3144     WebKitSettingsPrivate* priv = settings->priv;
3145     if (priv->preferences->allowFileAccessFromFileURLs() == allowed)
3146         return;
3147
3148     priv->preferences->setAllowFileAccessFromFileURLs(allowed);
3149     g_object_notify(G_OBJECT(settings), "allow-file-access-from-file-urls");
3150 }
3151
3152 /**
3153  * webkit_settings_get_allow_universal_access_from_file_urls:
3154  * @settings: a #WebKitSettings
3155  *
3156  * Get the #WebKitSettings:allow-universal-access-from-file-urls property.
3157  *
3158  * Returns: %TRUE If universal access from file URLs is allowed or %FALSE otherwise.
3159  *
3160  * Since: 2.14
3161  */
3162 gboolean webkit_settings_get_allow_universal_access_from_file_urls(WebKitSettings* settings)
3163 {
3164     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
3165
3166     return settings->priv->preferences->allowUniversalAccessFromFileURLs();
3167 }
3168
3169 /**
3170  * webkit_settings_set_allow_universal_access_from_file_urls:
3171  * @settings: a #WebKitSettings
3172  * @allowed: Value to be set
3173  *
3174  * Set the #WebKitSettings:allow-universal-access-from-file-urls property.
3175  *
3176  * Since: 2.14
3177  */
3178 void webkit_settings_set_allow_universal_access_from_file_urls(WebKitSettings* settings, gboolean allowed)
3179 {
3180     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
3181
3182     WebKitSettingsPrivate* priv = settings->priv;
3183     if (priv->preferences->allowUniversalAccessFromFileURLs() == allowed)
3184         return;
3185
3186     priv->preferences->setAllowUniversalAccessFromFileURLs(allowed);
3187     g_object_notify(G_OBJECT(settings), "allow-universal-access-from-file-urls");
3188 }
3189
3190 #if PLATFORM(GTK)
3191 /**
3192  * webkit_settings_get_hardware_acceleration_policy:
3193  * @settings: a #WebKitSettings
3194  *
3195  * Get the #WebKitSettings:hardware-acceleration-policy property.
3196  *
3197  * Return: a #WebKitHardwareAccelerationPolicy
3198  *
3199  * Since: 2.16
3200  */
3201 WebKitHardwareAccelerationPolicy webkit_settings_get_hardware_acceleration_policy(WebKitSettings* settings)
3202 {
3203     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), WEBKIT_HARDWARE_ACCELERATION_POLICY_ON_DEMAND);
3204
3205     WebKitSettingsPrivate* priv = settings->priv;
3206     if (!priv->preferences->acceleratedCompositingEnabled())
3207         return WEBKIT_HARDWARE_ACCELERATION_POLICY_NEVER;
3208
3209     if (priv->preferences->forceCompositingMode())
3210         return WEBKIT_HARDWARE_ACCELERATION_POLICY_ALWAYS;
3211
3212     return WEBKIT_HARDWARE_ACCELERATION_POLICY_ON_DEMAND;
3213 }
3214
3215 /**
3216  * webkit_settings_set_hardware_acceleration_policy:
3217  * @settings: a #WebKitSettings
3218  * @policy: a #WebKitHardwareAccelerationPolicy
3219  *
3220  * Set the #WebKitSettings:hardware-acceleration-policy property.
3221  *
3222  * Since: 2.16
3223  */
3224 void webkit_settings_set_hardware_acceleration_policy(WebKitSettings* settings, WebKitHardwareAccelerationPolicy policy)
3225 {
3226     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
3227
3228     WebKitSettingsPrivate* priv = settings->priv;
3229     bool changed = false;
3230     switch (policy) {
3231     case WEBKIT_HARDWARE_ACCELERATION_POLICY_ALWAYS:
3232         if (!HardwareAccelerationManager::singleton().canUseHardwareAcceleration())
3233             return;
3234         if (!priv->preferences->acceleratedCompositingEnabled()) {
3235             priv->preferences->setAcceleratedCompositingEnabled(true);
3236             changed = true;
3237         }
3238         if (!priv->preferences->forceCompositingMode()) {
3239             priv->preferences->setForceCompositingMode(true);
3240             changed = true;
3241         }
3242         break;
3243     case WEBKIT_HARDWARE_ACCELERATION_POLICY_NEVER:
3244         if (HardwareAccelerationManager::singleton().forceHardwareAcceleration())
3245             return;
3246         if (priv->preferences->acceleratedCompositingEnabled()) {
3247             priv->preferences->setAcceleratedCompositingEnabled(false);
3248             changed = true;
3249         }
3250
3251         if (priv->preferences->forceCompositingMode()) {
3252             priv->preferences->setForceCompositingMode(false);
3253             changed = true;
3254         }
3255         break;
3256     case WEBKIT_HARDWARE_ACCELERATION_POLICY_ON_DEMAND:
3257         if (!priv->preferences->acceleratedCompositingEnabled() && HardwareAccelerationManager::singleton().canUseHardwareAcceleration()) {
3258             priv->preferences->setAcceleratedCompositingEnabled(true);
3259             changed = true;
3260         }
3261
3262         if (priv->preferences->forceCompositingMode() && !HardwareAccelerationManager::singleton().forceHardwareAcceleration()) {
3263             priv->preferences->setForceCompositingMode(false);
3264             changed = true;
3265         }
3266         break;
3267     }
3268
3269     if (changed)
3270         g_object_notify(G_OBJECT(settings), "hardware-acceleration-policy");
3271 }
3272 #endif // PLATFORM(GTK)