[BlackBerry] Upstreaming WebSettings code
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 15 Feb 2012 01:47:57 +0000 (01:47 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 15 Feb 2012 01:47:57 +0000 (01:47 +0000)
https://bugs.webkit.org/show_bug.cgi?id=78633

Patch by Nima Ghanavatian <nghanavatian@rim.com> on 2012-02-14
Reviewed by Rob Buis.

Initial upstreaming, no new tests.

* blackberry/Api/WebSettings.cpp: Added.
* blackberry/Api/WebSettings.h: Added.
* blackberry/Api/WebSettings_p.h: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@107764 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/ChangeLog
Source/WebKit/blackberry/Api/WebSettings.cpp [new file with mode: 0644]
Source/WebKit/blackberry/Api/WebSettings.h [new file with mode: 0644]
Source/WebKit/blackberry/Api/WebSettings_p.h [new file with mode: 0644]

index 5b4fd01..4d007c6 100644 (file)
@@ -1,5 +1,18 @@
 2012-02-14  Nima Ghanavatian  <nghanavatian@rim.com>
 
+        [BlackBerry] Upstreaming WebSettings code
+        https://bugs.webkit.org/show_bug.cgi?id=78633
+
+        Reviewed by Rob Buis.
+
+        Initial upstreaming, no new tests.
+
+        * blackberry/Api/WebSettings.cpp: Added.
+        * blackberry/Api/WebSettings.h: Added.
+        * blackberry/Api/WebSettings_p.h: Added.
+
+2012-02-14  Nima Ghanavatian  <nghanavatian@rim.com>
+
         [BlackBerry] Upstreaming DOMSupport files
         https://bugs.webkit.org/show_bug.cgi?id=78607
 
diff --git a/Source/WebKit/blackberry/Api/WebSettings.cpp b/Source/WebKit/blackberry/Api/WebSettings.cpp
new file mode 100644 (file)
index 0000000..960964c
--- /dev/null
@@ -0,0 +1,816 @@
+/*
+ * Copyright (C) 2009, 2010, 2011, 2012 Research In Motion Limited. All rights reserved.
+ *
+ * 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 "WebSettings.h"
+
+#include "WebSettings_p.h"
+
+#include "WebString.h"
+#include <Base64.h>
+#include <Color.h>
+#include <PageCache.h>
+#include <wtf/HashSet.h>
+#include <wtf/Vector.h>
+
+namespace BlackBerry {
+namespace WebKit {
+
+DEFINE_STATIC_LOCAL(String, BlackBerryAllowCrossSiteRequests, ("BlackBerryAllowCrossSiteRequests"));
+DEFINE_STATIC_LOCAL(String, BlackBerryBackgroundColor, ("BlackBerryBackgroundColor"));
+DEFINE_STATIC_LOCAL(String, BlackBerryCookiesEnabled, ("BlackBerryCookiesEnabled"));
+DEFINE_STATIC_LOCAL(String, BlackBerryDirectRenderingToWindowEnabled, ("BlackBerryDirectRenderingToWindowEnabled"));
+DEFINE_STATIC_LOCAL(String, BlackBerryDrawBorderWhileLoadingImages, ("BlackBerryDrawBorderWhileLoadingImages"));
+DEFINE_STATIC_LOCAL(String, BlackBerryEmailModeEnabled, ("BlackBerryEmailModeEnabled"));
+DEFINE_STATIC_LOCAL(String, BlackBerryGetFocusNodeContextEnabled, ("BlackBerryGetFocusNodeContextEnabled"));
+DEFINE_STATIC_LOCAL(String, BlackBerryHandlePatternURLs, ("BlackBerryHandlePatternURLs"));
+DEFINE_STATIC_LOCAL(String, BlackBerryInitialScale, ("BlackBerryInitialScale"));
+DEFINE_STATIC_LOCAL(String, BlackBerryLinksHandledExternallyEnabled, ("BlackBerryLinksHandledExternallyEnabled"));
+DEFINE_STATIC_LOCAL(String, BlackBerryMaxPluginInstances, ("BlackBerryMaxPluginInstances"));
+DEFINE_STATIC_LOCAL(String, BlackBerryOverZoomColor, ("BlackBerryOverZoomColor"));
+DEFINE_STATIC_LOCAL(String, BlackBerryRenderAnimationsOnScrollOrZoomEnabled, ("BlackBerryRenderAnimationsOnScrollOrZoomEnabled"));
+DEFINE_STATIC_LOCAL(String, BlackBerryScrollbarsEnabled, ("BlackBerryScrollbarsEnabled"));
+DEFINE_STATIC_LOCAL(String, BlackBerryTextReflowMode, ("BlackBerryTextReflowMode"));
+DEFINE_STATIC_LOCAL(String, BlackBerryUseRTLWritingDirection, ("BlackBerryUseRTLWritingDirection"));
+DEFINE_STATIC_LOCAL(String, BlackBerryUseWebKitCache, ("BlackBerryUseWebKitCache"));
+DEFINE_STATIC_LOCAL(String, BlackBerryUserAgentString, ("BlackBerryUserAgentString"));
+DEFINE_STATIC_LOCAL(String, BlackBerryUserScalableEnabled, ("BlackBerryUserScalableEnabled"));
+DEFINE_STATIC_LOCAL(String, BlackBerryViewportWidth, ("BlackBerryViewportWidth"));
+DEFINE_STATIC_LOCAL(String, BlackBerryZoomToFitOnLoadEnabled, ("BlackBerryZoomToFitOnLoadEnabled"));
+DEFINE_STATIC_LOCAL(String, WebKitDatabasePath, ("WebKitDatabasePath"));
+DEFINE_STATIC_LOCAL(String, WebKitDatabasesEnabled, ("WebKitDatabasesEnabled"));
+DEFINE_STATIC_LOCAL(String, WebKitDefaultFixedFontSize, ("WebKitDefaultFixedFontSize"));
+DEFINE_STATIC_LOCAL(String, WebKitDefaultFontSize, ("WebKitDefaultFontSize"));
+DEFINE_STATIC_LOCAL(String, WebKitDefaultTextEncodingName, ("WebKitDefaultTextEncodingName"));
+DEFINE_STATIC_LOCAL(String, WebKitDownloadableBinaryFontsEnabled, ("WebKitDownloadableBinaryFontsEnabled"));
+DEFINE_STATIC_LOCAL(String, WebKitFirstScheduledLayoutDelay, ("WebKitFirstScheduledLayoutDelay"));
+DEFINE_STATIC_LOCAL(String, WebKitFixedFontFamily, ("WebKitFixedFontFamily"));
+DEFINE_STATIC_LOCAL(String, WebKitFrameFlatteningEnabled, ("WebKitFrameFlatteningEnabled"));
+DEFINE_STATIC_LOCAL(String, WebKitGeolocationEnabled, ("WebKitGeolocationEnabled"));
+DEFINE_STATIC_LOCAL(String, WebKitJavaScriptCanOpenWindowsAutomaticallyEnabled, ("WebKitJavaScriptCanOpenWindowsAutomaticallyEnabled"));
+DEFINE_STATIC_LOCAL(String, WebKitJavaScriptEnabled, ("WebKitJavaScriptEnabled"));
+DEFINE_STATIC_LOCAL(String, WebKitLoadsImagesAutomatically, ("WebKitLoadsImagesAutomatically"));
+DEFINE_STATIC_LOCAL(String, WebKitLocalStorageEnabled, ("WebKitLocalStorageEnabled"));
+DEFINE_STATIC_LOCAL(String, WebKitLocalStoragePath, ("WebKitLocalStoragePath"));
+DEFINE_STATIC_LOCAL(String, WebKitLocalStorageQuota, ("WebKitLocalStorageQuota"));
+DEFINE_STATIC_LOCAL(String, WebKitMaximumPagesInCache, ("WebKitMaximumPagesInCache"));
+DEFINE_STATIC_LOCAL(String, WebKitMinimumFontSize, ("WebKitMinimumFontSize"));
+DEFINE_STATIC_LOCAL(String, WebKitOfflineWebApplicationCacheEnabled, ("WebKitOfflineWebApplicationCacheEnabled"));
+DEFINE_STATIC_LOCAL(String, WebKitOfflineWebApplicationCachePath, ("WebKitOfflineWebApplicationCachePath"));
+DEFINE_STATIC_LOCAL(String, WebKitPageGroupName, ("WebKitPageGroupName"));
+DEFINE_STATIC_LOCAL(String, WebKitPluginsEnabled, ("WebKitPluginsEnabled"));
+DEFINE_STATIC_LOCAL(String, WebKitPrivateBrowsingEnabled, ("WebKitPrivateBrowsingEnabled"));
+DEFINE_STATIC_LOCAL(String, WebKitSansSeriffFontFamily, ("WebKitSansSeriffFontFamily"));
+DEFINE_STATIC_LOCAL(String, WebKitSeriffFontFamily, ("WebKitSeriffFontFamily"));
+DEFINE_STATIC_LOCAL(String, WebKitStandardFontFamily, ("WebKitStandardFontFamily"));
+DEFINE_STATIC_LOCAL(String, WebKitUserStyleSheet, ("WebKitUserStyleSheet"));
+DEFINE_STATIC_LOCAL(String, WebKitUserStyleSheetLocation, ("WebKitUserStyleSheetLocation"));
+DEFINE_STATIC_LOCAL(String, WebKitWebSocketsEnabled, ("WebKitWebSocketsEnabled"));
+DEFINE_STATIC_LOCAL(String, WebKitXSSAuditorEnabled, ("WebKitXSSAuditorEnabled"));
+DEFINE_STATIC_LOCAL(String, SpatialNavigationEnabled, ("SpatialNavigationEnabled"));
+
+// FIXME: We should consider moving all the mime type code into its own object.
+
+typedef HashMap<String, WebString> MIMETypeAssociationMap;
+
+static const MIMETypeAssociationMap& mimeTypeAssociationMap()
+{
+    static MIMETypeAssociationMap* mimeTypeMap = 0;
+    if (mimeTypeMap)
+        return *mimeTypeMap;
+
+    mimeTypeMap = new MIMETypeAssociationMap;
+    mimeTypeMap->add("image/x-ms-bmp", "image/bmp");
+    mimeTypeMap->add("image/x-windows-bmp", "image/bmp");
+    mimeTypeMap->add("image/x-bmp", "image/bmp");
+    mimeTypeMap->add("image/x-bitmap", "image/bmp");
+    mimeTypeMap->add("image/x-ms-bitmap", "image/bmp");
+    mimeTypeMap->add("image/jpg", "image/jpeg");
+    mimeTypeMap->add("image/pjpeg", "image/jpeg");
+    mimeTypeMap->add("image/x-png", "image/png");
+    mimeTypeMap->add("image/vnd.rim.png", "image/png");
+    mimeTypeMap->add("image/ico", "image/vnd.microsoft.icon");
+    mimeTypeMap->add("image/icon", "image/vnd.microsoft.icon");
+    mimeTypeMap->add("text/ico", "image/vnd.microsoft.icon");
+    mimeTypeMap->add("application/ico", "image/vnd.microsoft.icon");
+    mimeTypeMap->add("image/x-icon", "image/vnd.microsoft.icon");
+    mimeTypeMap->add("audio/vnd.qcelp", "audio/qcelp");
+    mimeTypeMap->add("audio/qcp", "audio/qcelp");
+    mimeTypeMap->add("audio/vnd.qcp", "audio/qcelp");
+    mimeTypeMap->add("audio/wav", "audio/x-wav");
+    mimeTypeMap->add("audio/mid", "audio/midi");
+    mimeTypeMap->add("audio/sp-midi", "audio/midi");
+    mimeTypeMap->add("audio/x-mid", "audio/midi");
+    mimeTypeMap->add("audio/x-midi", "audio/midi");
+    mimeTypeMap->add("audio/x-mpeg", "audio/mpeg");
+    mimeTypeMap->add("audio/mp3", "audio/mpeg");
+    mimeTypeMap->add("audio/x-mp3", "audio/mpeg");
+    mimeTypeMap->add("audio/mpeg3", "audio/mpeg");
+    mimeTypeMap->add("audio/x-mpeg3", "audio/mpeg");
+    mimeTypeMap->add("audio/mpg3", "audio/mpeg");
+    mimeTypeMap->add("audio/mpg", "audio/mpeg");
+    mimeTypeMap->add("audio/x-mpg", "audio/mpeg");
+    mimeTypeMap->add("audio/m4a", "audio/mp4");
+    mimeTypeMap->add("audio/x-m4a", "audio/mp4");
+    mimeTypeMap->add("audio/x-mp4", "audio/mp4");
+    mimeTypeMap->add("audio/x-aac", "audio/aac");
+    mimeTypeMap->add("audio/x-amr", "audio/amr");
+    mimeTypeMap->add("audio/mpegurl", "audio/x-mpegurl");
+    mimeTypeMap->add("video/3gp", "video/3gpp");
+    mimeTypeMap->add("video/avi", "video/x-msvideo");
+    mimeTypeMap->add("video/x-m4v", "video/mp4");
+    mimeTypeMap->add("video/x-quicktime", "video/quicktime");
+    mimeTypeMap->add("application/java", "application/java-archive");
+    mimeTypeMap->add("application/x-java-archive", "application/java-archive");
+    mimeTypeMap->add("application/x-zip-compressed", "application/zip");
+
+    return *mimeTypeMap;
+}
+
+static HashSet<String>* s_supportedObjectMIMETypes;
+
+WebSettingsPrivate::WebSettingsPrivate()
+    : impl(0)
+    , delegate(0)
+    , sender(0)
+    , copyOnWrite(true)
+{
+}
+
+WebSettings::WebSettings()
+{
+    m_private = new WebSettingsPrivate();
+}
+
+WebSettings::WebSettings(const WebSettings& otherSettings)
+{
+    m_private->impl = otherSettings.m_private->impl;
+}
+
+WebSettings::~WebSettings()
+{
+    if (!m_private->copyOnWrite) {
+        delete m_private->impl;
+        m_private->impl = 0;
+    }
+    delete m_private;
+    m_private = 0;
+}
+
+void WebSettings::setDelegate(WebSettingsDelegate* delegate)
+{
+    m_private->delegate = delegate;
+    m_private->sender = this;
+}
+
+WebSettingsDelegate* WebSettings::delegate()
+{
+    return m_private->delegate;
+}
+
+WebSettings* WebSettings::createFromStandardSettings(WebSettingsDelegate* delegate)
+{
+    WebSettings* settings = new WebSettings();
+    settings->m_private->impl = standardSettings()->m_private->impl;
+    settings->m_private->delegate = delegate;
+    settings->m_private->sender = settings;
+    if (delegate)
+        delegate->didChangeSettings(settings);
+
+    return settings;
+}
+
+WebSettings* WebSettings::standardSettings()
+{
+    static WebSettings *settings = 0;
+    if (settings)
+        return settings;
+
+    settings = new WebSettings;
+    settings->m_private->impl = new WebSettingsPrivate::WebSettingsPrivateImpl();
+    settings->m_private->copyOnWrite = false;
+    settings->m_private->setUnsigned(BlackBerryBackgroundColor, WebCore::Color::white);
+    settings->m_private->setBoolean(BlackBerryCookiesEnabled, true);
+    settings->m_private->setDouble(BlackBerryInitialScale, -1);
+    settings->m_private->setUnsigned(BlackBerryMaxPluginInstances, 1);
+    settings->m_private->setUnsigned(BlackBerryOverZoomColor, WebCore::Color::white);
+    settings->m_private->setBoolean(BlackBerryScrollbarsEnabled, true);
+
+    // FIXME: We should detect whether we are embedded in a browser or an email client and default to TextReflowEnabledOnlyForBlockZoom and TextReflowEnabled, respectively.
+    settings->m_private->setTextReflowMode(BlackBerryTextReflowMode, TextReflowDisabled);
+
+    settings->m_private->setBoolean(BlackBerryUserScalableEnabled, true);
+    settings->m_private->setBoolean(BlackBerryUseWebKitCache, true);
+    settings->m_private->setBoolean(BlackBerryZoomToFitOnLoadEnabled, true);
+    settings->m_private->setInteger(WebKitDefaultFontSize, 16);
+    settings->m_private->setInteger(WebKitDefaultFixedFontSize, 13);
+    settings->m_private->setInteger(WebKitMinimumFontSize, 8);
+    settings->m_private->setString(WebKitDefaultTextEncodingName, "iso-8859-1");
+    settings->m_private->setInteger(WebKitFirstScheduledLayoutDelay, 250); // Match Document::cLayoutScheduleThreshold.
+    settings->m_private->setBoolean(WebKitJavaScriptEnabled, true);
+    settings->m_private->setBoolean(WebKitLoadsImagesAutomatically, true);
+    settings->m_private->setBoolean(WebKitDownloadableBinaryFontsEnabled, true);
+    settings->m_private->setUnsignedLongLong(WebKitLocalStorageQuota, 5 * 1024 * 1024);
+    settings->m_private->setInteger(WebKitMaximumPagesInCache, 0);
+    settings->m_private->setBoolean(WebKitWebSocketsEnabled, true);
+    settings->m_private->setString(WebKitFixedFontFamily, "Courier New");
+    settings->m_private->setString(WebKitSansSeriffFontFamily, "Arial");
+    settings->m_private->setString(WebKitSeriffFontFamily, "Times New Roman");
+    settings->m_private->setString(WebKitStandardFontFamily, "Times New Roman");
+    settings->m_private->setBoolean(SpatialNavigationEnabled, false);
+
+    return settings;
+}
+
+void WebSettings::addSupportedObjectPluginMIMEType(const char* type)
+{
+    if (!s_supportedObjectMIMETypes)
+        s_supportedObjectMIMETypes = new HashSet<String>;
+
+    s_supportedObjectMIMETypes->add(type);
+}
+
+bool WebSettings::isSupportedObjectMIMEType(const WebString& mimeType)
+{
+    if (mimeType.isEmpty())
+        return false;
+
+    if (!s_supportedObjectMIMETypes)
+        return false;
+
+    return s_supportedObjectMIMETypes->contains(getNormalizedMIMEType(mimeType));
+}
+
+WebString WebSettings::getNormalizedMIMEType(const WebString& type)
+{
+    MIMETypeAssociationMap::const_iterator i = mimeTypeAssociationMap().find(type);
+
+    return i == mimeTypeAssociationMap().end() ? type : i->second;
+}
+
+bool WebSettings::xssAuditorEnabled() const
+{
+    return m_private->getBoolean(WebKitXSSAuditorEnabled);
+}
+
+void WebSettings::setXSSAuditorEnabled(bool enabled)
+{
+    return m_private->setBoolean(WebKitXSSAuditorEnabled, enabled);
+}
+
+bool WebSettings::loadsImagesAutomatically() const
+{
+    return m_private->getBoolean(WebKitLoadsImagesAutomatically);
+}
+
+void WebSettings::setLoadsImagesAutomatically(bool enabled)
+{
+    m_private->setBoolean(WebKitLoadsImagesAutomatically, enabled);
+}
+
+bool WebSettings::downloadableBinaryFontsEnabled() const
+{
+    return m_private->getBoolean(WebKitDownloadableBinaryFontsEnabled);
+}
+
+void WebSettings::setDownloadableBinaryFontsEnabled(bool enabled)
+{
+    return m_private->setBoolean(WebKitDownloadableBinaryFontsEnabled, enabled);
+}
+
+bool WebSettings::shouldDrawBorderWhileLoadingImages() const
+{
+    return m_private->getBoolean(BlackBerryDrawBorderWhileLoadingImages);
+}
+
+void WebSettings::setShouldDrawBorderWhileLoadingImages(bool enabled)
+{
+    m_private->setBoolean(BlackBerryDrawBorderWhileLoadingImages, enabled);
+}
+
+bool WebSettings::isJavaScriptEnabled() const
+{
+    return m_private->getBoolean(WebKitJavaScriptEnabled);
+}
+
+void WebSettings::setJavaScriptEnabled(bool enabled)
+{
+    m_private->setBoolean(WebKitJavaScriptEnabled, enabled);
+}
+
+bool WebSettings::isPrivateBrowsingEnabled() const
+{
+    return m_private->getBoolean(WebKitPrivateBrowsingEnabled);
+}
+
+void WebSettings::setPrivateBrowsingEnabled(bool enabled)
+{
+    m_private->setBoolean(WebKitPrivateBrowsingEnabled, enabled);
+}
+
+int WebSettings::defaultFixedFontSize() const
+{
+    return m_private->getInteger(WebKitDefaultFixedFontSize);
+}
+
+void WebSettings::setDefaultFixedFontSize(int defaultFixedFontSize)
+{
+    m_private->setInteger(WebKitDefaultFixedFontSize, defaultFixedFontSize);
+}
+
+int WebSettings::defaultFontSize() const
+{
+    return m_private->getInteger(WebKitDefaultFontSize);
+}
+
+void WebSettings::setDefaultFontSize(int defaultFontSize)
+{
+    m_private->setInteger(WebKitDefaultFontSize, defaultFontSize);
+}
+
+int WebSettings::minimumFontSize() const
+{
+    return m_private->getInteger(WebKitMinimumFontSize);
+}
+
+void WebSettings::setMinimumFontSize(int minimumFontSize)
+{
+    m_private->setInteger(WebKitMinimumFontSize, minimumFontSize);
+}
+
+WebString WebSettings::serifFontFamily() const
+{
+    return m_private->getString(WebKitSeriffFontFamily);
+}
+
+void WebSettings::setSerifFontFamily(const char* seriffFontFamily)
+{
+    m_private->setString(WebKitSeriffFontFamily, seriffFontFamily);
+}
+
+WebString WebSettings::fixedFontFamily() const
+{
+    return m_private->getString(WebKitFixedFontFamily);
+}
+
+void WebSettings::setFixedFontFamily(const char* fixedFontFamily)
+{
+    m_private->setString(WebKitFixedFontFamily, fixedFontFamily);
+}
+
+WebString WebSettings::sansSerifFontFamily() const
+{
+    return m_private->getString(WebKitSansSeriffFontFamily);
+}
+
+void WebSettings::setSansSerifFontFamily(const char* sansSeriffFontFamily)
+{
+    m_private->setString(WebKitSansSeriffFontFamily, sansSeriffFontFamily);
+}
+
+WebString WebSettings::standardFontFamily() const
+{
+    return m_private->getString(WebKitStandardFontFamily);
+}
+
+void WebSettings::setStandardFontFamily(const char* standardFontFamily)
+{
+    m_private->setString(WebKitStandardFontFamily, standardFontFamily);
+}
+
+WebString WebSettings::userAgentString() const
+{
+    // FIXME: Is this the best place for this assertion. Why can't we just return an empty string
+    // and let the caller decide how to handle it?
+
+    // The default user agent string is empty. We rely upon the client to set this for us.
+    // We check this by asserting if the client has not done so before the first time it is needed.
+    String userAgentString = m_private->getString(BlackBerryUserAgentString);
+    ASSERT(!userAgentString.isEmpty());
+    return userAgentString;
+}
+
+void WebSettings::setUserAgentString(const char* userAgentString)
+{
+    m_private->setString(BlackBerryUserAgentString, userAgentString);
+}
+
+WebString WebSettings::defaultTextEncodingName() const
+{
+    return m_private->getString(WebKitDefaultTextEncodingName);
+}
+
+void WebSettings::setDefaultTextEncodingName(const char* defaultTextEncodingName)
+{
+    m_private->setString(WebKitDefaultTextEncodingName, defaultTextEncodingName);
+}
+
+bool WebSettings::isZoomToFitOnLoad() const
+{
+    return m_private->getBoolean(BlackBerryZoomToFitOnLoadEnabled);
+}
+
+void WebSettings::setZoomToFitOnLoad(bool enabled)
+{
+    m_private->setBoolean(BlackBerryZoomToFitOnLoadEnabled, enabled);
+}
+
+WebSettings::TextReflowMode WebSettings::textReflowMode() const
+{
+    return m_private->getTextReflowMode(BlackBerryTextReflowMode);
+}
+
+void WebSettings::setTextReflowMode(TextReflowMode textReflowMode)
+{
+    m_private->setTextReflowMode(BlackBerryTextReflowMode, textReflowMode);
+}
+
+bool WebSettings::isScrollbarsEnabled() const
+{
+    return m_private->getBoolean(BlackBerryScrollbarsEnabled);
+}
+
+void WebSettings::setScrollbarsEnabled(bool enabled)
+{
+    m_private->setBoolean(BlackBerryScrollbarsEnabled, enabled);
+}
+
+bool WebSettings::canJavaScriptOpenWindowsAutomatically() const
+{
+    return m_private->getBoolean(WebKitJavaScriptCanOpenWindowsAutomaticallyEnabled);
+}
+
+void WebSettings::setJavaScriptOpenWindowsAutomatically(bool enabled)
+{
+    m_private->setBoolean(WebKitJavaScriptCanOpenWindowsAutomaticallyEnabled, enabled);
+}
+
+bool WebSettings::arePluginsEnabled() const
+{
+    return m_private->getBoolean(WebKitPluginsEnabled);
+}
+
+void WebSettings::setPluginsEnabled(bool enabled)
+{
+    m_private->setBoolean(WebKitPluginsEnabled, enabled);
+}
+
+bool WebSettings::isGeolocationEnabled() const
+{
+    return m_private->getBoolean(WebKitGeolocationEnabled);
+}
+
+void WebSettings::setGeolocationEnabled(bool enabled)
+{
+    m_private->setBoolean(WebKitGeolocationEnabled, enabled);
+}
+
+bool WebSettings::doesGetFocusNodeContext() const
+{
+    return m_private->getBoolean(BlackBerryGetFocusNodeContextEnabled);
+}
+
+void WebSettings::setGetFocusNodeContext(bool enabled)
+{
+    m_private->setBoolean(BlackBerryGetFocusNodeContextEnabled, enabled);
+}
+
+WebString WebSettings::userStyleSheetString() const
+{
+    return m_private->getString(WebKitUserStyleSheet);
+}
+
+void WebSettings::setUserStyleSheetString(const char* userStyleSheetString)
+{
+    // FIXME: This doesn't seem like the appropriate place to do this as WebSettings should ideally be a state store.
+    // Either the caller of this function should do this conversion or caller of the getter corresponding to this function
+    // should do this conversion.
+
+    size_t length = strlen(userStyleSheetString);
+    Vector<char> data;
+    data.append(userStyleSheetString, length);
+
+    Vector<char> encodedData;
+    WebCore::base64Encode(data, encodedData);
+
+    const char prefix[] = "data:text/css;charset=utf-8;base64,";
+    size_t prefixLength = sizeof(prefix) - 1;
+    Vector<char> dataURL;
+    dataURL.reserveCapacity(prefixLength + encodedData.size());
+    dataURL.append(prefix, prefixLength);
+    dataURL.append(encodedData);
+    m_private->setString(WebKitUserStyleSheet, String(dataURL.data(), dataURL.size()));
+}
+
+WebString WebSettings::userStyleSheetLocation()
+{
+    return m_private->getString(WebKitUserStyleSheetLocation);
+}
+
+void WebSettings::setUserStyleSheetLocation(const char* userStyleSheetLocation)
+{
+    m_private->setString(WebKitUserStyleSheetLocation, userStyleSheetLocation);
+}
+
+bool WebSettings::areLinksHandledExternally() const
+{
+    return m_private->getBoolean(BlackBerryLinksHandledExternallyEnabled);
+}
+
+void WebSettings::setAreLinksHandledExternally(bool enabled)
+{
+    m_private->setBoolean(BlackBerryLinksHandledExternallyEnabled, enabled);
+}
+
+void WebSettings::setAllowCrossSiteRequests(bool allow)
+{
+    m_private->setBoolean(BlackBerryAllowCrossSiteRequests, allow);
+}
+
+bool WebSettings::allowCrossSiteRequests() const
+{
+    return m_private->getBoolean(BlackBerryAllowCrossSiteRequests);
+}
+
+bool WebSettings::isUserScalable() const
+{
+    return m_private->getBoolean(BlackBerryUserScalableEnabled);
+}
+
+void WebSettings::setUserScalable(bool enabled)
+{
+    m_private->setBoolean(BlackBerryUserScalableEnabled, enabled);
+}
+
+int WebSettings::viewportWidth() const
+{
+    return m_private->getInteger(BlackBerryViewportWidth);
+}
+
+void WebSettings::setViewportWidth(int width)
+{
+    m_private->setInteger(BlackBerryViewportWidth, width);
+}
+
+double WebSettings::initialScale() const
+{
+    return m_private->getDouble(BlackBerryInitialScale);
+}
+
+void WebSettings::setInitialScale(double initialScale)
+{
+    m_private->setDouble(BlackBerryInitialScale, initialScale);
+}
+
+int WebSettings::firstScheduledLayoutDelay() const
+{
+    return m_private->getInteger(WebKitFirstScheduledLayoutDelay);
+}
+
+void WebSettings::setFirstScheduledLayoutDelay(int delay)
+{
+    m_private->setInteger(WebKitFirstScheduledLayoutDelay, delay);
+}
+
+// Whether to include pattern: in the list of string patterns.
+bool WebSettings::shouldHandlePatternUrls() const
+{
+    return m_private->getBoolean(BlackBerryHandlePatternURLs);
+}
+
+void WebSettings::setShouldHandlePatternUrls(bool handlePatternURLs)
+{
+    m_private->setBoolean(BlackBerryHandlePatternURLs, handlePatternURLs);
+}
+
+bool WebSettings::areCookiesEnabled() const
+{
+    return m_private->getBoolean(BlackBerryCookiesEnabled);
+}
+
+void WebSettings::setAreCookiesEnabled(bool enable)
+{
+    m_private->setBoolean(BlackBerryCookiesEnabled, enable);
+}
+
+bool WebSettings::isLocalStorageEnabled() const
+{
+    return m_private->getBoolean(WebKitLocalStorageEnabled);
+}
+
+void WebSettings::setIsLocalStorageEnabled(bool enable)
+{
+    m_private->setBoolean(WebKitLocalStorageEnabled, enable);
+}
+
+bool WebSettings::isDatabasesEnabled() const
+{
+    return m_private->getBoolean(WebKitDatabasesEnabled);
+}
+
+void WebSettings::setIsDatabasesEnabled(bool enable)
+{
+    m_private->setBoolean(WebKitDatabasesEnabled, enable);
+}
+
+bool WebSettings::isAppCacheEnabled() const
+{
+    return m_private->getBoolean(WebKitOfflineWebApplicationCacheEnabled);
+}
+
+void WebSettings::setIsAppCacheEnabled(bool enable)
+{
+    m_private->setBoolean(WebKitOfflineWebApplicationCacheEnabled, enable);
+}
+
+unsigned long long WebSettings::localStorageQuota() const
+{
+    return m_private->getUnsignedLongLong(WebKitLocalStorageQuota);
+}
+
+void WebSettings::setLocalStorageQuota(unsigned long long quota)
+{
+    m_private->setUnsignedLongLong(WebKitLocalStorageQuota, quota);
+}
+
+int WebSettings::maximumPagesInCache() const
+{
+    // FIXME: We shouldn't be calling into WebCore from here. This class should just be a state store.
+    return WebCore::pageCache()->capacity();
+}
+
+void WebSettings::setMaximumPagesInCache(int pages)
+{
+    // FIXME: We shouldn't be calling into WebCore from here. This class should just be a state store.
+    unsigned realPages = std::max(0, pages);
+    WebCore::pageCache()->setCapacity(realPages);
+    m_private->setUnsigned(WebKitMaximumPagesInCache, realPages);
+}
+
+WebString WebSettings::localStoragePath() const
+{
+    return m_private->getString(WebKitLocalStoragePath);
+}
+
+void WebSettings::setLocalStoragePath(const WebString& path)
+{
+    m_private->setString(WebKitLocalStoragePath, path);
+}
+
+WebString WebSettings::databasePath() const
+{
+    return m_private->getString(WebKitDatabasePath);
+}
+
+void WebSettings::setDatabasePath(const WebString& path)
+{
+    m_private->setString(WebKitDatabasePath, path);
+}
+
+WebString WebSettings::appCachePath() const
+{
+    return m_private->getString(WebKitOfflineWebApplicationCachePath);
+}
+
+void WebSettings::setAppCachePath(const WebString& path)
+{
+    m_private->setString(WebKitOfflineWebApplicationCachePath, path);
+}
+
+WebString WebSettings::pageGroupName() const
+{
+    return m_private->getString(WebKitPageGroupName);
+}
+
+void WebSettings::setPageGroupName(const WebString& pageGroupName)
+{
+    m_private->setString(WebKitPageGroupName, pageGroupName);
+}
+
+bool WebSettings::isEmailMode() const
+{
+    return m_private->getBoolean(BlackBerryEmailModeEnabled);
+}
+
+void WebSettings::setEmailMode(bool enable)
+{
+    m_private->setBoolean(BlackBerryEmailModeEnabled, enable);
+}
+
+bool WebSettings::shouldRenderAnimationsOnScrollOrZoom() const
+{
+    return m_private->getBoolean(BlackBerryRenderAnimationsOnScrollOrZoomEnabled);
+}
+
+void WebSettings::setShouldRenderAnimationsOnScrollOrZoom(bool enable)
+{
+    m_private->setBoolean(BlackBerryRenderAnimationsOnScrollOrZoomEnabled, enable);
+}
+
+unsigned WebSettings::overZoomColor() const
+{
+    return m_private->getUnsigned(BlackBerryOverZoomColor);
+}
+
+void WebSettings::setOverZoomColor(unsigned color)
+{
+    m_private->setUnsigned(BlackBerryOverZoomColor, color);
+}
+
+unsigned WebSettings::backgroundColor() const
+{
+    return m_private->getUnsigned(BlackBerryBackgroundColor);
+}
+
+void WebSettings::setBackgroundColor(unsigned color)
+{
+    m_private->setUnsigned(BlackBerryBackgroundColor, color);
+}
+
+bool WebSettings::isWritingDirectionRTL() const
+{
+    return m_private->getBoolean(BlackBerryUseRTLWritingDirection);
+}
+
+void WebSettings::setWritingDirectionRTL(bool useRTLWritingDirection)
+{
+    m_private->setBoolean(BlackBerryUseRTLWritingDirection, useRTLWritingDirection);
+}
+
+bool WebSettings::useWebKitCache() const
+{
+    return m_private->getBoolean(BlackBerryUseWebKitCache);
+}
+
+void WebSettings::setUseWebKitCache(bool useWebKitCache)
+{
+    m_private->setBoolean(BlackBerryUseWebKitCache, useWebKitCache);
+}
+
+bool WebSettings::isFrameFlatteningEnabled() const
+{
+    return m_private->getBoolean(WebKitFrameFlatteningEnabled);
+}
+
+void WebSettings::setFrameFlatteningEnabled(bool enable)
+{
+    m_private->setBoolean(WebKitFrameFlatteningEnabled, enable);
+}
+
+bool WebSettings::isDirectRenderingToWindowEnabled() const
+{
+    return m_private->getBoolean(BlackBerryDirectRenderingToWindowEnabled);
+}
+
+void WebSettings::setDirectRenderingToWindowEnabled(bool enable)
+{
+    m_private->setBoolean(BlackBerryDirectRenderingToWindowEnabled, enable);
+}
+
+unsigned WebSettings::maxPluginInstances() const
+{
+    return m_private->getUnsigned(BlackBerryMaxPluginInstances);
+}
+
+void WebSettings::setMaxPluginInstances(unsigned maxPluginInstances)
+{
+    m_private->setUnsigned(BlackBerryMaxPluginInstances, maxPluginInstances);
+}
+
+bool WebSettings::areWebSocketsEnabled() const
+{
+    return m_private->getBoolean(WebKitWebSocketsEnabled);
+}
+
+void WebSettings::setWebSocketsEnabled(bool enable)
+{
+    m_private->setBoolean(WebKitWebSocketsEnabled, enable);
+}
+
+bool WebSettings::isSpatialNavigationEnabled() const
+{
+    return m_private->getBoolean(SpatialNavigationEnabled);
+}
+
+void WebSettings::setSpatialNavigationEnabled(bool enable)
+{
+    m_private->setBoolean(SpatialNavigationEnabled, enable);
+}
+
+} // namespace WebKit
+} // namespace BlackBerry
diff --git a/Source/WebKit/blackberry/Api/WebSettings.h b/Source/WebKit/blackberry/Api/WebSettings.h
new file mode 100644 (file)
index 0000000..403e8f4
--- /dev/null
@@ -0,0 +1,263 @@
+/*
+ * Copyright (C) 2009, 2010, 2011, 2012 Research In Motion Limited. All rights reserved.
+ *
+ * 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
+ */
+
+#ifndef WebSettings_h
+#define WebSettings_h
+
+#include "BlackBerryGlobal.h"
+
+namespace BlackBerry {
+namespace WebKit {
+
+class WebSettings;
+class WebSettingsPrivate;
+
+/*!
+    @struct WebSettingsDelegate
+    Defines the methods that must be implemented by a delegate of WebSettings.
+*/
+struct BLACKBERRY_EXPORT WebSettingsDelegate {
+    virtual ~WebSettingsDelegate() { }
+
+    /*!
+        Sent when the value of a setting changed as well as on instantiation of a WebSettings object.
+        @param settings The WebSettings object that sent the message.
+    */
+    virtual void didChangeSettings(WebSettings*) = 0;
+};
+
+/*!
+    @class WebSettings
+*/
+class BLACKBERRY_EXPORT WebSettings {
+public:
+    static WebSettings* createFromStandardSettings(WebSettingsDelegate* = 0);
+    ~WebSettings();
+
+    static WebSettings* standardSettings();
+
+    void setDelegate(WebSettingsDelegate*);
+    WebSettingsDelegate* delegate();
+
+    static void addSupportedObjectPluginMIMEType(const char*);
+    static bool isSupportedObjectMIMEType(const WebString&);
+    static WebString getNormalizedMIMEType(const WebString&);
+
+    bool xssAuditorEnabled() const;
+    void setXSSAuditorEnabled(bool);
+
+    bool loadsImagesAutomatically() const;
+    void setLoadsImagesAutomatically(bool);
+
+    bool shouldDrawBorderWhileLoadingImages() const;
+    void setShouldDrawBorderWhileLoadingImages(bool);
+
+    bool isJavaScriptEnabled() const;
+    void setJavaScriptEnabled(bool);
+
+    bool isPrivateBrowsingEnabled() const;
+    void setPrivateBrowsingEnabled(bool);
+
+    int defaultFixedFontSize() const;
+    void setDefaultFixedFontSize(int);
+
+    int defaultFontSize() const;
+    void setDefaultFontSize(int);
+
+    int minimumFontSize() const;
+    void setMinimumFontSize(int);
+
+    WebString serifFontFamily() const;
+    void setSerifFontFamily(const char*);
+    WebString fixedFontFamily() const;
+    void setFixedFontFamily(const char*);
+    WebString sansSerifFontFamily() const;
+    void setSansSerifFontFamily(const char*);
+    WebString standardFontFamily() const;
+    void setStandardFontFamily(const char*);
+
+    void setDownloadableBinaryFontsEnabled(bool);
+    bool downloadableBinaryFontsEnabled() const;
+
+    WebString userAgentString() const;
+    void setUserAgentString(const char*);
+
+    WebString defaultTextEncodingName() const;
+    void setDefaultTextEncodingName(const char*);
+
+    bool isZoomToFitOnLoad() const;
+    void setZoomToFitOnLoad(bool);
+
+    enum TextReflowMode { TextReflowDisabled, TextReflowEnabled, TextReflowEnabledOnlyForBlockZoom };
+    TextReflowMode textReflowMode() const;
+    void setTextReflowMode(TextReflowMode);
+
+    bool isScrollbarsEnabled() const;
+    void setScrollbarsEnabled(bool);
+
+    // FIXME: Consider renaming this method upstream, where it is called javaScriptCanOpenWindowsAutomatically.
+    bool canJavaScriptOpenWindowsAutomatically() const;
+    void setJavaScriptOpenWindowsAutomatically(bool);
+
+    bool arePluginsEnabled() const;
+    void setPluginsEnabled(bool);
+
+    bool isGeolocationEnabled() const;
+    void setGeolocationEnabled(bool);
+
+    // Context info
+    bool doesGetFocusNodeContext() const;
+    void setGetFocusNodeContext(bool);
+
+    WebString userStyleSheetString() const;
+    void setUserStyleSheetString(const char*);
+
+    WebString userStyleSheetLocation();
+    void setUserStyleSheetLocation(const char*);
+
+    // External link handlers
+    bool areLinksHandledExternally() const;
+    void setAreLinksHandledExternally(bool);
+
+    // BrowserField2 settings
+    void setAllowCrossSiteRequests(bool);
+    bool allowCrossSiteRequests() const;
+    bool isUserScalable() const;
+    void setUserScalable(bool);
+    int viewportWidth() const;
+    void setViewportWidth(int);
+    double initialScale() const;
+    void setInitialScale(double);
+
+    int firstScheduledLayoutDelay() const;
+    void setFirstScheduledLayoutDelay(int);
+
+    // Whether to include pattern: in the list of string patterns.
+    bool shouldHandlePatternUrls() const;
+    void setShouldHandlePatternUrls(bool);
+
+    bool areCookiesEnabled() const;
+    void setAreCookiesEnabled(bool);
+
+    // Web storage settings
+    bool isLocalStorageEnabled() const;
+    void setIsLocalStorageEnabled(bool);
+
+    bool isDatabasesEnabled() const;
+    void setIsDatabasesEnabled(bool);
+
+    bool isAppCacheEnabled() const;
+    void setIsAppCacheEnabled(bool);
+
+    unsigned long long localStorageQuota() const;
+    void setLocalStorageQuota(unsigned long long);
+
+    // Page cache
+    void setMaximumPagesInCache(int);
+    int maximumPagesInCache() const;
+
+    WebString localStoragePath() const;
+    void setLocalStoragePath(const WebString&);
+
+    WebString databasePath() const;
+    void setDatabasePath(const WebString&);
+
+    WebString appCachePath() const;
+    void setAppCachePath(const WebString&);
+
+    WebString pageGroupName() const;
+    void setPageGroupName(const WebString&);
+
+    // FIXME: We shouldn't have an email mode. Instead, we should expose all email-related settings
+    // so that the email client can toggle them directly.
+    bool isEmailMode() const;
+    void setEmailMode(bool enable);
+
+    bool shouldRenderAnimationsOnScrollOrZoom() const;
+    void setShouldRenderAnimationsOnScrollOrZoom(bool enable);
+
+    unsigned overZoomColor() const;
+    void setOverZoomColor(unsigned);
+
+    unsigned backgroundColor() const;
+    void setBackgroundColor(unsigned);
+
+    bool isWritingDirectionRTL() const;
+    void setWritingDirectionRTL(bool);
+
+    bool useWebKitCache() const;
+    void setUseWebKitCache(bool);
+
+    bool isFrameFlatteningEnabled() const;
+    void setFrameFlatteningEnabled(bool);
+
+    bool isDirectRenderingToWindowEnabled() const;
+    void setDirectRenderingToWindowEnabled(bool);
+
+    unsigned maxPluginInstances() const;
+    void setMaxPluginInstances(unsigned num);
+
+    bool areWebSocketsEnabled() const;
+    void setWebSocketsEnabled(bool);
+
+    bool isSpatialNavigationEnabled() const;
+    void setSpatialNavigationEnabled(bool);
+
+private:
+    WebSettingsPrivate* m_private;
+    WebSettings();
+    WebSettings(const WebSettings&);
+};
+
+/*!
+    @class WebSettingsTransaction
+    Defines a scope guard that suppresses didChangeSettings messages within its scope.
+    On destruction the guarded WebSettings object will dispatch exactly one didChangeSettings message.
+*/
+class BLACKBERRY_EXPORT WebSettingsTransaction {
+public:
+    WebSettingsTransaction(WebSettings* settings)
+        : m_settings(settings)
+        , m_savedDelegate(0)
+    {
+        if (!settings)
+            return;
+        m_savedDelegate = settings->delegate();
+        settings->setDelegate(0);
+    }
+
+    ~WebSettingsTransaction()
+    {
+        if (!m_settings || !m_savedDelegate)
+            return;
+        m_settings->setDelegate(m_savedDelegate);
+        m_savedDelegate->didChangeSettings(m_settings);
+    }
+
+private:
+    WebSettingsTransaction(const WebSettingsTransaction&);
+    WebSettingsTransaction& operator=(const WebSettingsTransaction&);
+
+    WebSettings* m_settings;
+    WebSettingsDelegate* m_savedDelegate;
+};
+
+} // namespace WebKit
+} // namespace BlackBerry
+
+#endif // WebSettings_h
diff --git a/Source/WebKit/blackberry/Api/WebSettings_p.h b/Source/WebKit/blackberry/Api/WebSettings_p.h
new file mode 100644 (file)
index 0000000..7f9e233
--- /dev/null
@@ -0,0 +1,114 @@
+/*
+ * Copyright (C) 2009, 2010, 2011, 2012 Research In Motion Limited. All rights reserved.
+ *
+ * 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
+ */
+
+#ifndef WebSettings_p_h
+#define WebSettings_p_h
+
+#include "WebSettings.h"
+
+#include <wtf/HashMap.h>
+#include <wtf/text/StringHash.h>
+
+#define synthesizeAccessorsForPrimitiveValuePrefixAndType(prefix, type) \
+     void set##prefix(const String& key, type newValue) { \
+         ASSERT(impl); \
+         if (get##prefix(key) == newValue) \
+            return; \
+         if (copyOnWrite) { \
+            copyOnWrite = false; \
+            impl = new WebSettingsPrivateImpl(*impl); \
+         } \
+         PrimitiveValue primitiveValue; \
+         primitiveValue.prefix##Value = newValue; \
+         impl->primitiveValues.set(key, primitiveValue); \
+         if (delegate) \
+            delegate->didChangeSettings(sender); \
+     } \
+     type get##prefix(const String& key) const { \
+          ASSERT(impl); \
+          if (!impl->primitiveValues.contains(key)) \
+              return static_cast<type>(false); \
+          return impl->primitiveValues.get(key).prefix##Value; \
+      }
+
+namespace BlackBerry {
+namespace WebKit {
+
+struct WebSettingsPrivate {
+    union PrimitiveValue {
+        WebSettings::TextReflowMode TextReflowModeValue;
+        bool BooleanValue;
+        double DoubleValue;
+        int IntegerValue;
+        unsigned UnsignedValue;
+        unsigned long long UnsignedLongLongValue;
+    };
+
+    struct WebSettingsPrivateImpl {
+        HashMap<String, PrimitiveValue> primitiveValues;
+        HashMap<String, String> stringValues;
+    };
+
+    WebSettingsPrivateImpl* impl;
+    WebSettingsDelegate* delegate;
+    WebSettings* sender;
+    bool copyOnWrite;
+
+    WebSettingsPrivate();
+
+    synthesizeAccessorsForPrimitiveValuePrefixAndType(TextReflowMode, WebSettings::TextReflowMode);
+
+    synthesizeAccessorsForPrimitiveValuePrefixAndType(Boolean, bool);
+
+    synthesizeAccessorsForPrimitiveValuePrefixAndType(Double, double);
+
+    synthesizeAccessorsForPrimitiveValuePrefixAndType(Integer, int);
+
+    synthesizeAccessorsForPrimitiveValuePrefixAndType(Unsigned, unsigned);
+
+    synthesizeAccessorsForPrimitiveValuePrefixAndType(UnsignedLongLong, unsigned long long);
+
+    String getString(const String& key) const
+    {
+        ASSERT(impl);
+        if (!impl->stringValues.contains(key))
+            return String();
+        return impl->stringValues.get(key);
+    }
+
+    void setString(const String& key, const String& newValue)
+    {
+        ASSERT(impl);
+        if (getString(key) == newValue)
+            return;
+
+        if (copyOnWrite) {
+            copyOnWrite = false;
+            impl = new WebSettingsPrivateImpl(*impl);
+        }
+
+        impl->stringValues.set(key, newValue);
+        if (delegate)
+            delegate->didChangeSettings(sender);
+    }
+};
+
+} // namespace WebKit
+} // namespace BlackBerry
+
+#endif // WebSettings_p_h