]>
Commit | Line | Data |
---|---|---|
a90939db JF |
1 | /* |
2 | * Copyright (C) 2003, 2006, 2007, 2008 Apple Inc. All rights reserved. | |
3 | * (C) 2006 Graham Dennis (graham.dennis@gmail.com) | |
4 | * | |
5 | * Redistribution and use in source and binary forms, with or without | |
6 | * modification, are permitted provided that the following conditions | |
7 | * are met: | |
8 | * 1. Redistributions of source code must retain the above copyright | |
9 | * notice, this list of conditions and the following disclaimer. | |
10 | * 2. Redistributions in binary form must reproduce the above copyright | |
11 | * notice, this list of conditions and the following disclaimer in the | |
12 | * documentation and/or other materials provided with the distribution. | |
13 | * | |
14 | * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY | |
15 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
16 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
17 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR | |
18 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
19 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
20 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
21 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | |
22 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
24 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
25 | */ | |
26 | ||
27 | #ifndef Settings_h | |
28 | #define Settings_h | |
29 | ||
30 | #include "AtomicString.h" | |
31 | #include "FontDescription.h" | |
32 | #include "KURL.h" | |
33 | ||
34 | #include "Document.h" | |
35 | ||
36 | namespace WebCore { | |
37 | ||
38 | class Page; | |
39 | ||
40 | enum EditableLinkBehavior { | |
41 | EditableLinkDefaultBehavior = 0, | |
42 | EditableLinkAlwaysLive, | |
43 | EditableLinkOnlyLiveWithShiftKey, | |
44 | EditableLinkLiveWhenNotFocused, | |
45 | EditableLinkNeverLive | |
46 | }; | |
47 | ||
48 | enum TextDirectionSubmenuInclusionBehavior { | |
49 | TextDirectionSubmenuNeverIncluded, | |
50 | TextDirectionSubmenuAutomaticallyIncluded, | |
51 | TextDirectionSubmenuAlwaysIncluded | |
52 | }; | |
53 | ||
54 | class Settings { | |
55 | public: | |
56 | Settings(Page*); | |
57 | ||
58 | void setStandardFontFamily(const AtomicString&); | |
59 | const AtomicString& standardFontFamily() const { return m_standardFontFamily; } | |
60 | ||
61 | void setFixedFontFamily(const AtomicString&); | |
62 | const AtomicString& fixedFontFamily() const { return m_fixedFontFamily; } | |
63 | ||
64 | void setSerifFontFamily(const AtomicString&); | |
65 | const AtomicString& serifFontFamily() const { return m_serifFontFamily; } | |
66 | ||
67 | void setSansSerifFontFamily(const AtomicString&); | |
68 | const AtomicString& sansSerifFontFamily() const { return m_sansSerifFontFamily; } | |
69 | ||
70 | void setCursiveFontFamily(const AtomicString&); | |
71 | const AtomicString& cursiveFontFamily() const { return m_cursiveFontFamily; } | |
72 | ||
73 | void setFantasyFontFamily(const AtomicString&); | |
74 | const AtomicString& fantasyFontFamily() const { return m_fantasyFontFamily; } | |
75 | ||
76 | void setMinimumFontSize(int); | |
77 | int minimumFontSize() const { return m_minimumFontSize; } | |
78 | ||
79 | void setMinimumLogicalFontSize(int); | |
80 | int minimumLogicalFontSize() const { return m_minimumLogicalFontSize; } | |
81 | ||
82 | void setDefaultFontSize(int); | |
83 | int defaultFontSize() const { return m_defaultFontSize; } | |
84 | ||
85 | void setDefaultFixedFontSize(int); | |
86 | int defaultFixedFontSize() const { return m_defaultFixedFontSize; } | |
87 | ||
88 | void setLoadsImagesAutomatically(bool); | |
89 | bool loadsImagesAutomatically() const { return m_loadsImagesAutomatically; } | |
90 | ||
91 | void setJavaScriptEnabled(bool); | |
92 | bool isJavaScriptEnabled() const { return m_isJavaScriptEnabled; } | |
93 | ||
94 | void setJavaScriptCanOpenWindowsAutomatically(bool); | |
95 | bool JavaScriptCanOpenWindowsAutomatically() const { return m_javaScriptCanOpenWindowsAutomatically; } | |
96 | ||
97 | void setJavaEnabled(bool); | |
98 | bool isJavaEnabled() const { return m_isJavaEnabled; } | |
99 | ||
100 | void setPluginsEnabled(bool); | |
101 | bool arePluginsEnabled() const { return m_arePluginsEnabled; } | |
102 | ||
103 | void setDatabasesEnabled(bool); | |
104 | bool databasesEnabled() const { return m_databasesEnabled; } | |
105 | ||
106 | void setLocalStorageEnabled(bool); | |
107 | bool localStorageEnabled() const { return m_localStorageEnabled; } | |
108 | ||
109 | void setPrivateBrowsingEnabled(bool); | |
110 | bool privateBrowsingEnabled() const { return m_privateBrowsingEnabled; } | |
111 | ||
112 | void setDefaultTextEncodingName(const String&); | |
113 | const String& defaultTextEncodingName() const { return m_defaultTextEncodingName; } | |
114 | ||
115 | void setUserStyleSheetLocation(const KURL&); | |
116 | const KURL& userStyleSheetLocation() const { return m_userStyleSheetLocation; } | |
117 | ||
118 | void setShouldPrintBackgrounds(bool); | |
119 | bool shouldPrintBackgrounds() const { return m_shouldPrintBackgrounds; } | |
120 | ||
121 | void setTextAreasAreResizable(bool); | |
122 | bool textAreasAreResizable() const { return m_textAreasAreResizable; } | |
123 | ||
124 | void setEditableLinkBehavior(EditableLinkBehavior); | |
125 | EditableLinkBehavior editableLinkBehavior() const { return m_editableLinkBehavior; } | |
126 | ||
127 | void setTextDirectionSubmenuInclusionBehavior(TextDirectionSubmenuInclusionBehavior); | |
128 | TextDirectionSubmenuInclusionBehavior textDirectionSubmenuInclusionBehavior() const { return m_textDirectionSubmenuInclusionBehavior; } | |
129 | ||
130 | #if ENABLE(DASHBOARD_SUPPORT) | |
131 | void setUsesDashboardBackwardCompatibilityMode(bool); | |
132 | bool usesDashboardBackwardCompatibilityMode() const { return m_usesDashboardBackwardCompatibilityMode; } | |
133 | #endif | |
134 | ||
135 | void setNeedsAdobeFrameReloadingQuirk(bool); | |
136 | bool needsAcrobatFrameReloadingQuirk() const { return m_needsAdobeFrameReloadingQuirk; } | |
137 | ||
138 | void setNeedsKeyboardEventDisambiguationQuirks(bool); | |
139 | bool needsKeyboardEventDisambiguationQuirks() const { return m_needsKeyboardEventDisambiguationQuirks; } | |
140 | ||
141 | void setDOMPasteAllowed(bool); | |
142 | bool isDOMPasteAllowed() const { return m_isDOMPasteAllowed; } | |
143 | ||
144 | void setUsesPageCache(bool); | |
145 | bool usesPageCache() const { return m_usesPageCache; } | |
146 | ||
147 | void setShrinksStandaloneImagesToFit(bool); | |
148 | bool shrinksStandaloneImagesToFit() const { return m_shrinksStandaloneImagesToFit; } | |
149 | ||
150 | void setShowsURLsInToolTips(bool); | |
151 | bool showsURLsInToolTips() const { return m_showsURLsInToolTips; } | |
152 | ||
153 | void setFTPDirectoryTemplatePath(const String&); | |
154 | const String& ftpDirectoryTemplatePath() const { return m_ftpDirectoryTemplatePath; } | |
155 | ||
156 | void setForceFTPDirectoryListings(bool); | |
157 | bool forceFTPDirectoryListings() const { return m_forceFTPDirectoryListings; } | |
158 | ||
159 | void setDeveloperExtrasEnabled(bool); | |
160 | bool developerExtrasEnabled() const { return m_developerExtrasEnabled; } | |
161 | ||
162 | void setFlatFrameSetLayoutEnabled(bool); | |
163 | bool flatFrameSetLayoutEnabled() const { return m_flatFrameSetLayoutEnabled; } | |
164 | ||
165 | void setStandalone(bool flag); | |
166 | bool standalone() const { return m_standalone; } | |
167 | ||
168 | void setMaximumResourceDataLength(long long length); | |
169 | long long maximumResourceDataLength(); | |
170 | ||
171 | void setTelephoneNumberParsingEnabled(bool flag) { m_telephoneNumberParsingEnabled = flag; } | |
172 | bool telephoneNumberParsingEnabled() const { return m_telephoneNumberParsingEnabled; } | |
173 | ||
174 | void setMinimumZoomFontSize(float size) { m_minimumZoomFontSize = size; } | |
175 | float minimumZoomFontSize() const { return m_minimumZoomFontSize; } | |
176 | ||
177 | void setLayoutInterval(int t) { m_layoutInterval = t < cLayoutScheduleThreshold ? cLayoutScheduleThreshold : t; } | |
178 | int layoutInterval() const { return m_layoutInterval; } | |
179 | ||
180 | void setMaxParseDuration(double maxParseDuration) { m_maxParseDuration = maxParseDuration; } | |
181 | double maxParseDuration() const { return m_maxParseDuration; } | |
182 | ||
183 | void setAuthorAndUserStylesEnabled(bool); | |
184 | bool authorAndUserStylesEnabled() const { return m_authorAndUserStylesEnabled; } | |
185 | ||
186 | void setFontRenderingMode(FontRenderingMode mode); | |
187 | FontRenderingMode fontRenderingMode() const; | |
188 | ||
189 | void setNeedsSiteSpecificQuirks(bool); | |
190 | bool needsSiteSpecificQuirks() const { return m_needsSiteSpecificQuirks; } | |
191 | ||
192 | void setWebArchiveDebugModeEnabled(bool); | |
193 | bool webArchiveDebugModeEnabled() const { return m_webArchiveDebugModeEnabled; } | |
194 | ||
195 | void setLocalStorageDatabasePath(const String&); | |
196 | const String& localStorageDatabasePath() const { return m_localStorageDatabasePath; } | |
197 | ||
198 | void disableRangeMutationForOldAppleMail(bool); | |
199 | bool rangeMutationDisabledForOldAppleMail() const { return m_rangeMutationDisabledForOldAppleMail; } | |
200 | ||
201 | void setApplicationChromeMode(bool); | |
202 | bool inApplicationChromeMode() const { return m_inApplicationChromeMode; } | |
203 | ||
204 | void setOfflineWebApplicationCacheEnabled(bool); | |
205 | bool offlineWebApplicationCacheEnabled() const { return m_offlineWebApplicationCacheEnabled; } | |
206 | ||
207 | void setShouldPaintCustomScrollbars(bool); | |
208 | bool shouldPaintCustomScrollbars() const { return m_shouldPaintCustomScrollbars; } | |
209 | ||
210 | void setZoomsTextOnly(bool); | |
211 | bool zoomsTextOnly() const { return m_zoomsTextOnly; } | |
212 | ||
213 | void setEnforceCSSMIMETypeInStrictMode(bool); | |
214 | bool enforceCSSMIMETypeInStrictMode() { return m_enforceCSSMIMETypeInStrictMode; } | |
215 | ||
216 | void setMaximumDecodedImageSize(size_t size) { m_maximumDecodedImageSize = size; } | |
217 | size_t maximumDecodedImageSize() const { return m_maximumDecodedImageSize; } | |
218 | ||
219 | #if USE(SAFARI_THEME) | |
220 | // Windows debugging pref (global) for switching between the Aqua look and a native windows look. | |
221 | static void setShouldPaintNativeControls(bool); | |
222 | static bool shouldPaintNativeControls() { return gShouldPaintNativeControls; } | |
223 | #endif | |
224 | ||
225 | private: | |
226 | Page* m_page; | |
227 | ||
228 | String m_defaultTextEncodingName; | |
229 | String m_ftpDirectoryTemplatePath; | |
230 | String m_localStorageDatabasePath; | |
231 | KURL m_userStyleSheetLocation; | |
232 | AtomicString m_standardFontFamily; | |
233 | AtomicString m_fixedFontFamily; | |
234 | AtomicString m_serifFontFamily; | |
235 | AtomicString m_sansSerifFontFamily; | |
236 | AtomicString m_cursiveFontFamily; | |
237 | AtomicString m_fantasyFontFamily; | |
238 | EditableLinkBehavior m_editableLinkBehavior; | |
239 | TextDirectionSubmenuInclusionBehavior m_textDirectionSubmenuInclusionBehavior; | |
240 | int m_minimumFontSize; | |
241 | int m_minimumLogicalFontSize; | |
242 | int m_defaultFontSize; | |
243 | int m_defaultFixedFontSize; | |
244 | bool m_isJavaEnabled : 1; | |
245 | bool m_loadsImagesAutomatically : 1; | |
246 | bool m_privateBrowsingEnabled : 1; | |
247 | bool m_arePluginsEnabled : 1; | |
248 | bool m_databasesEnabled : 1; | |
249 | bool m_localStorageEnabled : 1; | |
250 | bool m_isJavaScriptEnabled : 1; | |
251 | bool m_javaScriptCanOpenWindowsAutomatically : 1; | |
252 | bool m_shouldPrintBackgrounds : 1; | |
253 | bool m_textAreasAreResizable : 1; | |
254 | #if ENABLE(DASHBOARD_SUPPORT) | |
255 | bool m_usesDashboardBackwardCompatibilityMode : 1; | |
256 | #endif | |
257 | bool m_needsAdobeFrameReloadingQuirk : 1; | |
258 | bool m_needsKeyboardEventDisambiguationQuirks : 1; | |
259 | bool m_isDOMPasteAllowed : 1; | |
260 | bool m_shrinksStandaloneImagesToFit : 1; | |
261 | bool m_usesPageCache: 1; | |
262 | bool m_showsURLsInToolTips : 1; | |
263 | bool m_forceFTPDirectoryListings : 1; | |
264 | bool m_developerExtrasEnabled : 1; | |
265 | bool m_authorAndUserStylesEnabled : 1; | |
266 | bool m_needsSiteSpecificQuirks : 1; | |
267 | unsigned m_fontRenderingMode : 1; | |
268 | bool m_flatFrameSetLayoutEnabled : 1; | |
269 | bool m_standalone : 1; | |
270 | bool m_telephoneNumberParsingEnabled : 1; | |
271 | bool m_webArchiveDebugModeEnabled : 1; | |
272 | bool m_inApplicationChromeMode : 1; | |
273 | bool m_offlineWebApplicationCacheEnabled : 1; | |
274 | bool m_rangeMutationDisabledForOldAppleMail : 1; | |
275 | bool m_shouldPaintCustomScrollbars : 1; | |
276 | bool m_zoomsTextOnly : 1; | |
277 | bool m_enforceCSSMIMETypeInStrictMode : 1; | |
278 | size_t m_maximumDecodedImageSize; | |
279 | long long m_maximumResourceDataLength; | |
280 | float m_minimumZoomFontSize; | |
281 | int m_layoutInterval; | |
282 | double m_maxParseDuration; | |
283 | ||
284 | #if USE(SAFARI_THEME) | |
285 | static bool gShouldPaintNativeControls; | |
286 | #endif | |
287 | }; | |
288 | ||
289 | } // namespace WebCore | |
290 | ||
291 | #endif // Settings_h |