Commit 4ca05c06 authored by philn@webkit.org's avatar philn@webkit.org

[GTK][WK2] enable-webaudio WebSetting

https://bugs.webkit.org/show_bug.cgi?id=77959

Reviewed by Martin Robinson.

Add a new WebKitGTK WebSetting to enable/disable WebAudio at
runtime.

* UIProcess/API/gtk/WebKitSettings.cpp:
(webKitSettingsSetProperty):
(webKitSettingsGetProperty):
(webkit_settings_class_init):
(webkit_settings_get_enable_webaudio):
(webkit_settings_set_enable_webaudio):
* UIProcess/API/gtk/WebKitSettings.h:
* UIProcess/API/gtk/tests/TestWebKitSettings.cpp:
(testWebKitSettings):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@107044 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 46922981
2012-02-08 Philippe Normand <pnormand@igalia.com>
[GTK][WK2] enable-webaudio WebSetting
https://bugs.webkit.org/show_bug.cgi?id=77959
Reviewed by Martin Robinson.
Add a new WebKitGTK WebSetting to enable/disable WebAudio at
runtime.
* UIProcess/API/gtk/WebKitSettings.cpp:
(webKitSettingsSetProperty):
(webKitSettingsGetProperty):
(webkit_settings_class_init):
(webkit_settings_get_enable_webaudio):
(webkit_settings_set_enable_webaudio):
* UIProcess/API/gtk/WebKitSettings.h:
* UIProcess/API/gtk/tests/TestWebKitSettings.cpp:
(testWebKitSettings):
2012-02-07 Martin Robinson <mrobinson@igalia.com>
[GTK] [WK2] Add WebKitResponsePolicyDecision
......@@ -101,7 +101,8 @@ enum {
PROP_ENABLE_DNS_PREFETCHING,
PROP_ENABLE_CARET_BROWSING,
PROP_ENABLE_FULLSCREEN,
PROP_PRINT_BACKGROUNDS
PROP_PRINT_BACKGROUNDS,
PROP_ENABLE_WEBAUDIO
};
static void webKitSettingsSetProperty(GObject* object, guint propId, const GValue* value, GParamSpec* paramSpec)
......@@ -202,6 +203,9 @@ static void webKitSettingsSetProperty(GObject* object, guint propId, const GValu
case PROP_PRINT_BACKGROUNDS:
webkit_settings_set_print_backgrounds(settings, g_value_get_boolean(value));
break;
case PROP_ENABLE_WEBAUDIO:
webkit_settings_set_enable_webaudio(settings, g_value_get_boolean(value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, paramSpec);
break;
......@@ -306,6 +310,9 @@ static void webKitSettingsGetProperty(GObject* object, guint propId, GValue* val
case PROP_PRINT_BACKGROUNDS:
g_value_set_boolean(value, webkit_settings_get_print_backgrounds(settings));
break;
case PROP_ENABLE_WEBAUDIO:
g_value_set_boolean(value, webkit_settings_get_enable_webaudio(settings));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, paramSpec);
break;
......@@ -768,6 +775,25 @@ static void webkit_settings_class_init(WebKitSettingsClass* klass)
TRUE,
readWriteConstructParamFlags));
/**
* WebKitSettings:enable-webaudio:
*
*
* Enable or disable support for WebAudio on pages. WebAudio is an
* experimental proposal for allowing web pages to generate Audio
* WAVE data from JavaScript. The standard is currently a
* work-in-progress by the W3C Audio Working Group.
*
* See also https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html
*/
g_object_class_install_property(gObjectClass,
PROP_ENABLE_WEBAUDIO,
g_param_spec_boolean("enable-webaudio",
_("Enable WebAudio"),
_("Whether WebAudio content should be handled"),
FALSE,
readWriteConstructParamFlags));
g_type_class_add_private(klass, sizeof(WebKitSettingsPrivate));
}
......@@ -1955,3 +1981,38 @@ void webkit_settings_set_print_backgrounds(WebKitSettings* settings, gboolean pr
WKPreferencesSetShouldPrintBackgrounds(priv->preferences.get(), printBackgrounds);
g_object_notify(G_OBJECT(settings), "print-backgrounds");
}
/**
* webkit_settings_get_enable_webaudio:
* @settings: a #WebKitSettings
*
* Get the #WebKitSettings:enable-webaudio property.
*
* Returns: %TRUE If webaudio support is enabled or %FALSE otherwise.
*/
gboolean webkit_settings_get_enable_webaudio(WebKitSettings* settings)
{
g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
return WKPreferencesGetWebAudioEnabled(settings->priv->preferences.get());
}
/**
* webkit_settings_set_enable_webaudio:
* @settings: a #WebKitSettings
* @enabled: Value to be set
*
* Set the #WebKitSettings:enable-webaudio property.
*/
void webkit_settings_set_enable_webaudio(WebKitSettings* settings, gboolean enabled)
{
g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
WebKitSettingsPrivate* priv = settings->priv;
bool currentValue = WKPreferencesGetWebAudioEnabled(priv->preferences.get());
if (currentValue == enabled)
return;
WKPreferencesSetWebAudioEnabled(priv->preferences.get(), enabled);
g_object_notify(G_OBJECT(settings), "enable-webaudio");
}
......@@ -293,6 +293,13 @@ WEBKIT_API void
webkit_settings_set_print_backgrounds (WebKitSettings *settings,
gboolean print_backgrounds);
WEBKIT_API gboolean
webkit_settings_get_enable_webaudio (WebKitSettings *settings);
WEBKIT_API void
webkit_settings_set_enable_webaudio (WebKitSettings *settings,
gboolean enabled);
G_END_DECLS
#endif /* WebKitSettings_h */
......@@ -216,6 +216,8 @@ webkit_settings_get_enable_fullscreen
webkit_settings_set_enable_fullscreen
webkit_settings_get_print_backgrounds
webkit_settings_set_print_backgrounds
webkit_settings_get_enable_webaudio
webkit_settings_set_enable_webaudio
<SUBSECTION Standard>
WebKitSettingsClass
......
......@@ -189,6 +189,11 @@ static void testWebKitSettings(Test*, gconstpointer)
webkit_settings_set_print_backgrounds(settings, FALSE);
g_assert(!webkit_settings_get_print_backgrounds(settings));
// WebAudio is disabled by default.
g_assert(!webkit_settings_get_enable_webaudio(settings));
webkit_settings_set_enable_webaudio(settings, TRUE);
g_assert(webkit_settings_get_enable_webaudio(settings));
g_object_unref(G_OBJECT(settings));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment