2
* Copyright (C) 2009, 2010, 2011, 2012 Research In Motion Limited. All rights reserved.
4
* This library is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU Lesser General Public
6
* License as published by the Free Software Foundation; either
7
* version 2 of the License, or (at your option) any later version.
9
* This library is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
* Lesser General Public License for more details.
14
* You should have received a copy of the GNU Lesser General Public
15
* License along with this library; if not, write to the Free Software
16
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22
#include "BlackBerryGlobal.h"
24
namespace BlackBerry {
28
class WebSettingsPrivate;
31
@struct WebSettingsDelegate
32
Defines the methods that must be implemented by a delegate of WebSettings.
34
struct BLACKBERRY_EXPORT WebSettingsDelegate {
35
virtual ~WebSettingsDelegate() { }
38
Sent when the value of a setting changed as well as on instantiation of a WebSettings object.
39
@param settings The WebSettings object that sent the message.
41
virtual void didChangeSettings(WebSettings*) = 0;
47
class BLACKBERRY_EXPORT WebSettings {
49
static WebSettings* createFromStandardSettings(WebSettingsDelegate* = 0);
52
static WebSettings* standardSettings();
54
void setDelegate(WebSettingsDelegate*);
55
WebSettingsDelegate* delegate();
57
static void addSupportedObjectPluginMIMEType(const BlackBerry::Platform::String&);
58
static bool isSupportedObjectMIMEType(const BlackBerry::Platform::String&);
60
bool xssAuditorEnabled() const;
61
void setXSSAuditorEnabled(bool);
63
bool loadsImagesAutomatically() const;
64
void setLoadsImagesAutomatically(bool);
66
bool shouldDrawBorderWhileLoadingImages() const;
67
void setShouldDrawBorderWhileLoadingImages(bool);
69
bool isJavaScriptEnabled() const;
70
void setJavaScriptEnabled(bool);
72
bool isPrivateBrowsingEnabled() const;
73
void setPrivateBrowsingEnabled(bool);
75
void setDeviceSupportsMouse(bool);
76
bool deviceSupportsMouse() const;
78
int defaultFixedFontSize() const;
79
void setDefaultFixedFontSize(int);
81
int defaultFontSize() const;
82
void setDefaultFontSize(int);
84
int minimumFontSize() const;
85
void setMinimumFontSize(int);
87
BlackBerry::Platform::String serifFontFamily() const;
88
void setSerifFontFamily(const BlackBerry::Platform::String&);
89
BlackBerry::Platform::String fixedFontFamily() const;
90
void setFixedFontFamily(const BlackBerry::Platform::String&);
91
BlackBerry::Platform::String sansSerifFontFamily() const;
92
void setSansSerifFontFamily(const BlackBerry::Platform::String&);
93
BlackBerry::Platform::String standardFontFamily() const;
94
void setStandardFontFamily(const BlackBerry::Platform::String&);
96
void setDownloadableBinaryFontsEnabled(bool);
97
bool downloadableBinaryFontsEnabled() const;
99
BlackBerry::Platform::String userAgentString() const;
100
void setUserAgentString(const BlackBerry::Platform::String&);
102
BlackBerry::Platform::String defaultTextEncodingName() const;
103
void setDefaultTextEncodingName(const BlackBerry::Platform::String&);
105
bool isZoomToFitOnLoad() const;
106
void setZoomToFitOnLoad(bool);
108
enum TextReflowMode { TextReflowDisabled, TextReflowEnabled, TextReflowEnabledOnlyForBlockZoom };
109
TextReflowMode textReflowMode() const;
110
void setTextReflowMode(TextReflowMode);
112
bool isScrollbarsEnabled() const;
113
void setScrollbarsEnabled(bool);
115
// FIXME: Consider renaming this method upstream, where it is called javaScriptCanOpenWindowsAutomatically.
116
bool canJavaScriptOpenWindowsAutomatically() const;
117
void setJavaScriptOpenWindowsAutomatically(bool);
119
bool arePluginsEnabled() const;
120
void setPluginsEnabled(bool);
122
bool isGeolocationEnabled() const;
123
void setGeolocationEnabled(bool);
126
bool doesGetFocusNodeContext() const;
127
void setGetFocusNodeContext(bool);
129
BlackBerry::Platform::String userStyleSheetLocation();
130
void setUserStyleSheetLocation(const BlackBerry::Platform::String&);
132
// External link handlers
133
bool areLinksHandledExternally() const;
134
void setAreLinksHandledExternally(bool);
136
// BrowserField2 settings
137
void setAllowCrossSiteRequests(bool);
138
bool allowCrossSiteRequests() const;
139
bool isUserScalable() const;
140
void setUserScalable(bool);
141
int viewportWidth() const;
142
void setViewportWidth(int);
143
double initialScale() const;
144
void setInitialScale(double);
146
int firstScheduledLayoutDelay() const;
147
void setFirstScheduledLayoutDelay(int);
149
// Whether to include pattern: in the list of string patterns.
150
bool shouldHandlePatternUrls() const;
151
void setShouldHandlePatternUrls(bool);
153
bool areCookiesEnabled() const;
154
void setAreCookiesEnabled(bool);
156
// Web storage settings
157
bool isLocalStorageEnabled() const;
158
void setIsLocalStorageEnabled(bool);
160
bool isDatabasesEnabled() const;
161
void setIsDatabasesEnabled(bool);
163
bool isAppCacheEnabled() const;
164
void setIsAppCacheEnabled(bool);
166
unsigned long long localStorageQuota() const;
167
void setLocalStorageQuota(unsigned long long);
168
unsigned long long sessionStorageQuota() const;
169
void setSessionStorageQuota(unsigned long long);
172
void setMaximumPagesInCache(int);
173
int maximumPagesInCache() const;
175
BlackBerry::Platform::String localStoragePath() const;
176
void setLocalStoragePath(const BlackBerry::Platform::String&);
178
BlackBerry::Platform::String indexedDataBasePath() const;
179
void setIndexedDataBasePath(const BlackBerry::Platform::String&);
181
BlackBerry::Platform::String databasePath() const;
182
void setDatabasePath(const BlackBerry::Platform::String&);
184
BlackBerry::Platform::String appCachePath() const;
185
void setAppCachePath(const BlackBerry::Platform::String&);
187
BlackBerry::Platform::String pageGroupName() const;
188
void setPageGroupName(const BlackBerry::Platform::String&);
190
// FIXME: We shouldn't have an email mode. Instead, we should expose all email-related settings
191
// so that the email client can toggle them directly.
192
bool isEmailMode() const;
193
void setEmailMode(bool enable);
195
bool shouldRenderAnimationsOnScrollOrZoom() const;
196
void setShouldRenderAnimationsOnScrollOrZoom(bool enable);
198
unsigned overScrollColor() const;
199
void setOverScrollColor(unsigned);
201
bool isEnableDefaultOverScrollBackground() const;
202
void setEnableDefaultOverScrollBackground(bool);
204
unsigned backgroundColor() const;
205
void setBackgroundColor(unsigned);
207
bool isWritingDirectionRTL() const;
208
void setWritingDirectionRTL(bool);
210
bool useWebKitCache() const;
211
void setUseWebKitCache(bool);
213
bool isFrameFlatteningEnabled() const;
214
void setFrameFlatteningEnabled(bool);
216
bool isDirectRenderingToWindowEnabled() const;
217
void setDirectRenderingToWindowEnabled(bool);
219
unsigned maxPluginInstances() const;
220
void setMaxPluginInstances(unsigned num);
222
bool areWebSocketsEnabled() const;
223
void setWebSocketsEnabled(bool);
225
bool isSpatialNavigationEnabled() const;
226
void setSpatialNavigationEnabled(bool);
228
bool isAsynchronousSpellCheckingEnabled() const;
229
void setAsynchronousSpellCheckingEnabled(bool) const;
231
bool fullScreenVideoCapable() const;
232
void setFullScreenVideoCapable(bool);
234
bool isCredentialAutofillEnabled() const;
235
void setCredentialAutofillEnabled(bool);
237
bool isFormAutofillEnabled() const;
238
void setFormAutofillEnabled(bool);
240
double devicePixelRatio() const;
241
void setDevicePixelRatio(double);
244
WebSettingsPrivate* m_private;
246
WebSettings(const WebSettings&);
250
@class WebSettingsTransaction
251
Defines a scope guard that suppresses didChangeSettings messages within its scope.
252
On destruction the guarded WebSettings object will dispatch exactly one didChangeSettings message.
254
class BLACKBERRY_EXPORT WebSettingsTransaction {
256
WebSettingsTransaction(WebSettings* settings)
257
: m_settings(settings)
262
m_savedDelegate = settings->delegate();
263
settings->setDelegate(0);
266
~WebSettingsTransaction()
268
if (!m_settings || !m_savedDelegate)
270
m_settings->setDelegate(m_savedDelegate);
271
m_savedDelegate->didChangeSettings(m_settings);
275
WebSettingsTransaction(const WebSettingsTransaction&);
276
WebSettingsTransaction& operator=(const WebSettingsTransaction&);
278
WebSettings* m_settings;
279
WebSettingsDelegate* m_savedDelegate;
282
} // namespace WebKit
283
} // namespace BlackBerry
285
#endif // WebSettings_h