Skip to content

Commit a0688f5

Browse files
magomezspenap
authored andcommitted
Add setting to enable/disable directory upload
1 parent eb9188e commit a0688f5

2 files changed

Lines changed: 65 additions & 1 deletion

File tree

Source/WebKit/UIProcess/API/glib/WebKitSettings.cpp

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ enum {
190190
PROP_DISABLE_WEB_SECURITY,
191191
PROP_WEBRTC_UDP_PORTS_RANGE,
192192
PROP_ALLOW_SCRIPTS_TO_CLOSE_WINDOWS,
193+
PROP_ENABLE_DIRECTORY_UPLOAD,
193194
N_PROPERTIES,
194195
};
195196

@@ -422,6 +423,10 @@ ALLOW_DEPRECATED_DECLARATIONS_BEGIN
422423
break;
423424
case PROP_ALLOW_SCRIPTS_TO_CLOSE_WINDOWS:
424425
webkit_settings_set_allow_scripts_to_close_windows(settings, g_value_get_boolean(value));
426+
break;
427+
case PROP_ENABLE_DIRECTORY_UPLOAD:
428+
webkit_settings_set_enable_directory_upload(settings, g_value_get_boolean(value));
429+
break;
425430
default:
426431
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, paramSpec);
427432
break;
@@ -638,6 +643,10 @@ ALLOW_DEPRECATED_DECLARATIONS_BEGIN
638643
break;
639644
case PROP_ALLOW_SCRIPTS_TO_CLOSE_WINDOWS:
640645
g_value_set_boolean(value, webkit_settings_get_allow_scripts_to_close_windows(settings));
646+
break;
647+
case PROP_ENABLE_DIRECTORY_UPLOAD:
648+
g_value_set_boolean(value, webkit_settings_get_enable_directory_upload(settings));
649+
break;
641650
default:
642651
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, paramSpec);
643652
break;
@@ -1733,6 +1742,19 @@ static void webkit_settings_class_init(WebKitSettingsClass* klass)
17331742
FALSE,
17341743
readWriteConstructParamFlags);
17351744

1745+
/**
1746+
* WebKitSettings:enable-directory-upload:
1747+
*
1748+
* Enable or disable directory upload.
1749+
*
1750+
*/
1751+
sObjProperties[PROP_ENABLE_DIRECTORY_UPLOAD] = g_param_spec_boolean(
1752+
"enable-directory-upload",
1753+
_("Enable directory upload"),
1754+
_("Whether directory upload should be enabled."),
1755+
TRUE,
1756+
readWriteConstructParamFlags);
1757+
17361758
g_object_class_install_properties(gObjectClass, N_PROPERTIES, sObjProperties.data());
17371759
}
17381760

@@ -4491,4 +4513,39 @@ webkit_settings_set_allow_scripts_to_close_windows(WebKitSettings *settings, gbo
44914513

44924514
priv->preferences->setAllowScriptsToCloseWindows(allowed);
44934515
g_object_notify(G_OBJECT(settings), "allow-scripts-to-close-windows");
4494-
}
4516+
}
4517+
4518+
/**
4519+
* webkit_settings_get_enable_directory_upload:
4520+
* @settings: a #WebKitSettings
4521+
*
4522+
* Get the #WebKitSettings:enable-directory-upload property.
4523+
*
4524+
* Returns: %TRUE If Directory Upload is enabled or %FALSE otherwise.
4525+
*/
4526+
gboolean webkit_settings_get_enable_directory_upload(WebKitSettings* settings)
4527+
{
4528+
g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
4529+
4530+
return settings->priv->preferences->directoryUploadEnabled();
4531+
}
4532+
4533+
/**
4534+
* webkit_settings_set_enable_directory_upload:
4535+
* @settings: a #WebKitSettings
4536+
* @enabled: Value to be set
4537+
*
4538+
* Set the #WebKitSettings:enable-directory-upload property.
4539+
*/
4540+
void webkit_settings_set_enable_directory_upload(WebKitSettings* settings, gboolean enabled)
4541+
{
4542+
g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
4543+
4544+
WebKitSettingsPrivate* priv = settings->priv;
4545+
bool currentValue = priv->preferences->directoryUploadEnabled();
4546+
if (currentValue == enabled)
4547+
return;
4548+
4549+
priv->preferences->setDirectoryUploadEnabled(enabled);
4550+
g_object_notify(G_OBJECT(settings), "enable-directory-upload");
4551+
}

Source/WebKit/UIProcess/API/glib/WebKitSettings.h.in

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,13 @@ WEBKIT_API void
589589
webkit_settings_set_allow_scripts_to_close_windows (WebKitSettings *settings,
590590
gboolean allowed);
591591

592+
WEBKIT_API gboolean
593+
webkit_settings_get_enable_directory_upload (WebKitSettings *settings);
594+
595+
WEBKIT_API void
596+
webkit_settings_set_enable_directory_upload (WebKitSettings *settings,
597+
gboolean enabled);
598+
592599
G_END_DECLS
593600

594601
#endif /* WebKitSettings_h */

0 commit comments

Comments
 (0)