1/* 2 Copyright (C) 2006, 2007 Apple Inc. All rights reserved. 3 Copyright (C) 2008 Trolltech ASA 4 Copyright (C) 2008 Collabora Ltd. All rights reserved. 5 Copyright (C) 2008 INdT - Instituto Nokia de Tecnologia 6 Copyright (C) 2009-2010 ProFUSION embedded systems 7 Copyright (C) 2009-2011 Samsung Electronics 8 Copyright (C) 2012 Intel Corporation 9 10 This library is free software; you can redistribute it and/or 11 modify it under the terms of the GNU Library General Public 12 License as published by the Free Software Foundation; either 13 version 2 of the License, or (at your option) any later version. 14 15 This library is distributed in the hope that it will be useful, 16 but WITHOUT ANY WARRANTY; without even the implied warranty of 17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 Library General Public License for more details. 19 20 You should have received a copy of the GNU Library General Public License 21 along with this library; see the file COPYING.LIB. If not, write to 22 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 23 Boston, MA 02110-1301, USA. 24*/ 25 26#include "config.h" 27#include "PlatformStrategiesEfl.h" 28 29#include "NotImplemented.h" 30#include "Page.h" 31#include "PageGroup.h" 32#include "PlatformCookieJar.h" 33#include "PluginDatabase.h" 34#include "PluginPackage.h" 35 36using namespace WebCore; 37 38void PlatformStrategiesEfl::initialize() 39{ 40 DEFINE_STATIC_LOCAL(PlatformStrategiesEfl, platformStrategies, ()); 41 setPlatformStrategies(&platformStrategies); 42} 43 44PlatformStrategiesEfl::PlatformStrategiesEfl() 45{ 46} 47 48CookiesStrategy* PlatformStrategiesEfl::createCookiesStrategy() 49{ 50 return this; 51} 52 53DatabaseStrategy* PlatformStrategiesEfl::createDatabaseStrategy() 54{ 55 return this; 56} 57 58LoaderStrategy* PlatformStrategiesEfl::createLoaderStrategy() 59{ 60 return this; 61} 62 63PasteboardStrategy* PlatformStrategiesEfl::createPasteboardStrategy() 64{ 65 notImplemented(); 66 return 0; 67} 68 69PluginStrategy* PlatformStrategiesEfl::createPluginStrategy() 70{ 71 return this; 72} 73 74SharedWorkerStrategy* PlatformStrategiesEfl::createSharedWorkerStrategy() 75{ 76 return this; 77} 78 79VisitedLinkStrategy* PlatformStrategiesEfl::createVisitedLinkStrategy() 80{ 81 return this; 82} 83 84StorageStrategy* PlatformStrategiesEfl::createStorageStrategy() 85{ 86 return this; 87} 88 89// CookiesStrategy 90String PlatformStrategiesEfl::cookiesForDOM(const NetworkStorageSession& session, const KURL& firstParty, const KURL& url) 91{ 92 return WebCore::cookiesForDOM(session, firstParty, url); 93} 94 95void PlatformStrategiesEfl::setCookiesFromDOM(const NetworkStorageSession& session, const KURL& firstParty, const KURL& url, const String& cookieString) 96{ 97 WebCore::setCookiesFromDOM(session, firstParty, url, cookieString); 98} 99 100bool PlatformStrategiesEfl::cookiesEnabled(const NetworkStorageSession& session, const KURL& firstParty, const KURL& url) 101{ 102 return WebCore::cookiesEnabled(session, firstParty, url); 103} 104 105String PlatformStrategiesEfl::cookieRequestHeaderFieldValue(const NetworkStorageSession& session, const KURL& firstParty, const KURL& url) 106{ 107 return WebCore::cookieRequestHeaderFieldValue(session, firstParty, url); 108} 109 110bool PlatformStrategiesEfl::getRawCookies(const NetworkStorageSession& session, const KURL& firstParty, const KURL& url, Vector<Cookie>& rawCookies) 111{ 112 return WebCore::getRawCookies(session, firstParty, url, rawCookies); 113} 114 115void PlatformStrategiesEfl::deleteCookie(const NetworkStorageSession& session, const KURL& url, const String& cookieName) 116{ 117 WebCore::deleteCookie(session, url, cookieName); 118} 119 120void PlatformStrategiesEfl::refreshPlugins() 121{ 122#if ENABLE(NETSCAPE_PLUGIN_API) 123 PluginDatabase::installedPlugins()->refresh(); 124#endif 125} 126 127void PlatformStrategiesEfl::getPluginInfo(const Page*, Vector<PluginInfo>& outPlugins) 128{ 129#if ENABLE(NETSCAPE_PLUGIN_API) 130 PluginDatabase::installedPlugins()->refresh(); 131 const Vector<PluginPackage*>& plugins = PluginDatabase::installedPlugins()->plugins(); 132 outPlugins.resize(plugins.size()); 133 134 for (size_t i = 0; i < plugins.size(); ++i) { 135 PluginPackage* package = plugins[i]; 136 137 PluginInfo pluginInfo; 138 pluginInfo.name = package->name(); 139 pluginInfo.file = package->fileName(); 140 pluginInfo.desc = package->description(); 141 142 const MIMEToDescriptionsMap& mimeToDescriptions = package->mimeToDescriptions(); 143 MIMEToDescriptionsMap::const_iterator end = mimeToDescriptions.end(); 144 for (MIMEToDescriptionsMap::const_iterator it = mimeToDescriptions.begin(); it != end; ++it) { 145 MimeClassInfo mime; 146 147 mime.type = it->key; 148 mime.desc = it->value; 149 mime.extensions = package->mimeToExtensions().get(mime.type); 150 pluginInfo.mimes.append(mime); 151 } 152 153 outPlugins.append(pluginInfo); 154 } 155#else 156 UNUSED_PARAM(outPlugins); 157#endif 158} 159 160// VisitedLinkStrategy 161bool PlatformStrategiesEfl::isLinkVisited(Page* page, LinkHash hash, const KURL&, const AtomicString&) 162{ 163 return page->group().isLinkVisited(hash); 164} 165 166void PlatformStrategiesEfl::addVisitedLink(Page* page, LinkHash hash) 167{ 168 page->group().addVisitedLinkHash(hash); 169} 170