summaryrefslogtreecommitdiffstats
path: root/WebCore/plugins
diff options
context:
space:
mode:
authorLeon Clarke <leonclarke@google.com>2010-06-03 14:33:32 +0100
committerLeon Clarke <leonclarke@google.com>2010-06-08 12:24:51 +0100
commit5af96e2c7b73ebc627c6894727826a7576d31758 (patch)
treef9d5e6f6175ccd7e3d14de9b290f08937a0d17ba /WebCore/plugins
parent8cc4fcf4f6adcbc0e0aebfc24fbad9a4cddf2cfb (diff)
downloadexternal_webkit-5af96e2c7b73ebc627c6894727826a7576d31758.zip
external_webkit-5af96e2c7b73ebc627c6894727826a7576d31758.tar.gz
external_webkit-5af96e2c7b73ebc627c6894727826a7576d31758.tar.bz2
Merge webkit.org at r60469 : Initial merge by git.
Change-Id: I66a0047aa2af802f66bb0c7f2a8b02247a596234
Diffstat (limited to 'WebCore/plugins')
-rw-r--r--WebCore/plugins/MimeType.cpp14
-rw-r--r--WebCore/plugins/MimeType.h2
-rw-r--r--WebCore/plugins/MimeTypeArray.cpp10
-rw-r--r--WebCore/plugins/Plugin.cpp26
-rw-r--r--WebCore/plugins/Plugin.h2
-rw-r--r--WebCore/plugins/PluginArray.cpp26
-rw-r--r--WebCore/plugins/PluginArray.h2
-rw-r--r--WebCore/plugins/PluginData.cpp24
-rw-r--r--WebCore/plugins/PluginData.h88
-rw-r--r--WebCore/plugins/PluginDatabase.cpp10
-rw-r--r--WebCore/plugins/PluginDatabase.h6
-rw-r--r--WebCore/plugins/PluginDatabaseClient.h42
-rw-r--r--WebCore/plugins/PluginInfoStore.cpp100
-rw-r--r--WebCore/plugins/PluginInfoStore.h48
-rw-r--r--WebCore/plugins/PluginPackageNone.cpp2
-rw-r--r--WebCore/plugins/chromium/PluginDataChromium.cpp38
-rw-r--r--WebCore/plugins/gtk/PluginDataGtk.cpp25
-rw-r--r--WebCore/plugins/gtk/gtk2xtbin.c16
-rw-r--r--WebCore/plugins/mac/PluginDataMac.mm22
-rw-r--r--WebCore/plugins/npapi.cpp4
-rw-r--r--WebCore/plugins/qt/PluginDataQt.cpp42
-rw-r--r--WebCore/plugins/win/PluginDataWin.cpp25
-rw-r--r--WebCore/plugins/wx/PluginDataWx.cpp25
23 files changed, 192 insertions, 407 deletions
diff --git a/WebCore/plugins/MimeType.cpp b/WebCore/plugins/MimeType.cpp
index 954715a..247e7a4 100644
--- a/WebCore/plugins/MimeType.cpp
+++ b/WebCore/plugins/MimeType.cpp
@@ -40,17 +40,17 @@ MimeType::~MimeType()
const String &MimeType::type() const
{
- return m_pluginData->mimes()[m_index]->type;
+ return mimeClassInfo().type;
}
const String &MimeType::suffixes() const
{
- return m_pluginData->mimes()[m_index]->suffixes;
+ return mimeClassInfo().suffixes;
}
const String &MimeType::description() const
{
- return m_pluginData->mimes()[m_index]->desc;
+ return mimeClassInfo().desc;
}
PassRefPtr<Plugin> MimeType::enabledPlugin() const
@@ -59,13 +59,7 @@ PassRefPtr<Plugin> MimeType::enabledPlugin() const
if (!p || !p->mainFrame()->loader()->allowPlugins(NotAboutToInstantiatePlugin))
return 0;
- const PluginInfo *info = m_pluginData->mimes()[m_index]->plugin;
- const Vector<PluginInfo*>& plugins = m_pluginData->plugins();
- for (size_t i = 0; i < plugins.size(); ++i) {
- if (plugins[i] == info)
- return Plugin::create(m_pluginData.get(), i);
- }
- return 0;
+ return Plugin::create(m_pluginData.get(), mimeClassInfo().pluginIndex);
}
} // namespace WebCore
diff --git a/WebCore/plugins/MimeType.h b/WebCore/plugins/MimeType.h
index 5207918..33a7fa0 100644
--- a/WebCore/plugins/MimeType.h
+++ b/WebCore/plugins/MimeType.h
@@ -42,6 +42,8 @@ namespace WebCore {
PassRefPtr<Plugin> enabledPlugin() const;
private:
+ const MimeClassInfo& mimeClassInfo() const { return m_pluginData->mimes()[m_index]; }
+
MimeType(PassRefPtr<PluginData>, unsigned index);
RefPtr<PluginData> m_pluginData;
unsigned m_index;
diff --git a/WebCore/plugins/MimeTypeArray.cpp b/WebCore/plugins/MimeTypeArray.cpp
index 7fabad7..9d3ad92 100644
--- a/WebCore/plugins/MimeTypeArray.cpp
+++ b/WebCore/plugins/MimeTypeArray.cpp
@@ -50,7 +50,7 @@ PassRefPtr<MimeType> MimeTypeArray::item(unsigned index)
PluginData* data = getPluginData();
if (!data)
return 0;
- const Vector<MimeClassInfo*>& mimes = data->mimes();
+ const Vector<MimeClassInfo>& mimes = data->mimes();
if (index >= mimes.size())
return 0;
return MimeType::create(data, index).get();
@@ -61,9 +61,9 @@ bool MimeTypeArray::canGetItemsForName(const AtomicString& propertyName)
PluginData *data = getPluginData();
if (!data)
return 0;
- const Vector<MimeClassInfo*>& mimes = data->mimes();
+ const Vector<MimeClassInfo>& mimes = data->mimes();
for (unsigned i = 0; i < mimes.size(); ++i) {
- if (mimes[i]->type == propertyName)
+ if (mimes[i].type == propertyName)
return true;
}
return false;
@@ -74,9 +74,9 @@ PassRefPtr<MimeType> MimeTypeArray::namedItem(const AtomicString& propertyName)
PluginData *data = getPluginData();
if (!data)
return 0;
- const Vector<MimeClassInfo*>& mimes = data->mimes();
+ const Vector<MimeClassInfo>& mimes = data->mimes();
for (unsigned i = 0; i < mimes.size(); ++i) {
- if (mimes[i]->type == propertyName)
+ if (mimes[i].type == propertyName)
return MimeType::create(data, i).get();
}
return 0;
diff --git a/WebCore/plugins/Plugin.cpp b/WebCore/plugins/Plugin.cpp
index e8c98b3..765478d 100644
--- a/WebCore/plugins/Plugin.cpp
+++ b/WebCore/plugins/Plugin.cpp
@@ -37,53 +37,53 @@ Plugin::~Plugin()
String Plugin::name() const
{
- return m_pluginData->plugins()[m_index]->name;
+ return pluginInfo().name;
}
String Plugin::filename() const
{
- return m_pluginData->plugins()[m_index]->file;
+ return pluginInfo().file;
}
String Plugin::description() const
{
- return m_pluginData->plugins()[m_index]->desc;
+ return pluginInfo().desc;
}
unsigned Plugin::length() const
{
- return m_pluginData->plugins()[m_index]->mimes.size();
+ return pluginInfo().mimes.size();
}
PassRefPtr<MimeType> Plugin::item(unsigned index)
{
- const Vector<PluginInfo*>& plugins = m_pluginData->plugins();
- if (index >= plugins[m_index]->mimes.size())
+ if (index >= pluginInfo().mimes.size())
return 0;
- MimeClassInfo* mime = plugins[m_index]->mimes[index];
+ const MimeClassInfo& mime = pluginInfo().mimes[index];
- const Vector<MimeClassInfo*>& mimes = m_pluginData->mimes();
- for (unsigned i = 0; i < mimes.size(); ++i)
+ const Vector<MimeClassInfo>& mimes = m_pluginData->mimes();
+ for (unsigned i = 0; i < mimes.size(); ++i) {
if (mimes[i] == mime)
return MimeType::create(m_pluginData.get(), i).get();
+ }
return 0;
}
bool Plugin::canGetItemsForName(const AtomicString& propertyName)
{
- const Vector<MimeClassInfo*>& mimes = m_pluginData->mimes();
+ const Vector<MimeClassInfo>& mimes = m_pluginData->mimes();
for (unsigned i = 0; i < mimes.size(); ++i)
- if (mimes[i]->type == propertyName)
+ if (mimes[i].type == propertyName)
return true;
return false;
}
PassRefPtr<MimeType> Plugin::namedItem(const AtomicString& propertyName)
{
- const Vector<MimeClassInfo*>& mimes = m_pluginData->mimes();
+ const Vector<MimeClassInfo>& mimes = m_pluginData->mimes();
for (unsigned i = 0; i < mimes.size(); ++i)
- if (mimes[i]->type == propertyName)
+ if (mimes[i].type == propertyName)
return MimeType::create(m_pluginData.get(), i).get();
return 0;
}
diff --git a/WebCore/plugins/Plugin.h b/WebCore/plugins/Plugin.h
index 9a5697d..668a9da 100644
--- a/WebCore/plugins/Plugin.h
+++ b/WebCore/plugins/Plugin.h
@@ -47,6 +47,8 @@ namespace WebCore {
PassRefPtr<MimeType> namedItem(const AtomicString& propertyName);
private:
+ const PluginInfo& pluginInfo() const { return m_pluginData->plugins()[m_index]; }
+
Plugin(PluginData*, unsigned index);
RefPtr<PluginData> m_pluginData;
unsigned m_index;
diff --git a/WebCore/plugins/PluginArray.cpp b/WebCore/plugins/PluginArray.cpp
index b37d3c0..038e4ad 100644
--- a/WebCore/plugins/PluginArray.cpp
+++ b/WebCore/plugins/PluginArray.cpp
@@ -39,7 +39,7 @@ PluginArray::~PluginArray()
unsigned PluginArray::length() const
{
- PluginData* data = getPluginData();
+ PluginData* data = pluginData();
if (!data)
return 0;
return data->plugins().size();
@@ -47,10 +47,10 @@ unsigned PluginArray::length() const
PassRefPtr<Plugin> PluginArray::item(unsigned index)
{
- PluginData* data = getPluginData();
+ PluginData* data = pluginData();
if (!data)
return 0;
- const Vector<PluginInfo*>& plugins = data->plugins();
+ const Vector<PluginInfo>& plugins = data->plugins();
if (index >= plugins.size())
return 0;
return Plugin::create(data, index).get();
@@ -58,12 +58,12 @@ PassRefPtr<Plugin> PluginArray::item(unsigned index)
bool PluginArray::canGetItemsForName(const AtomicString& propertyName)
{
- PluginData* data = getPluginData();
+ PluginData* data = pluginData();
if (!data)
return 0;
- const Vector<PluginInfo*>& plugins = data->plugins();
+ const Vector<PluginInfo>& plugins = data->plugins();
for (unsigned i = 0; i < plugins.size(); ++i) {
- if (plugins[i]->name == propertyName)
+ if (plugins[i].name == propertyName)
return true;
}
return false;
@@ -71,12 +71,12 @@ bool PluginArray::canGetItemsForName(const AtomicString& propertyName)
PassRefPtr<Plugin> PluginArray::namedItem(const AtomicString& propertyName)
{
- PluginData* data = getPluginData();
+ PluginData* data = pluginData();
if (!data)
return 0;
- const Vector<PluginInfo*>& plugins = data->plugins();
+ const Vector<PluginInfo>& plugins = data->plugins();
for (unsigned i = 0; i < plugins.size(); ++i) {
- if (plugins[i]->name == propertyName)
+ if (plugins[i].name == propertyName)
return Plugin::create(data, i).get();
}
return 0;
@@ -87,14 +87,14 @@ void PluginArray::refresh(bool reload)
Page::refreshPlugins(reload);
}
-PluginData* PluginArray::getPluginData() const
+PluginData* PluginArray::pluginData() const
{
if (!m_frame)
return 0;
- Page* p = m_frame->page();
- if (!p)
+ Page* page = m_frame->page();
+ if (!page)
return 0;
- return p->pluginData();
+ return page->pluginData();
}
} // namespace WebCore
diff --git a/WebCore/plugins/PluginArray.h b/WebCore/plugins/PluginArray.h
index 197ac88..435db50 100644
--- a/WebCore/plugins/PluginArray.h
+++ b/WebCore/plugins/PluginArray.h
@@ -48,7 +48,7 @@ namespace WebCore {
private:
PluginArray(Frame*);
- PluginData* getPluginData() const;
+ PluginData* pluginData() const;
Frame* m_frame;
};
diff --git a/WebCore/plugins/PluginData.cpp b/WebCore/plugins/PluginData.cpp
index ca4bda5..7780cff 100644
--- a/WebCore/plugins/PluginData.cpp
+++ b/WebCore/plugins/PluginData.cpp
@@ -32,31 +32,29 @@ PluginData::PluginData(const Page* page)
initPlugins();
for (unsigned i = 0; i < m_plugins.size(); ++i) {
- const PluginInfo* plugin = m_plugins[i];
- for (unsigned j = 0; j < plugin->mimes.size(); ++j)
- m_mimes.append(plugin->mimes[j]);
+ const PluginInfo& plugin = m_plugins[i];
+ for (unsigned j = 0; j < plugin.mimes.size(); ++j)
+ m_mimes.append(plugin.mimes[j]);
}
}
-PluginData::~PluginData()
-{
- deleteAllValues(m_plugins);
- deleteAllValues(m_mimes);
-}
-
bool PluginData::supportsMimeType(const String& mimeType) const
{
for (unsigned i = 0; i < m_mimes.size(); ++i)
- if (m_mimes[i]->type == mimeType)
+ if (m_mimes[i].type == mimeType)
return true;
return false;
}
String PluginData::pluginNameForMimeType(const String& mimeType) const
{
- for (unsigned i = 0; i < m_mimes.size(); ++i)
- if (m_mimes[i]->type == mimeType)
- return m_mimes[i]->plugin->name;
+ for (unsigned i = 0; i < m_mimes.size(); ++i) {
+ const MimeClassInfo& info = m_mimes[i];
+
+ if (info.type == mimeType)
+ return m_plugins[info.pluginIndex].name;
+ }
+
return String();
}
diff --git a/WebCore/plugins/PluginData.h b/WebCore/plugins/PluginData.h
index 6960a25..1055afb 100644
--- a/WebCore/plugins/PluginData.h
+++ b/WebCore/plugins/PluginData.h
@@ -26,48 +26,52 @@
namespace WebCore {
- class Page;
- struct PluginInfo;
-
- struct MimeClassInfo : Noncopyable {
- String type;
- String desc;
- String suffixes;
- PluginInfo* plugin;
- };
-
- struct PluginInfo : Noncopyable {
- String name;
- String file;
- String desc;
- Vector<MimeClassInfo*> mimes;
- };
-
- // FIXME: merge with PluginDatabase in the future
- class PluginData : public RefCounted<PluginData> {
- public:
- static PassRefPtr<PluginData> create(const Page* page) { return adoptRef(new PluginData(page)); }
- ~PluginData();
-
- void disconnectPage() { m_page = 0; }
- const Page* page() const { return m_page; }
-
- const Vector<PluginInfo*>& plugins() const { return m_plugins; }
- const Vector<MimeClassInfo*>& mimes() const { return m_mimes; }
-
- bool supportsMimeType(const String& mimeType) const;
- String pluginNameForMimeType(const String& mimeType) const;
-
- static void refresh();
-
- private:
- PluginData(const Page*);
- void initPlugins();
-
- Vector<PluginInfo*> m_plugins;
- Vector<MimeClassInfo*> m_mimes;
- const Page* m_page;
- };
+class Page;
+struct PluginInfo;
+
+struct MimeClassInfo {
+ String type;
+ String desc;
+ String suffixes;
+ unsigned pluginIndex;
+};
+
+inline bool operator==(const MimeClassInfo& a, const MimeClassInfo& b)
+{
+ return a.type == b.type && a.desc == b.desc && a.suffixes == b.suffixes && a.pluginIndex == b.pluginIndex;
+}
+
+struct PluginInfo {
+ String name;
+ String file;
+ String desc;
+ Vector<MimeClassInfo> mimes;
+};
+
+// FIXME: merge with PluginDatabase in the future
+class PluginData : public RefCounted<PluginData> {
+public:
+ static PassRefPtr<PluginData> create(const Page* page) { return adoptRef(new PluginData(page)); }
+
+ void disconnectPage() { m_page = 0; }
+ const Page* page() const { return m_page; }
+
+ const Vector<PluginInfo>& plugins() const { return m_plugins; }
+ const Vector<MimeClassInfo>& mimes() const { return m_mimes; }
+
+ bool supportsMimeType(const String& mimeType) const;
+ String pluginNameForMimeType(const String& mimeType) const;
+
+ static void refresh();
+
+private:
+ PluginData(const Page*);
+ void initPlugins();
+
+ Vector<PluginInfo> m_plugins;
+ Vector<MimeClassInfo> m_mimes;
+ const Page* m_page;
+};
}
diff --git a/WebCore/plugins/PluginDatabase.cpp b/WebCore/plugins/PluginDatabase.cpp
index a1200fc..88297ac 100644
--- a/WebCore/plugins/PluginDatabase.cpp
+++ b/WebCore/plugins/PluginDatabase.cpp
@@ -29,7 +29,6 @@
#include "Frame.h"
#include "KURL.h"
-#include "PluginDatabaseClient.h"
#include "PluginPackage.h"
#include <stdlib.h>
@@ -43,7 +42,6 @@ namespace WebCore {
typedef HashMap<String, RefPtr<PluginPackage> > PluginPackageByNameMap;
PluginDatabase::PluginDatabase()
- : m_client(0)
{
}
@@ -122,11 +120,9 @@ bool PluginDatabase::refresh()
remove(oldPackage.get());
}
- if (!m_client || m_client->shouldLoadPluginAtPath(*it)) {
- RefPtr<PluginPackage> package = PluginPackage::createPackage(*it, lastModified);
- if (package && (!m_client || m_client->shouldLoadPluginPackage(package.get())) && add(package.release()))
- pluginSetChanged = true;
- }
+ RefPtr<PluginPackage> package = PluginPackage::createPackage(*it, lastModified);
+ if (package && add(package.release()))
+ pluginSetChanged = true;
}
// Cache all the paths we found with their timestamps for next time.
diff --git a/WebCore/plugins/PluginDatabase.h b/WebCore/plugins/PluginDatabase.h
index 54530a7..ed714aa 100644
--- a/WebCore/plugins/PluginDatabase.h
+++ b/WebCore/plugins/PluginDatabase.h
@@ -81,11 +81,6 @@ namespace WebCore {
m_pluginDirectories = directories;
}
- void setClient(PluginDatabaseClient* client)
- {
- m_client = client;
- }
-
static Vector<String> defaultPluginDirectories();
Vector<String> pluginDirectories() const { return m_pluginDirectories; }
@@ -111,7 +106,6 @@ namespace WebCore {
friend class ::android::WebSettings;
#endif
HashMap<String, RefPtr<PluginPackage> > m_preferredPlugins;
- PluginDatabaseClient* m_client;
};
} // namespace WebCore
diff --git a/WebCore/plugins/PluginDatabaseClient.h b/WebCore/plugins/PluginDatabaseClient.h
deleted file mode 100644
index b19ab83..0000000
--- a/WebCore/plugins/PluginDatabaseClient.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2007 Marius Renn <damarvy@gmail.com> 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * ``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 THE COPYRIGHT
- * HOLDER 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.
- */
-#ifndef PluginDatabaseClient_h
-#define PluginDatabaseClient_h
-
-namespace WebCore {
-
- class PluginPackage;
- class String;
-
- class PluginDatabaseClient {
- public:
- virtual ~PluginDatabaseClient() { }
- virtual bool shouldLoadPluginAtPath(const String&) = 0;
- virtual bool shouldLoadPluginPackage(const PluginPackage*) = 0;
- };
-
-} // namespace WebCore
-
-#endif // PluginDatabaseClient_h
diff --git a/WebCore/plugins/PluginInfoStore.cpp b/WebCore/plugins/PluginInfoStore.cpp
deleted file mode 100644
index 88dc7ee..0000000
--- a/WebCore/plugins/PluginInfoStore.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright (C) 2006, 2007 Apple Inc. 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 "PluginInfoStore.h"
-
-#include "KURL.h"
-#include "Page.h"
-#include "PluginData.h"
-#include "PluginDatabase.h"
-#include "PluginPackage.h"
-
-namespace WebCore {
-
-PluginInfo* PluginInfoStore::createPluginInfoForPluginAtIndex(unsigned i)
-{
- PluginDatabase *db = PluginDatabase::installedPlugins();
- PluginInfo* info = new PluginInfo;
- PluginPackage* package = db->plugins()[i];
-
- info->name = package->name();
- info->file = package->fileName();
- info->desc = package->description();
-
- const MIMEToDescriptionsMap& mimeToDescriptions = package->mimeToDescriptions();
- MIMEToDescriptionsMap::const_iterator end = mimeToDescriptions.end();
- for (MIMEToDescriptionsMap::const_iterator it = mimeToDescriptions.begin(); it != end; ++it) {
- MimeClassInfo* mime = new MimeClassInfo;
- info->mimes.append(mime);
-
- mime->type = it->first;
- mime->desc = it->second;
- mime->plugin = info;
-
- Vector<String> extensions = package->mimeToExtensions().get(mime->type);
-
- for (unsigned i = 0; i < extensions.size(); i++) {
- if (i > 0)
- mime->suffixes += ",";
-
- mime->suffixes += extensions[i];
- }
- }
-
- return info;
-}
-
-unsigned PluginInfoStore::pluginCount() const
-{
- return PluginDatabase::installedPlugins()->plugins().size();
-}
-
-
-String PluginInfoStore::pluginNameForMIMEType(const String& mimeType)
-{
- String mimeTypeCopy(mimeType);
-
- if (PluginPackage* package = PluginDatabase::installedPlugins()->findPlugin(KURL(), mimeTypeCopy)) {
- ASSERT(mimeType == mimeTypeCopy);
-
- return package->name();
- }
-
- return String();
-}
-
-
-bool PluginInfoStore::supportsMIMEType(const WebCore::String& mimeType)
-{
- return PluginDatabase::installedPlugins()->isMIMETypeRegistered(mimeType);
-}
-
-void refreshPlugins(bool reloadOpenPages)
-{
- Page::refreshPlugins(reloadOpenPages);
-}
-
-}
diff --git a/WebCore/plugins/PluginInfoStore.h b/WebCore/plugins/PluginInfoStore.h
deleted file mode 100644
index 302cf8c..0000000
--- a/WebCore/plugins/PluginInfoStore.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2004, 2006 Apple Computer, Inc. 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.
- */
-
-#ifndef PluginInfoStore_h
-#define PluginInfoStore_h
-
-#include "PlatformString.h"
-#include <wtf/Vector.h>
-
-namespace WebCore {
-
-struct PluginInfo;
-
-class PluginInfoStore {
-public:
- PluginInfo *createPluginInfoForPluginAtIndex(unsigned);
- unsigned pluginCount() const;
- static String pluginNameForMIMEType(const String& mimeType);
- static bool supportsMIMEType(const String& mimeType);
-};
-
-void refreshPlugins(bool reloadOpenPages);
-
-}
-
-#endif
diff --git a/WebCore/plugins/PluginPackageNone.cpp b/WebCore/plugins/PluginPackageNone.cpp
index 3610f4a..f7e2a6b 100644
--- a/WebCore/plugins/PluginPackageNone.cpp
+++ b/WebCore/plugins/PluginPackageNone.cpp
@@ -43,7 +43,7 @@ bool PluginPackage::load()
}
#if ENABLE(NETSCAPE_PLUGIN_API)
-uint16 PluginPackage::NPVersion() const
+uint16_t PluginPackage::NPVersion() const
{
return 0;
}
diff --git a/WebCore/plugins/chromium/PluginDataChromium.cpp b/WebCore/plugins/chromium/PluginDataChromium.cpp
index 5c28643..a106bc0 100644
--- a/WebCore/plugins/chromium/PluginDataChromium.cpp
+++ b/WebCore/plugins/chromium/PluginDataChromium.cpp
@@ -35,23 +35,6 @@
namespace WebCore {
-static PluginInfo* clone(const PluginInfo* info)
-{
- PluginInfo* result = new PluginInfo();
- result->name = info->name;
- result->desc = info->desc;
- result->file = info->file;
- for (size_t i = 0; i < info->mimes.size(); ++i) {
- MimeClassInfo* mime = new MimeClassInfo();
- mime->type = info->mimes[i]->type;
- mime->desc = info->mimes[i]->desc;
- mime->suffixes = info->mimes[i]->suffixes;
- mime->plugin = result;
- result->mimes.append(mime);
- }
- return result;
-}
-
class PluginCache {
public:
PluginCache() : m_loaded(false), m_refresh(false) {}
@@ -59,15 +42,12 @@ public:
void reset(bool refresh)
{
- for (size_t i = 0; i < m_plugins.size(); ++i)
- deleteAllValues(m_plugins[i]->mimes);
- deleteAllValues(m_plugins);
m_plugins.clear();
m_loaded = false;
m_refresh = refresh;
}
- const Vector<PluginInfo*>& plugins()
+ const Vector<PluginInfo>& plugins()
{
if (!m_loaded) {
ChromiumBridge::plugins(m_refresh, &m_plugins);
@@ -78,7 +58,7 @@ public:
}
private:
- Vector<PluginInfo*> m_plugins;
+ Vector<PluginInfo> m_plugins;
bool m_loaded;
bool m_refresh;
};
@@ -87,9 +67,9 @@ static PluginCache pluginCache;
void PluginData::initPlugins()
{
- const Vector<PluginInfo*>& plugins = pluginCache.plugins();
+ const Vector<PluginInfo>& plugins = pluginCache.plugins();
for (size_t i = 0; i < plugins.size(); ++i)
- m_plugins.append(clone(plugins[i]));
+ m_plugins.append(plugins[i]);
}
void PluginData::refresh()
@@ -100,15 +80,15 @@ void PluginData::refresh()
String getPluginMimeTypeFromExtension(const String& extension)
{
- const Vector<PluginInfo*>& plugins = pluginCache.plugins();
+ const Vector<PluginInfo>& plugins = pluginCache.plugins();
for (size_t i = 0; i < plugins.size(); ++i) {
- for (size_t j = 0; j < plugins[i]->mimes.size(); ++j) {
- MimeClassInfo* mime = plugins[i]->mimes[j];
+ for (size_t j = 0; j < plugins[i].mimes.size(); ++j) {
+ const MimeClassInfo& mime = plugins[i].mimes[j];
Vector<String> extensions;
- mime->suffixes.split(",", extensions);
+ mime.suffixes.split(",", extensions);
for (size_t k = 0; k < extensions.size(); ++k) {
if (extension == extensions[k])
- return mime->type;
+ return mime.type;
}
}
}
diff --git a/WebCore/plugins/gtk/PluginDataGtk.cpp b/WebCore/plugins/gtk/PluginDataGtk.cpp
index 0d477cd..ca6584b 100644
--- a/WebCore/plugins/gtk/PluginDataGtk.cpp
+++ b/WebCore/plugins/gtk/PluginDataGtk.cpp
@@ -33,31 +33,32 @@ void PluginData::initPlugins()
const Vector<PluginPackage*> &plugins = db->plugins();
for (unsigned int i = 0; i < plugins.size(); ++i) {
- PluginInfo* info = new PluginInfo;
+ PluginInfo info;
PluginPackage* package = plugins[i];
- info->name = package->name();
- info->file = package->fileName();
- info->desc = package->description();
+ info.name = package->name();
+ info.file = package->fileName();
+ info.desc = package->description();
const MIMEToDescriptionsMap& mimeToDescriptions = package->mimeToDescriptions();
MIMEToDescriptionsMap::const_iterator end = mimeToDescriptions.end();
for (MIMEToDescriptionsMap::const_iterator it = mimeToDescriptions.begin(); it != end; ++it) {
- MimeClassInfo* mime = new MimeClassInfo;
- info->mimes.append(mime);
+ MimeClassInfo mime;
- mime->type = it->first;
- mime->desc = it->second;
- mime->plugin = info;
+ mime.type = it->first;
+ mime.desc = it->second;
+ mime.pluginIndex = m_plugins.size();
- Vector<String> extensions = package->mimeToExtensions().get(mime->type);
+ Vector<String> extensions = package->mimeToExtensions().get(mime.type);
for (unsigned i = 0; i < extensions.size(); i++) {
if (i > 0)
- mime->suffixes += ",";
+ mime.suffixes += ",";
- mime->suffixes += extensions[i];
+ mime.suffixes += extensions[i];
}
+
+ info.mimes.append(mime);
}
m_plugins.append(info);
diff --git a/WebCore/plugins/gtk/gtk2xtbin.c b/WebCore/plugins/gtk/gtk2xtbin.c
index fad66fe..28388cf 100644
--- a/WebCore/plugins/gtk/gtk2xtbin.c
+++ b/WebCore/plugins/gtk/gtk2xtbin.c
@@ -73,7 +73,6 @@ static void gtk_xtbin_init (GtkXtBin *xtbin);
static void gtk_xtbin_realize (GtkWidget *widget);
static void gtk_xtbin_unrealize (GtkWidget *widget);
static void gtk_xtbin_destroy (GtkObject *object);
-static void gtk_xtbin_shutdown (GtkObject *object);
/* Xt aware XEmbed */
static void xt_client_init (XtClient * xtclient,
@@ -159,7 +158,6 @@ xt_event_dispatch (GSource* source_data,
GSourceFunc call_back,
gpointer user_data)
{
- XEvent event;
XtAppContext ac;
int i = 0;
@@ -181,11 +179,13 @@ xt_event_dispatch (GSource* source_data,
return TRUE;
}
+typedef void (*GSourceFuncsFinalize) (GSource* source);
+
static GSourceFuncs xt_event_funcs = {
xt_event_prepare,
xt_event_check,
xt_event_dispatch,
- g_free,
+ (GSourceFuncsFinalize)g_free,
(GSourceFunc)NULL,
(GSourceDummyMarshal)NULL
};
@@ -230,11 +230,12 @@ gtk_xtbin_get_type (void)
sizeof (GtkXtBin),
0,
(GInstanceInitFunc)gtk_xtbin_init,
+ NULL
};
xtbin_type = g_type_register_static (GTK_TYPE_SOCKET,
"GtkXtBin",
- &xtbin_info,
- 0);
+ &xtbin_info,
+ 0);
}
return xtbin_type;
}
@@ -402,7 +403,7 @@ gtk_xtbin_set_position (GtkXtBin *xtbin,
xtbin->x = x;
xtbin->y = y;
- if (gtk_widget_get_realized (xtbin))
+ if (gtk_widget_get_realized (GTK_WIDGET(xtbin)))
gdk_window_move (GTK_WIDGET (xtbin)->window, x, y);
}
@@ -883,7 +884,6 @@ xt_add_focus_listener( Widget w, XtPointer user_data)
XWindowAttributes attr;
long eventmask;
XtClient *xtclient = user_data;
- int errorcode;
trap_errors ();
XGetWindowAttributes(XtDisplay(w), XtWindow(w), &attr);
@@ -903,8 +903,6 @@ xt_add_focus_listener( Widget w, XtPointer user_data)
static void
xt_remove_focus_listener(Widget w, XtPointer user_data)
{
- int errorcode;
-
trap_errors ();
XtRemoveEventHandler(w, SubstructureNotifyMask | ButtonReleaseMask, TRUE,
(XtEventHandler)xt_client_focus_listener, user_data);
diff --git a/WebCore/plugins/mac/PluginDataMac.mm b/WebCore/plugins/mac/PluginDataMac.mm
index ec76c37..dcdf22d 100644
--- a/WebCore/plugins/mac/PluginDataMac.mm
+++ b/WebCore/plugins/mac/PluginDataMac.mm
@@ -39,22 +39,24 @@ void PluginData::initPlugins()
NSArray* plugins = [[WebCoreViewFactory sharedFactory] pluginsInfo];
for (unsigned int i = 0; i < [plugins count]; ++i) {
- PluginInfo* pluginInfo = new PluginInfo;
+ PluginInfo pluginInfo;
id <WebCorePluginInfo> plugin = [plugins objectAtIndex:i];
- pluginInfo->name = [plugin name];
- pluginInfo->file = [plugin filename];
- pluginInfo->desc = [plugin pluginDescription];
+ pluginInfo.name = [plugin name];
+ pluginInfo.file = [plugin filename];
+ pluginInfo.desc = [plugin pluginDescription];
NSEnumerator* MIMETypeEnumerator = [plugin MIMETypeEnumerator];
while (NSString* MIME = [MIMETypeEnumerator nextObject]) {
- MimeClassInfo* mime = new MimeClassInfo;
- pluginInfo->mimes.append(mime);
- mime->type = String(MIME).lower();
- mime->suffixes = [[plugin extensionsForMIMEType:MIME] componentsJoinedByString:@","];
- mime->desc = [plugin descriptionForMIMEType:MIME];
- mime->plugin = pluginInfo;
+ MimeClassInfo mime;
+
+ mime.type = String(MIME).lower();
+ mime.suffixes = [[plugin extensionsForMIMEType:MIME] componentsJoinedByString:@","];
+ mime.desc = [plugin descriptionForMIMEType:MIME];
+ mime.pluginIndex = m_plugins.size();
+
+ pluginInfo.mimes.append(mime);
}
m_plugins.append(pluginInfo);
diff --git a/WebCore/plugins/npapi.cpp b/WebCore/plugins/npapi.cpp
index 99eea32..070c3ce 100644
--- a/WebCore/plugins/npapi.cpp
+++ b/WebCore/plugins/npapi.cpp
@@ -25,7 +25,7 @@
#include "config.h"
-#include "PluginInfoStore.h"
+#include "Page.h"
#include "PluginMainThreadScheduler.h"
#include "PluginView.h"
#include "npruntime_internal.h"
@@ -61,7 +61,7 @@ uint32_t NPN_MemFlush(uint32_t size)
void NPN_ReloadPlugins(NPBool reloadPages)
{
- refreshPlugins(reloadPages);
+ Page::refreshPlugins(reloadPages);
}
NPError NPN_RequestRead(NPStream* stream, NPByteRange* rangeList)
diff --git a/WebCore/plugins/qt/PluginDataQt.cpp b/WebCore/plugins/qt/PluginDataQt.cpp
index 188365a..8d4968b 100644
--- a/WebCore/plugins/qt/PluginDataQt.cpp
+++ b/WebCore/plugins/qt/PluginDataQt.cpp
@@ -42,19 +42,20 @@ void PluginData::initPlugins()
for (int i = 0; i < qplugins.count(); ++i) {
const QWebPluginFactory::Plugin& qplugin = qplugins.at(i);
- PluginInfo* info = new PluginInfo;
- info->name = qplugin.name;
- info->desc = qplugin.description;
+ PluginInfo info;
+ info.name = qplugin.name;
+ info.desc = qplugin.description;
for (int j = 0; j < qplugin.mimeTypes.count(); ++j) {
const QWebPluginFactory::MimeType& mimeType = qplugin.mimeTypes.at(j);
- MimeClassInfo* mimeInfo = new MimeClassInfo;
- mimeInfo->type = mimeType.name;
- mimeInfo->desc = mimeType.description;
- mimeInfo->suffixes = mimeType.fileExtensions.join(QLatin1String("; "));
+ MimeClassInfo mimeInfo;
+ mimeInfo.type = mimeType.name;
+ mimeInfo.desc = mimeType.description;
+ mimeInfo.suffixes = mimeType.fileExtensions.join(QLatin1String("; "));
+ mimeInfo.pluginIndex = m_plugins.size();
- info->mimes.append(mimeInfo);
+ info.mimes.append(mimeInfo);
}
m_plugins.append(info);
@@ -65,31 +66,32 @@ void PluginData::initPlugins()
const Vector<PluginPackage*> &plugins = db->plugins();
for (unsigned int i = 0; i < plugins.size(); ++i) {
- PluginInfo* info = new PluginInfo;
+ PluginInfo info;
PluginPackage* package = plugins[i];
- info->name = package->name();
- info->file = package->fileName();
- info->desc = package->description();
+ info.name = package->name();
+ info.file = package->fileName();
+ info.desc = package->description();
const MIMEToDescriptionsMap& mimeToDescriptions = package->mimeToDescriptions();
MIMEToDescriptionsMap::const_iterator end = mimeToDescriptions.end();
for (MIMEToDescriptionsMap::const_iterator it = mimeToDescriptions.begin(); it != end; ++it) {
- MimeClassInfo* mime = new MimeClassInfo;
- info->mimes.append(mime);
+ MimeClassInfo mime;
- mime->type = it->first;
- mime->desc = it->second;
- mime->plugin = info;
+ mime.type = it->first;
+ mime.desc = it->second;
+ mime.pluginIndex = m_plugins.size();
- Vector<String> extensions = package->mimeToExtensions().get(mime->type);
+ Vector<String> extensions = package->mimeToExtensions().get(mime.type);
for (unsigned i = 0; i < extensions.size(); i++) {
if (i > 0)
- mime->suffixes += ",";
+ mime.suffixes += ",";
- mime->suffixes += extensions[i];
+ mime.suffixes += extensions[i];
}
+
+ info.mimes.append(mime);
}
m_plugins.append(info);
diff --git a/WebCore/plugins/win/PluginDataWin.cpp b/WebCore/plugins/win/PluginDataWin.cpp
index 4ec4b6d..59bd40b 100644
--- a/WebCore/plugins/win/PluginDataWin.cpp
+++ b/WebCore/plugins/win/PluginDataWin.cpp
@@ -32,31 +32,32 @@ void PluginData::initPlugins()
const Vector<PluginPackage*> &plugins = db->plugins();
for (unsigned int i = 0; i < plugins.size(); ++i) {
- PluginInfo* info = new PluginInfo;
PluginPackage* package = plugins[i];
- info->name = package->name();
- info->file = package->fileName();
- info->desc = package->description();
+ PluginInfo info;
+ info.name = package->name();
+ info.file = package->fileName();
+ info.desc = package->description();
const MIMEToDescriptionsMap& mimeToDescriptions = package->mimeToDescriptions();
MIMEToDescriptionsMap::const_iterator end = mimeToDescriptions.end();
for (MIMEToDescriptionsMap::const_iterator it = mimeToDescriptions.begin(); it != end; ++it) {
- MimeClassInfo* mime = new MimeClassInfo;
- info->mimes.append(mime);
+ MimeClassInfo mime;
- mime->type = it->first;
- mime->desc = it->second;
- mime->plugin = info;
+ mime.type = it->first;
+ mime.desc = it->second;
+ mime.pluginIndex = m_plugins.size();
- Vector<String> extensions = package->mimeToExtensions().get(mime->type);
+ Vector<String> extensions = package->mimeToExtensions().get(mime.type);
for (unsigned i = 0; i < extensions.size(); i++) {
if (i > 0)
- mime->suffixes += ",";
+ mime.suffixes += ",";
- mime->suffixes += extensions[i];
+ mime.suffixes += extensions[i];
}
+
+ info.mimes.append(mime);
}
m_plugins.append(info);
diff --git a/WebCore/plugins/wx/PluginDataWx.cpp b/WebCore/plugins/wx/PluginDataWx.cpp
index 58ee315..747c11a 100644
--- a/WebCore/plugins/wx/PluginDataWx.cpp
+++ b/WebCore/plugins/wx/PluginDataWx.cpp
@@ -39,31 +39,32 @@ void PluginData::initPlugins()
const Vector<PluginPackage*> &plugins = db->plugins();
for (unsigned int i = 0; i < plugins.size(); ++i) {
- PluginInfo* info = new PluginInfo;
+ PluginInfo info;
PluginPackage* package = plugins[i];
- info->name = package->name();
- info->file = package->fileName();
- info->desc = package->description();
+ info.name = package->name();
+ info.file = package->fileName();
+ info.desc = package->description();
const MIMEToDescriptionsMap& mimeToDescriptions = package->mimeToDescriptions();
MIMEToDescriptionsMap::const_iterator end = mimeToDescriptions.end();
for (MIMEToDescriptionsMap::const_iterator it = mimeToDescriptions.begin(); it != end; ++it) {
- MimeClassInfo* mime = new MimeClassInfo;
- info->mimes.append(mime);
+ MimeClassInfo mime;
- mime->type = it->first;
- mime->desc = it->second;
- mime->plugin = info;
+ mime.type = it->first;
+ mime.desc = it->second;
+ mime.pluginIndex = m_plugins.size();
- Vector<String> extensions = package->mimeToExtensions().get(mime->type);
+ Vector<String> extensions = package->mimeToExtensions().get(mime.type);
for (unsigned i = 0; i < extensions.size(); i++) {
if (i > 0)
- mime->suffixes += ",";
+ mime.suffixes += ",";
- mime->suffixes += extensions[i];
+ mime.suffixes += extensions[i];
}
+
+ info.mimes.append(mime);
}
m_plugins.append(info);