1 /* 2 Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 3 Copyright (C) 2006, 2007 Apple Inc. All rights reserved. 4 Copyright (C) 2008 Collabora Ltd. All rights reserved. 5 6 This library is free software; you can redistribute it and/or 7 modify it under the terms of the GNU Library General Public 8 License as published by the Free Software Foundation; either 9 version 2 of the License, or (at your option) any later version. 10 11 This library is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 Library General Public License for more details. 15 16 You should have received a copy of the GNU Library General Public License 17 along with this library; see the file COPYING.LIB. If not, write to 18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 19 Boston, MA 02110-1301, USA. 20 */ 21 22 #include "config.h" 23 #include "PluginData.h" 24 25 #include "PluginDatabase.h" 26 #include "PluginPackage.h" 27 #include <stdio.h> 28 namespace WebCore { 29 30 void PluginData::initPlugins(const Page*) 31 { 32 PluginDatabase *db = PluginDatabase::installedPlugins(); 33 const Vector<PluginPackage*> &plugins = db->plugins(); 34 35 for (unsigned int i = 0; i < plugins.size(); ++i) { 36 PluginInfo info; 37 PluginPackage* package = plugins[i]; 38 39 info.name = package->name(); 40 info.file = package->fileName(); 41 info.desc = package->description(); 42 43 const MIMEToDescriptionsMap& mimeToDescriptions = package->mimeToDescriptions(); 44 MIMEToDescriptionsMap::const_iterator end = mimeToDescriptions.end(); 45 for (MIMEToDescriptionsMap::const_iterator it = mimeToDescriptions.begin(); it != end; ++it) { 46 MimeClassInfo mime; 47 48 mime.type = it->first; 49 mime.desc = it->second; 50 mime.extensions = package->mimeToExtensions().get(mime.type); 51 52 info.mimes.append(mime); 53 } 54 55 m_plugins.append(info); 56 } 57 } 58 59 void PluginData::refresh() 60 { 61 PluginDatabase *db = PluginDatabase::installedPlugins(); 62 db->refresh(); 63 } 64 65 }; 66