Commit af7fa36d authored by kov@webkit.org's avatar kov@webkit.org

2011-04-06 Gustavo Noronha Silva <gns@gnome.org>

        Reviewed by Martin Robinson.

        [GTK] Need a way to get the path to a WebKitWebPlugin
        https://bugs.webkit.org/show_bug.cgi?id=57968

        Expose the path of the plugin through the WebKitWebPlugin object.

        * webkit/webkitwebplugin.cpp:
        (webkit_web_plugin_get_path):
        * webkit/webkitwebplugin.h:
        * webkit/webkitwebpluginprivate.h:

git-svn-id: svn://svn.chromium.org/blink/trunk@83185 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 4831023b
2011-04-06 Gustavo Noronha Silva <gns@gnome.org>
Reviewed by Martin Robinson.
[GTK] Need a way to get the path to a WebKitWebPlugin
https://bugs.webkit.org/show_bug.cgi?id=57968
Expose the path of the plugin through the WebKitWebPlugin object.
* webkit/webkitwebplugin.cpp:
(webkit_web_plugin_get_path):
* webkit/webkitwebplugin.h:
* webkit/webkitwebpluginprivate.h:
2011-04-07 Alice Boxhall <aboxhall@chromium.org>
Reviewed by Ryosuke Niwa.
......
/*
* Copyright (C) 2010 Igalia S.L.
* Copyright (C) 2011 Gustavo Noronha Silva <gns@gnome.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -62,6 +63,8 @@ static void webkit_web_plugin_finalize(GObject* object)
WebKitWebPlugin* plugin = WEBKIT_WEB_PLUGIN(object);
WebKitWebPluginPrivate* priv = plugin->priv;
g_free(priv->path);
g_slist_foreach(priv->mimeTypes, (GFunc)freeMIMEType, 0);
g_slist_free(priv->mimeTypes);
......@@ -172,6 +175,43 @@ const char* webkit_web_plugin_get_description(WebKitWebPlugin* plugin)
return priv->description.data();
}
/**
* webkit_web_plugin_get_path:
* @plugin: a #WebKitWebPlugin
*
* Returns: the absolute path to @plugin in system filename encoding
* or %NULL on failure to convert the filename from UTF-8.
*
* Since: 1.4.0
*/
const char* webkit_web_plugin_get_path(WebKitWebPlugin* plugin)
{
g_return_val_if_fail(WEBKIT_IS_WEB_PLUGIN(plugin), 0);
WebKitWebPluginPrivate* priv = plugin->priv;
if (priv->path)
return priv->path;
GError* error = 0;
priv->path = g_filename_from_utf8(priv->corePlugin->path().utf8().data(), -1, 0, 0, &error);
if (!error)
return priv->path;
// In the unlikely case the convertion fails, report the error and make sure we free
// any partial convertion that ended up in the variable.
g_free(priv->path);
priv->path = 0;
g_warning("Failed to convert '%s' to system filename encoding: %s", priv->corePlugin->path().utf8().data(), error->message);
g_clear_error(&error);
return 0;
}
/**
* webkit_web_plugin_get_mimetypes:
* @plugin: a #WebKitWebPlugin
......
......@@ -73,6 +73,9 @@ webkit_web_plugin_get_name (WebKitWebPlugin*);
WEBKIT_API const char*
webkit_web_plugin_get_description (WebKitWebPlugin*);
WEBKIT_API const char*
webkit_web_plugin_get_path (WebKitWebPlugin*);
WEBKIT_API GSList*
webkit_web_plugin_get_mimetypes (WebKitWebPlugin*);
......
......@@ -38,6 +38,7 @@ struct _WebKitWebPluginPrivate {
RefPtr<WebCore::PluginPackage> corePlugin;
CString name;
CString description;
char* path;
GSList* mimeTypes;
};
......
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