~ubuntu-branches/ubuntu/raring/qtwebkit-source/raring-proposed

« back to all changes in this revision

Viewing changes to Source/WebKit/blackberry/Api/WebSettings.h

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2013-02-18 14:24:18 UTC
  • Revision ID: package-import@ubuntu.com-20130218142418-eon0jmjg3nj438uy
Tags: upstream-2.3
ImportĀ upstreamĀ versionĀ 2.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2009, 2010, 2011, 2012 Research In Motion Limited. All rights reserved.
 
3
 *
 
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.
 
8
 *
 
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.
 
13
 *
 
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
 
17
 */
 
18
 
 
19
#ifndef WebSettings_h
 
20
#define WebSettings_h
 
21
 
 
22
#include "BlackBerryGlobal.h"
 
23
 
 
24
namespace BlackBerry {
 
25
namespace WebKit {
 
26
 
 
27
class WebSettings;
 
28
class WebSettingsPrivate;
 
29
 
 
30
/*!
 
31
    @struct WebSettingsDelegate
 
32
    Defines the methods that must be implemented by a delegate of WebSettings.
 
33
*/
 
34
struct BLACKBERRY_EXPORT WebSettingsDelegate {
 
35
    virtual ~WebSettingsDelegate() { }
 
36
 
 
37
    /*!
 
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.
 
40
    */
 
41
    virtual void didChangeSettings(WebSettings*) = 0;
 
42
};
 
43
 
 
44
/*!
 
45
    @class WebSettings
 
46
*/
 
47
class BLACKBERRY_EXPORT WebSettings {
 
48
public:
 
49
    static WebSettings* createFromStandardSettings(WebSettingsDelegate* = 0);
 
50
    ~WebSettings();
 
51
 
 
52
    static WebSettings* standardSettings();
 
53
 
 
54
    void setDelegate(WebSettingsDelegate*);
 
55
    WebSettingsDelegate* delegate();
 
56
 
 
57
    static void addSupportedObjectPluginMIMEType(const BlackBerry::Platform::String&);
 
58
    static bool isSupportedObjectMIMEType(const BlackBerry::Platform::String&);
 
59
 
 
60
    bool xssAuditorEnabled() const;
 
61
    void setXSSAuditorEnabled(bool);
 
62
 
 
63
    bool loadsImagesAutomatically() const;
 
64
    void setLoadsImagesAutomatically(bool);
 
65
 
 
66
    bool shouldDrawBorderWhileLoadingImages() const;
 
67
    void setShouldDrawBorderWhileLoadingImages(bool);
 
68
 
 
69
    bool isJavaScriptEnabled() const;
 
70
    void setJavaScriptEnabled(bool);
 
71
 
 
72
    bool isPrivateBrowsingEnabled() const;
 
73
    void setPrivateBrowsingEnabled(bool);
 
74
 
 
75
    void setDeviceSupportsMouse(bool);
 
76
    bool deviceSupportsMouse() const;
 
77
 
 
78
    int defaultFixedFontSize() const;
 
79
    void setDefaultFixedFontSize(int);
 
80
 
 
81
    int defaultFontSize() const;
 
82
    void setDefaultFontSize(int);
 
83
 
 
84
    int minimumFontSize() const;
 
85
    void setMinimumFontSize(int);
 
86
 
 
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&);
 
95
 
 
96
    void setDownloadableBinaryFontsEnabled(bool);
 
97
    bool downloadableBinaryFontsEnabled() const;
 
98
 
 
99
    BlackBerry::Platform::String userAgentString() const;
 
100
    void setUserAgentString(const BlackBerry::Platform::String&);
 
101
 
 
102
    BlackBerry::Platform::String defaultTextEncodingName() const;
 
103
    void setDefaultTextEncodingName(const BlackBerry::Platform::String&);
 
104
 
 
105
    bool isZoomToFitOnLoad() const;
 
106
    void setZoomToFitOnLoad(bool);
 
107
 
 
108
    enum TextReflowMode { TextReflowDisabled, TextReflowEnabled, TextReflowEnabledOnlyForBlockZoom };
 
109
    TextReflowMode textReflowMode() const;
 
110
    void setTextReflowMode(TextReflowMode);
 
111
 
 
112
    bool isScrollbarsEnabled() const;
 
113
    void setScrollbarsEnabled(bool);
 
114
 
 
115
    // FIXME: Consider renaming this method upstream, where it is called javaScriptCanOpenWindowsAutomatically.
 
116
    bool canJavaScriptOpenWindowsAutomatically() const;
 
117
    void setJavaScriptOpenWindowsAutomatically(bool);
 
118
 
 
119
    bool arePluginsEnabled() const;
 
120
    void setPluginsEnabled(bool);
 
121
 
 
122
    bool isGeolocationEnabled() const;
 
123
    void setGeolocationEnabled(bool);
 
124
 
 
125
    // Context info
 
126
    bool doesGetFocusNodeContext() const;
 
127
    void setGetFocusNodeContext(bool);
 
128
 
 
129
    BlackBerry::Platform::String userStyleSheetLocation();
 
130
    void setUserStyleSheetLocation(const BlackBerry::Platform::String&);
 
131
 
 
132
    // External link handlers
 
133
    bool areLinksHandledExternally() const;
 
134
    void setAreLinksHandledExternally(bool);
 
135
 
 
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);
 
145
 
 
146
    int firstScheduledLayoutDelay() const;
 
147
    void setFirstScheduledLayoutDelay(int);
 
148
 
 
149
    // Whether to include pattern: in the list of string patterns.
 
150
    bool shouldHandlePatternUrls() const;
 
151
    void setShouldHandlePatternUrls(bool);
 
152
 
 
153
    bool areCookiesEnabled() const;
 
154
    void setAreCookiesEnabled(bool);
 
155
 
 
156
    // Web storage settings
 
157
    bool isLocalStorageEnabled() const;
 
158
    void setIsLocalStorageEnabled(bool);
 
159
 
 
160
    bool isDatabasesEnabled() const;
 
161
    void setIsDatabasesEnabled(bool);
 
162
 
 
163
    bool isAppCacheEnabled() const;
 
164
    void setIsAppCacheEnabled(bool);
 
165
 
 
166
    unsigned long long localStorageQuota() const;
 
167
    void setLocalStorageQuota(unsigned long long);
 
168
    unsigned long long sessionStorageQuota() const;
 
169
    void setSessionStorageQuota(unsigned long long);
 
170
 
 
171
    // Page cache
 
172
    void setMaximumPagesInCache(int);
 
173
    int maximumPagesInCache() const;
 
174
 
 
175
    BlackBerry::Platform::String localStoragePath() const;
 
176
    void setLocalStoragePath(const BlackBerry::Platform::String&);
 
177
 
 
178
    BlackBerry::Platform::String indexedDataBasePath() const;
 
179
    void setIndexedDataBasePath(const BlackBerry::Platform::String&);
 
180
 
 
181
    BlackBerry::Platform::String databasePath() const;
 
182
    void setDatabasePath(const BlackBerry::Platform::String&);
 
183
 
 
184
    BlackBerry::Platform::String appCachePath() const;
 
185
    void setAppCachePath(const BlackBerry::Platform::String&);
 
186
 
 
187
    BlackBerry::Platform::String pageGroupName() const;
 
188
    void setPageGroupName(const BlackBerry::Platform::String&);
 
189
 
 
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);
 
194
 
 
195
    bool shouldRenderAnimationsOnScrollOrZoom() const;
 
196
    void setShouldRenderAnimationsOnScrollOrZoom(bool enable);
 
197
 
 
198
    unsigned overScrollColor() const;
 
199
    void setOverScrollColor(unsigned);
 
200
 
 
201
    bool isEnableDefaultOverScrollBackground() const;
 
202
    void setEnableDefaultOverScrollBackground(bool);
 
203
 
 
204
    unsigned backgroundColor() const;
 
205
    void setBackgroundColor(unsigned);
 
206
 
 
207
    bool isWritingDirectionRTL() const;
 
208
    void setWritingDirectionRTL(bool);
 
209
 
 
210
    bool useWebKitCache() const;
 
211
    void setUseWebKitCache(bool);
 
212
 
 
213
    bool isFrameFlatteningEnabled() const;
 
214
    void setFrameFlatteningEnabled(bool);
 
215
 
 
216
    bool isDirectRenderingToWindowEnabled() const;
 
217
    void setDirectRenderingToWindowEnabled(bool);
 
218
 
 
219
    unsigned maxPluginInstances() const;
 
220
    void setMaxPluginInstances(unsigned num);
 
221
 
 
222
    bool areWebSocketsEnabled() const;
 
223
    void setWebSocketsEnabled(bool);
 
224
 
 
225
    bool isSpatialNavigationEnabled() const;
 
226
    void setSpatialNavigationEnabled(bool);
 
227
 
 
228
    bool isAsynchronousSpellCheckingEnabled() const;
 
229
    void setAsynchronousSpellCheckingEnabled(bool) const;
 
230
 
 
231
    bool fullScreenVideoCapable() const;
 
232
    void setFullScreenVideoCapable(bool);
 
233
 
 
234
    bool isCredentialAutofillEnabled() const;
 
235
    void setCredentialAutofillEnabled(bool);
 
236
 
 
237
    bool isFormAutofillEnabled() const;
 
238
    void setFormAutofillEnabled(bool);
 
239
 
 
240
    double devicePixelRatio() const;
 
241
    void setDevicePixelRatio(double);
 
242
 
 
243
private:
 
244
    WebSettingsPrivate* m_private;
 
245
    WebSettings();
 
246
    WebSettings(const WebSettings&);
 
247
};
 
248
 
 
249
/*!
 
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.
 
253
*/
 
254
class BLACKBERRY_EXPORT WebSettingsTransaction {
 
255
public:
 
256
    WebSettingsTransaction(WebSettings* settings)
 
257
        : m_settings(settings)
 
258
        , m_savedDelegate(0)
 
259
    {
 
260
        if (!settings)
 
261
            return;
 
262
        m_savedDelegate = settings->delegate();
 
263
        settings->setDelegate(0);
 
264
    }
 
265
 
 
266
    ~WebSettingsTransaction()
 
267
    {
 
268
        if (!m_settings || !m_savedDelegate)
 
269
            return;
 
270
        m_settings->setDelegate(m_savedDelegate);
 
271
        m_savedDelegate->didChangeSettings(m_settings);
 
272
    }
 
273
 
 
274
private:
 
275
    WebSettingsTransaction(const WebSettingsTransaction&);
 
276
    WebSettingsTransaction& operator=(const WebSettingsTransaction&);
 
277
 
 
278
    WebSettings* m_settings;
 
279
    WebSettingsDelegate* m_savedDelegate;
 
280
};
 
281
 
 
282
} // namespace WebKit
 
283
} // namespace BlackBerry
 
284
 
 
285
#endif // WebSettings_h