WebPreferencesStore.h [plain text]
#ifndef WebPreferencesStore_h
#define WebPreferencesStore_h
#include "ArgumentDecoder.h"
#include "ArgumentEncoder.h"
#include <wtf/HashMap.h>
#include <wtf/text/StringHash.h>
#include <wtf/text/WTFString.h>
namespace WebKit {
#if PLATFORM(WIN)
#define DEFAULT_WEBKIT_AVFOUNDATION_ENABLED false
#else
#define DEFAULT_WEBKIT_AVFOUNDATION_ENABLED true
#endif
#define FOR_EACH_WEBKIT_BOOL_PREFERENCE(macro) \
macro(JavaScriptEnabled, javaScriptEnabled, Bool, bool, true) \
macro(LoadsImagesAutomatically, loadsImagesAutomatically, Bool, bool, true) \
macro(LoadsSiteIconsIgnoringImageLoadingPreference, loadsSiteIconsIgnoringImageLoadingPreference, Bool, bool, false) \
macro(PluginsEnabled, pluginsEnabled, Bool, bool, true) \
macro(JavaEnabled, javaEnabled, Bool, bool, true) \
macro(OfflineWebApplicationCacheEnabled, offlineWebApplicationCacheEnabled, Bool, bool, false) \
macro(LocalStorageEnabled, localStorageEnabled, Bool, bool, true) \
macro(DatabasesEnabled, databasesEnabled, Bool, bool, true) \
macro(XSSAuditorEnabled, xssAuditorEnabled, Bool, bool, true) \
macro(FrameFlatteningEnabled, frameFlatteningEnabled, Bool, bool, false) \
macro(DeveloperExtrasEnabled, developerExtrasEnabled, Bool, bool, false) \
macro(PrivateBrowsingEnabled, privateBrowsingEnabled, Bool, bool, false) \
macro(TextAreasAreResizable, textAreasAreResizable, Bool, bool, true) \
macro(JavaScriptCanOpenWindowsAutomatically, javaScriptCanOpenWindowsAutomatically, Bool, bool, true) \
macro(HyperlinkAuditingEnabled, hyperlinkAuditingEnabled, Bool, bool, true) \
macro(NeedsSiteSpecificQuirks, needsSiteSpecificQuirks, Bool, bool, false) \
macro(AcceleratedCompositingEnabled, acceleratedCompositingEnabled, Bool, bool, true) \
macro(AcceleratedDrawingEnabled, acceleratedDrawingEnabled, Bool, bool, false) \
macro(CanvasUsesAcceleratedDrawing, canvasUsesAcceleratedDrawing, Bool, bool, true) \
macro(CompositingBordersVisible, compositingBordersVisible, Bool, bool, false) \
macro(CompositingRepaintCountersVisible, compositingRepaintCountersVisible, Bool, bool, false) \
macro(WebGLEnabled, webGLEnabled, Bool, bool, false) \
macro(ForceFTPDirectoryListings, forceFTPDirectoryListings, Bool, bool, false) \
macro(TabsToLinks, tabsToLinks, Bool, bool, false) \
macro(DNSPrefetchingEnabled, dnsPrefetchingEnabled, Bool, bool, false) \
macro(WebArchiveDebugModeEnabled, webArchiveDebugModeEnabled, Bool, bool, false) \
macro(LocalFileContentSniffingEnabled, localFileContentSniffingEnabled, Bool, bool, false) \
macro(UsesPageCache, usesPageCache, Bool, bool, true) \
macro(AuthorAndUserStylesEnabled, authorAndUserStylesEnabled, Bool, bool, true) \
macro(PaginateDuringLayoutEnabled, paginateDuringLayoutEnabled, Bool, bool, false) \
macro(DOMPasteAllowed, domPasteAllowed, Bool, bool, false) \
macro(JavaScriptCanAccessClipboard, javaScriptCanAccessClipboard, Bool, bool, false) \
macro(ShouldPrintBackgrounds, shouldPrintBackgrounds, Bool, bool, false) \
macro(FullScreenEnabled, fullScreenEnabled, Bool, bool, false) \
macro(WebSecurityEnabled, webSecurityEnabled, Bool, bool, true) \
macro(AllowUniversalAccessFromFileURLs, allowUniversalAccessFromFileURLs, Bool, bool, false) \
macro(AllowFileAccessFromFileURLs, allowFileAccessFromFileURLs, Bool, bool, false) \
macro(AVFoundationEnabled, isAVFoundationEnabled, Bool, bool, DEFAULT_WEBKIT_AVFOUNDATION_ENABLED) \
macro(InspectorStartsAttached, inspectorStartsAttached, Bool, bool, true) \
\
#define FOR_EACH_WEBKIT_DOUBLE_PREFERENCE(macro) \
macro(PDFScaleFactor, pdfScaleFactor, Double, double, 0) \
\
#if PLATFORM(WIN)
#define DEFAULT_WEBKIT_FONT_SMOOTHING_LEVEL FontSmoothingLevelWindows
#else
#define DEFAULT_WEBKIT_FONT_SMOOTHING_LEVEL FontSmoothingLevelMedium
#endif
#define FOR_EACH_WEBKIT_UINT32_PREFERENCE(macro) \
macro(FontSmoothingLevel, fontSmoothingLevel, UInt32, uint32_t, DEFAULT_WEBKIT_FONT_SMOOTHING_LEVEL) \
macro(MinimumFontSize, minimumFontSize, UInt32, uint32_t, 0) \
macro(MinimumLogicalFontSize, minimumLogicalFontSize, UInt32, uint32_t, 9) \
macro(DefaultFontSize, defaultFontSize, UInt32, uint32_t, 16) \
macro(DefaultFixedFontSize, defaultFixedFontSize, UInt32, uint32_t, 13) \
macro(PDFDisplayMode, pdfDisplayMode, UInt32, uint32_t, 1) \
macro(EditableLinkBehavior, editableLinkBehavior, UInt32, uint32_t, WebCore::EditableLinkNeverLive) \
\
#if PLATFORM(WIN)
#define FOR_EACH_WEBKIT_FONT_FAMILY_PREFERENCE(macro) \
macro(StandardFontFamily, standardFontFamily, String, String, "Times New Roman") \
macro(CursiveFontFamily, cursiveFontFamily, String, String, "Comic Sans MS") \
macro(FantasyFontFamily, fantasyFontFamily, String, String, "Comic Sans MS") \
macro(FixedFontFamily, fixedFontFamily, String, String, "Courier New") \
macro(SansSerifFontFamily, sansSerifFontFamily, String, String, "Arial") \
macro(SerifFontFamily, serifFontFamily, String, String, "Times New Roman") \
macro(PictographFontFamily, pictographFontFamily, String, String, "Times New Roman") \
\
#elif PLATFORM(MAC)
#define FOR_EACH_WEBKIT_FONT_FAMILY_PREFERENCE(macro) \
macro(StandardFontFamily, standardFontFamily, String, String, "Times") \
macro(CursiveFontFamily, cursiveFontFamily, String, String, "Apple Chancery") \
macro(FantasyFontFamily, fantasyFontFamily, String, String, "Papyrus") \
macro(FixedFontFamily, fixedFontFamily, String, String, "Courier") \
macro(SansSerifFontFamily, sansSerifFontFamily, String, String, "Helvetica") \
macro(SerifFontFamily, serifFontFamily, String, String, "Times") \
macro(PictographFontFamily, pictographFontFamily, String, String, "Apple Color Emoji") \
\
#elif PLATFORM(QT) || PLATFORM(GTK)
#define FOR_EACH_WEBKIT_FONT_FAMILY_PREFERENCE(macro) \
macro(StandardFontFamily, standardFontFamily, String, String, "Times") \
macro(CursiveFontFamily, cursiveFontFamily, String, String, "Comic Sans MS") \
macro(FantasyFontFamily, fantasyFontFamily, String, String, "Impact") \
macro(FixedFontFamily, fixedFontFamily, String, String, "Courier New") \
macro(SansSerifFontFamily, sansSerifFontFamily, String, String, "Helvetica") \
macro(SerifFontFamily, serifFontFamily, String, String, "Times") \
\
#endif
#define FOR_EACH_WEBKIT_STRING_PREFERENCE(macro) \
FOR_EACH_WEBKIT_FONT_FAMILY_PREFERENCE(macro) \
macro(DefaultTextEncodingName, defaultTextEncodingName, String, String, "ISO-8859-1") \
macro(FTPDirectoryTemplatePath, ftpDirectoryTemplatePath, String, String, "") \
\
#define FOR_EACH_WEBKIT_PREFERENCE(macro) \
FOR_EACH_WEBKIT_BOOL_PREFERENCE(macro) \
FOR_EACH_WEBKIT_DOUBLE_PREFERENCE(macro) \
FOR_EACH_WEBKIT_UINT32_PREFERENCE(macro) \
FOR_EACH_WEBKIT_STRING_PREFERENCE(macro) \
\
namespace WebPreferencesKey {
#define DECLARE_KEY_GETTERS(KeyUpper, KeyLower, TypeName, Type, DefaultValue) const String& KeyLower##Key();
FOR_EACH_WEBKIT_PREFERENCE(DECLARE_KEY_GETTERS)
#undef DECLARE_KEY_GETTERS
}
struct WebPreferencesStore {
WebPreferencesStore();
void encode(CoreIPC::ArgumentEncoder* encoder) const;
static bool decode(CoreIPC::ArgumentDecoder*, WebPreferencesStore&);
bool setStringValueForKey(const String& key, const String& value);
String getStringValueForKey(const String& key) const;
bool setBoolValueForKey(const String& key, bool value);
bool getBoolValueForKey(const String& key) const;
bool setUInt32ValueForKey(const String& key, uint32_t value);
uint32_t getUInt32ValueForKey(const String& key) const;
bool setDoubleValueForKey(const String& key, double value);
double getDoubleValueForKey(const String& key) const;
static void overrideXSSAuditorEnabledForTestRunner(bool);
static void removeTestRunnerOverrides();
HashMap<String, String> m_stringValues;
HashMap<String, bool> m_boolValues;
HashMap<String, uint32_t> m_uint32Values;
HashMap<String, double> m_doubleValues;
};
}
#endif // WebPreferencesStore_h