PlatformStrategies.h [plain text]
#ifndef PlatformStrategies_h
#define PlatformStrategies_h
namespace WebCore {
class CookiesStrategy;
class LoaderStrategy;
class PasteboardStrategy;
class PluginStrategy;
class PlatformStrategies {
public:
CookiesStrategy* cookiesStrategy()
{
if (!m_cookiesStrategy)
m_cookiesStrategy = createCookiesStrategy();
return m_cookiesStrategy;
}
LoaderStrategy* loaderStrategy()
{
if (!m_loaderStrategy)
m_loaderStrategy = createLoaderStrategy();
return m_loaderStrategy;
}
PasteboardStrategy* pasteboardStrategy()
{
if (!m_pasteboardStrategy)
m_pasteboardStrategy = createPasteboardStrategy();
return m_pasteboardStrategy;
}
PluginStrategy* pluginStrategy()
{
if (!m_pluginStrategy)
m_pluginStrategy = createPluginStrategy();
return m_pluginStrategy;
}
protected:
PlatformStrategies()
: m_cookiesStrategy(nullptr)
, m_loaderStrategy(nullptr)
, m_pasteboardStrategy(nullptr)
, m_pluginStrategy(nullptr)
{
}
virtual ~PlatformStrategies()
{
}
private:
virtual CookiesStrategy* createCookiesStrategy() = 0;
virtual LoaderStrategy* createLoaderStrategy() = 0;
virtual PasteboardStrategy* createPasteboardStrategy() = 0;
virtual PluginStrategy* createPluginStrategy() = 0;
CookiesStrategy* m_cookiesStrategy;
LoaderStrategy* m_loaderStrategy;
PasteboardStrategy* m_pasteboardStrategy;
PluginStrategy* m_pluginStrategy;
};
WEBCORE_EXPORT PlatformStrategies* platformStrategies();
WEBCORE_EXPORT void setPlatformStrategies(PlatformStrategies*);
bool hasPlatformStrategies();
}
#endif // PlatformStrategies_h