123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- /*
- * Copyright (C) 2012 Igalia S.L.
- * Copyright (C) 2012 Sony Computer Entertainment Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
- #include "config.h"
- #include "PlatformStrategiesManx.h"
- #include "NotImplemented.h"
- #include "Page.h"
- #include "PageGroup.h"
- #include "PlatformCookieJar.h"
- #include "PluginDatabase.h"
- #include "PluginPackage.h"
- using namespace WebCore;
- void PlatformStrategiesManx::initialize()
- {
- DEFINE_STATIC_LOCAL(PlatformStrategiesManx, platformStrategies, ());
- setPlatformStrategies(&platformStrategies);
- }
- PlatformStrategiesManx::PlatformStrategiesManx()
- {
- }
- CookiesStrategy* PlatformStrategiesManx::createCookiesStrategy()
- {
- return this;
- }
- DatabaseStrategy* PlatformStrategiesManx::createDatabaseStrategy()
- {
- return this;
- }
- LoaderStrategy* PlatformStrategiesManx::createLoaderStrategy()
- {
- return this;
- }
- PluginStrategy* PlatformStrategiesManx::createPluginStrategy()
- {
- return this;
- }
- SharedWorkerStrategy* PlatformStrategiesManx::createSharedWorkerStrategy()
- {
- return this;
- }
- StorageStrategy* PlatformStrategiesManx::createStorageStrategy()
- {
- return this;
- }
- VisitedLinkStrategy* PlatformStrategiesManx::createVisitedLinkStrategy()
- {
- return this;
- }
- PasteboardStrategy* PlatformStrategiesManx::createPasteboardStrategy()
- {
- // This is currently used only by mac code.
- notImplemented();
- return 0;
- }
- // CookiesStrategy
- String PlatformStrategiesManx::cookiesForDOM(const NetworkStorageSession& session, const KURL& firstParty, const KURL& url)
- {
- return WebCore::cookiesForDOM(session, firstParty, url);
- }
- void PlatformStrategiesManx::setCookiesFromDOM(const NetworkStorageSession& session, const KURL& firstParty, const KURL& url, const String& cookieString)
- {
- WebCore::setCookiesFromDOM(session, firstParty, url, cookieString);
- }
- bool PlatformStrategiesManx::cookiesEnabled(const NetworkStorageSession& session, const KURL& firstParty, const KURL& url)
- {
- return WebCore::cookiesEnabled(session, firstParty, url);
- }
- String PlatformStrategiesManx::cookieRequestHeaderFieldValue(const NetworkStorageSession& session, const KURL& firstParty, const KURL& url)
- {
- return WebCore::cookieRequestHeaderFieldValue(session, firstParty, url);
- }
- bool PlatformStrategiesManx::getRawCookies(const NetworkStorageSession& session, const KURL& firstParty, const KURL& url, Vector<Cookie>& rawCookies)
- {
- return WebCore::getRawCookies(session, firstParty, url, rawCookies);
- }
- void PlatformStrategiesManx::deleteCookie(const NetworkStorageSession& session, const KURL& url, const String& cookieName)
- {
- WebCore::deleteCookie(session, url, cookieName);
- }
- // PluginStrategy
- void PlatformStrategiesManx::refreshPlugins()
- {
- PluginDatabase::installedPlugins()->refresh();
- }
- void PlatformStrategiesManx::getPluginInfo(const Page* page, Vector<PluginInfo>& outPlugins)
- {
- PluginDatabase* database = PluginDatabase::installedPlugins();
- const Vector<PluginPackage*> &plugins = database->plugins();
- outPlugins.resize(plugins.size());
- for (size_t i = 0; i < plugins.size(); ++i) {
- PluginPackage* package = plugins[i];
- PluginInfo pluginInfo;
- pluginInfo.name = package->name();
- pluginInfo.file = package->fileName();
- pluginInfo.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;
- mime.type = it->key;
- mime.desc = it->value;
- mime.extensions = package->mimeToExtensions().get(mime.type);
- pluginInfo.mimes.append(mime);
- }
- outPlugins.append(pluginInfo);
- }
- }
- // VisitedLinkStrategy
- bool PlatformStrategiesManx::isLinkVisited(Page* page, LinkHash hash, const KURL&, const AtomicString&)
- {
- return page->group().isLinkVisited(hash);
- }
- void PlatformStrategiesManx::addVisitedLink(Page* page, LinkHash hash)
- {
- page->group().addVisitedLinkHash(hash);
- }
|