Skip to content

Commit

Permalink
2008-03-17 Rodney Dawes <dobey@wayofthemonkey.com>
Browse files Browse the repository at this point in the history
        Reviewed by Adam Roben.

        Implement PluginDatabase for GTK+ with PluginDatabaseGtk.cpp.
        Remove implemented methods from TemporaryLinkStubs.

        * GNUmakefile.am:
        * plugins/gtk:
        * plugins/gtk/PluginDatabaseGtk.cpp:
        * platform/gtk/TemporaryLinkStubs.cpp:


Canonical link: https://commits.webkit.org/24777@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@31094 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
aroben committed Mar 17, 2008
1 parent 13ec322 commit 7ca41f5
Show file tree
Hide file tree
Showing 4 changed files with 119 additions and 4 deletions.
12 changes: 12 additions & 0 deletions WebCore/ChangeLog
@@ -1,3 +1,15 @@
2008-03-17 Rodney Dawes <dobey@wayofthemonkey.com>

Reviewed by Adam Roben.

Implement PluginDatabase for GTK+ with PluginDatabaseGtk.cpp.
Remove implemented methods from TemporaryLinkStubs.

* GNUmakefile.am:
* plugins/gtk:
* plugins/gtk/PluginDatabaseGtk.cpp:
* platform/gtk/TemporaryLinkStubs.cpp:

2008-03-17 Simon Hausmann <hausmann@webkit.org>

Fix the Qt build.
Expand Down
1 change: 1 addition & 0 deletions WebCore/GNUmakefile.am
Expand Up @@ -892,6 +892,7 @@ webcore_sources += \
WebCore/plugins/PluginInfoStore.cpp \
WebCore/plugins/PluginPackage.cpp \
WebCore/plugins/PluginStream.cpp \
WebCore/plugins/gtk/PluginDatabaseGtk.cpp \
WebCore/rendering/AutoTableLayout.cpp \
WebCore/rendering/bidi.cpp \
WebCore/rendering/break_lines.cpp \
Expand Down
4 changes: 0 additions & 4 deletions WebCore/platform/gtk/TemporaryLinkStubs.cpp
Expand Up @@ -33,7 +33,6 @@
#include "FTPDirectoryDocument.h"
#include "KURL.h"
#include "NotImplemented.h"
#include "PluginDatabase.h"
#include "PluginPackage.h"
#include "PluginData.h"
#include "SharedBuffer.h"
Expand All @@ -58,9 +57,6 @@ Vector<char> loadResourceIntoArray(const char* resourceName)
/* Completely empty stubs (mostly to allow DRT to run): */
/********************************************************/

PluginSet PluginDatabase::getPluginsInPaths() const { notImplemented(); return PluginSet(); }
Vector<String> PluginDatabase::defaultPluginPaths() { notImplemented(); return Vector<String>(); }
bool PluginDatabase::isPreferredPluginPath(const String&) { notImplemented(); return false; }
int PluginPackage::compare(const PluginPackage&) const { notImplemented(); return 0; }
bool PluginPackage::fetchInfo() { notImplemented(); return false; }
unsigned PluginPackage::hash() const { notImplemented(); return 0; }
Expand Down
106 changes: 106 additions & 0 deletions WebCore/plugins/gtk/PluginDatabaseGtk.cpp
@@ -0,0 +1,106 @@
/*
* Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
* Copyright (C) 2008 Collabora, Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#include "config.h"
#include "PluginDatabase.h"

#include "CString.h"
#include "PluginPackage.h"

namespace WebCore {

PluginSet PluginDatabase::getPluginsInPaths() const
{
// FIXME: This should be a case insensitive set.
HashSet<String> uniqueFilenames;
PluginSet plugins;

Vector<String>::const_iterator end = m_pluginPaths.end();
for (Vector<String>::const_iterator it = m_pluginPaths.begin(); it != end; ++it) {
GDir* dir = g_dir_open((it->utf8()).data(), 0, 0);
if (!dir)
continue;

while ((const char* name = g_dir_read_name(dir))) {
if (!g_str_has_suffix(name, "." G_MODULE_SUFFIX))
continue;

gchar* filename = g_build_filename((it->utf8()).data(), name, 0);
PluginPackage* pluginPackage = PluginPackage::createPackage(filename, time(0));
if (pluginPackage)
plugins.add(pluginPackage);
g_free(filename);
}
g_dir_close(dir);
}

return plugins;
}

Vector<String> PluginDatabase::defaultPluginPaths()
{
Vector<String> paths;
gchar* path;

#if defined(GDK_WINDOWING_X11)
path = g_build_filename(g_get_home_dir(), ".mozilla", "plugins", 0);
paths.append(path);
g_free(path);

const gchar* mozPath = g_getenv("MOZ_PLUGIN_PATH");
if (mozPath) {
gchar** pluginPaths = g_strsplit(mozPath, ":", -1);

for (gint i = 0; pluginPaths[i]; i++)
paths.append(pluginPaths[i]);

g_strfreev(pluginPaths);
}

path = g_build_filename(G_DIR_SEPARATOR_S "usr", "lib", "browser", "plugins", 0);
paths.append(path);
g_free(path);
path = g_build_filename(G_DIR_SEPARATOR_S "usr", "local", "lib", "mozilla", "plugins", 0);
paths.append(path);
g_free (path);
path = g_build_filename(G_DIR_SEPARATOR_S "usr", "lib", "mozilla", "plugins", 0);
paths.append(path);
g_free (path);
#elif defined(GDK_WINDOWING_WIN32)
path = g_build_filename(g_get_home_dir(), "Application Data", "Mozilla", "plugins", 0);
paths.append(path);
g_free(path);
#endif

return paths;
}

bool PluginDatabase::isPreferredPluginPath(const String& path)
{
return false;
}

}

0 comments on commit 7ca41f5

Please sign in to comment.