• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2009 Google Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are
6  * met:
7  *
8  *     * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *     * Redistributions in binary form must reproduce the above
11  * copyright notice, this list of conditions and the following disclaimer
12  * in the documentation and/or other materials provided with the
13  * distribution.
14  *     * Neither the name of Google Inc. nor the names of its
15  * contributors may be used to endorse or promote products derived from
16  * this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  */
30 
31 #ifndef WebSettingsImpl_h
32 #define WebSettingsImpl_h
33 
34 #include "public/web/WebSettings.h"
35 
36 namespace blink {
37 
38 class InspectorController;
39 class Settings;
40 
41 class WebSettingsImpl FINAL : public WebSettings {
42 public:
43     explicit WebSettingsImpl(Settings*, InspectorController*);
~WebSettingsImpl()44     virtual ~WebSettingsImpl() { }
45 
46     virtual bool mainFrameResizesAreOrientationChanges() const OVERRIDE;
47     virtual bool shrinksViewportContentToFit() const OVERRIDE;
48     virtual int availablePointerTypes() const OVERRIDE;
49     virtual PointerType primaryPointerType() const OVERRIDE;
50     virtual int availableHoverTypes() const OVERRIDE;
51     virtual HoverType primaryHoverType() const OVERRIDE;
52     virtual bool viewportEnabled() const OVERRIDE;
53     virtual void setAccelerated2dCanvasEnabled(bool) OVERRIDE;
54     virtual void setAccelerated2dCanvasMSAASampleCount(int) OVERRIDE;
55     virtual void setAcceleratedCompositingEnabled(bool) OVERRIDE;
56     virtual void setPreferCompositingToLCDTextEnabled(bool) OVERRIDE;
57     virtual void setAccessibilityEnabled(bool) OVERRIDE;
58     virtual void setAllowDisplayOfInsecureContent(bool) OVERRIDE;
59     virtual void setAllowFileAccessFromFileURLs(bool) OVERRIDE;
60     virtual void setAllowCustomScrollbarInMainFrame(bool) OVERRIDE;
61     virtual void setAllowRunningOfInsecureContent(bool) OVERRIDE;
62     virtual void setAllowConnectingInsecureWebSocket(bool) OVERRIDE;
63     virtual void setAllowScriptsToCloseWindows(bool) OVERRIDE;
64     virtual void setAllowUniversalAccessFromFileURLs(bool) OVERRIDE;
65     virtual void setAntialiased2dCanvasEnabled(bool) OVERRIDE;
66     virtual void setAsynchronousSpellCheckingEnabled(bool) OVERRIDE;
67     virtual void setAutoZoomFocusedNodeToLegibleScale(bool) OVERRIDE;
68     virtual void setCaretBrowsingEnabled(bool) OVERRIDE;
69     virtual void setClobberUserAgentInitialScaleQuirk(bool) OVERRIDE;
70     virtual void setContainerCullingEnabled(bool) OVERRIDE;
71     virtual void setCookieEnabled(bool) OVERRIDE;
72     virtual void setNavigateOnDragDrop(bool) OVERRIDE;
73     virtual void setCursiveFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON) OVERRIDE;
74     virtual void setDNSPrefetchingEnabled(bool) OVERRIDE;
75     virtual void setDOMPasteAllowed(bool) OVERRIDE;
76     virtual void setDefaultFixedFontSize(int) OVERRIDE;
77     virtual void setDefaultFontSize(int) OVERRIDE;
78     virtual void setDefaultTextEncodingName(const WebString&) OVERRIDE;
79     virtual void setDefaultVideoPosterURL(const WebString&) OVERRIDE;
80     virtual void setDeferredFiltersEnabled(bool) OVERRIDE;
81     virtual void setDeferredImageDecodingEnabled(bool) OVERRIDE;
82     virtual void setDeviceScaleAdjustment(float) OVERRIDE;
83     virtual void setDeviceSupportsMouse(bool) OVERRIDE;
84 
85     // FIXME: Remove once the pointer/hover features are converted to use the
86     // new APIs (e.g. setPrimaryPointerType) on the chromium side
87     virtual void setDeviceSupportsTouch(bool) OVERRIDE;
88 
89     virtual void setDisallowFullscreenForNonMediaElements(bool) OVERRIDE;
90     virtual void setDoubleTapToZoomEnabled(bool) OVERRIDE;
91     virtual void setDownloadableBinaryFontsEnabled(bool) OVERRIDE;
92     virtual void setEditingBehavior(EditingBehavior) OVERRIDE;
93     virtual void setEnableScrollAnimator(bool) OVERRIDE;
94     virtual void setEnableTouchAdjustment(bool) OVERRIDE;
95     virtual void setRegionBasedColumnsEnabled(bool) OVERRIDE;
96     virtual void setExperimentalWebGLEnabled(bool) OVERRIDE;
97     virtual void setFantasyFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON) OVERRIDE;
98     virtual void setFixedFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON) OVERRIDE;
99     virtual void setForceZeroLayoutHeight(bool) OVERRIDE;
100     virtual void setFullscreenSupported(bool) OVERRIDE;
101     virtual void setHyperlinkAuditingEnabled(bool) OVERRIDE;
102     virtual void setIgnoreMainFrameOverflowHiddenQuirk(bool) OVERRIDE;
103     virtual void setImagesEnabled(bool) OVERRIDE;
104     virtual void setInlineTextBoxAccessibilityEnabled(bool) OVERRIDE;
105     virtual void setJavaEnabled(bool) OVERRIDE;
106     virtual void setJavaScriptCanAccessClipboard(bool) OVERRIDE;
107     virtual void setJavaScriptCanOpenWindowsAutomatically(bool) OVERRIDE;
108     virtual void setJavaScriptEnabled(bool) OVERRIDE;
109     virtual void setLayerSquashingEnabled(bool) OVERRIDE;
110     virtual void setLoadsImagesAutomatically(bool) OVERRIDE;
111     virtual void setLoadWithOverviewMode(bool) OVERRIDE;
112     virtual void setLocalStorageEnabled(bool) OVERRIDE;
113     virtual void setMainFrameClipsContent(bool) OVERRIDE;
114     virtual void setMainFrameResizesAreOrientationChanges(bool) OVERRIDE;
115     virtual void setMaxTouchPoints(int) OVERRIDE;
116     virtual void setMediaControlsOverlayPlayButtonEnabled(bool) OVERRIDE;
117     virtual void setMediaPlaybackRequiresUserGesture(bool) OVERRIDE;
118     virtual void setMinimumAccelerated2dCanvasSize(int) OVERRIDE;
119     virtual void setMinimumFontSize(int) OVERRIDE;
120     virtual void setMinimumLogicalFontSize(int) OVERRIDE;
121     virtual void setMockScrollbarsEnabled(bool) OVERRIDE;
122     virtual void setOfflineWebApplicationCacheEnabled(bool) OVERRIDE;
123     virtual void setOpenGLMultisamplingEnabled(bool) OVERRIDE;
124     virtual void setPasswordEchoDurationInSeconds(double) OVERRIDE;
125     virtual void setPasswordEchoEnabled(bool) OVERRIDE;
126     virtual void setPerTilePaintingEnabled(bool) OVERRIDE;
127     virtual void setPictographFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON) OVERRIDE;
128     virtual void setPinchOverlayScrollbarThickness(int) OVERRIDE;
129     virtual void setPinchVirtualViewportEnabled(bool) OVERRIDE;
130     virtual void setPluginsEnabled(bool) OVERRIDE;
131     virtual void setAvailablePointerTypes(int) OVERRIDE;
132     virtual void setPrimaryPointerType(PointerType) OVERRIDE;
133     virtual void setAvailableHoverTypes(int) OVERRIDE;
134     virtual void setPrimaryHoverType(HoverType) OVERRIDE;
135     virtual void setRenderVSyncNotificationEnabled(bool) OVERRIDE;
136     virtual void setReportScreenSizeInPhysicalPixelsQuirk(bool) OVERRIDE;
137     virtual void setSansSerifFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON) OVERRIDE;
138     virtual void setSelectTrailingWhitespaceEnabled(bool OVERRIDE);
139     virtual void setSelectionIncludesAltImageText(bool) OVERRIDE;
140     virtual void setSerifFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON) OVERRIDE;
141     virtual void setShouldPrintBackgrounds(bool) OVERRIDE;
142     virtual void setShouldClearDocumentBackground(bool) OVERRIDE;
143     virtual void setShouldRespectImageOrientation(bool) OVERRIDE;
144     virtual void setShowFPSCounter(bool) OVERRIDE;
145     virtual void setShowPaintRects(bool) OVERRIDE;
146     virtual void setShrinksStandaloneImagesToFit(bool) OVERRIDE;
147     virtual void setShrinksViewportContentToFit(bool) OVERRIDE;
148     virtual void setSmartInsertDeleteEnabled(bool) OVERRIDE;
149     virtual void setSpatialNavigationEnabled(bool) OVERRIDE;
150     virtual void setStandardFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON) OVERRIDE;
151     virtual void setSupportDeprecatedTargetDensityDPI(bool) OVERRIDE;
152     virtual void setSupportsMultipleWindows(bool) OVERRIDE;
153     virtual void setSyncXHRInDocumentsEnabled(bool) OVERRIDE;
154     virtual void setTextAreasAreResizable(bool) OVERRIDE;
155     virtual void setTextAutosizingEnabled(bool) OVERRIDE;
156     virtual void setAccessibilityFontScaleFactor(float) OVERRIDE;
157     virtual void setThreadedScrollingEnabled(bool) OVERRIDE;
158     virtual void setTouchDragDropEnabled(bool) OVERRIDE;
159     virtual void setTouchEditingEnabled(bool) OVERRIDE;
160     virtual void setUnifiedTextCheckerEnabled(bool) OVERRIDE;
161     virtual void setUnsafePluginPastingEnabled(bool) OVERRIDE;
162     virtual void setUsesEncodingDetector(bool) OVERRIDE;
163     virtual void setUseLegacyBackgroundSizeShorthandBehavior(bool) OVERRIDE;
164     virtual void setUseSolidColorScrollbars(bool) OVERRIDE;
165     virtual void setUseWideViewport(bool) OVERRIDE;
166     virtual void setV8CacheOptions(V8CacheOptions) OVERRIDE;
167     virtual void setV8ScriptStreamingEnabled(bool) OVERRIDE;
168     virtual void setValidationMessageTimerMagnification(int) OVERRIDE;
169     virtual void setViewportEnabled(bool) OVERRIDE;
170     virtual void setViewportMetaEnabled(bool) OVERRIDE;
171     virtual void setViewportMetaLayoutSizeQuirk(bool) OVERRIDE;
172     virtual void setViewportMetaMergeContentQuirk(bool) OVERRIDE;
173     virtual void setViewportMetaNonUserScalableQuirk(bool) OVERRIDE;
174     virtual void setViewportMetaZeroValuesQuirk(bool) OVERRIDE;
175     virtual void setWebAudioEnabled(bool) OVERRIDE;
176     virtual void setWebGLErrorsToConsoleEnabled(bool) OVERRIDE;
177     virtual void setWebSecurityEnabled(bool) OVERRIDE;
178     virtual void setWideViewportQuirkEnabled(bool) OVERRIDE;
179     virtual void setXSSAuditorEnabled(bool) OVERRIDE;
180 
showFPSCounter()181     bool showFPSCounter() const { return m_showFPSCounter; }
showPaintRects()182     bool showPaintRects() const { return m_showPaintRects; }
renderVSyncNotificationEnabled()183     bool renderVSyncNotificationEnabled() const { return m_renderVSyncNotificationEnabled; }
autoZoomFocusedNodeToLegibleScale()184     bool autoZoomFocusedNodeToLegibleScale() const { return m_autoZoomFocusedNodeToLegibleScale; }
doubleTapToZoomEnabled()185     bool doubleTapToZoomEnabled() const { return m_doubleTapToZoomEnabled; }
perTilePaintingEnabled()186     bool perTilePaintingEnabled() const { return m_perTilePaintingEnabled; }
supportDeprecatedTargetDensityDPI()187     bool supportDeprecatedTargetDensityDPI() const { return m_supportDeprecatedTargetDensityDPI; }
viewportMetaLayoutSizeQuirk()188     bool viewportMetaLayoutSizeQuirk() const { return m_viewportMetaLayoutSizeQuirk; }
viewportMetaNonUserScalableQuirk()189     bool viewportMetaNonUserScalableQuirk() const { return m_viewportMetaNonUserScalableQuirk; }
clobberUserAgentInitialScaleQuirk()190     bool clobberUserAgentInitialScaleQuirk() const { return m_clobberUserAgentInitialScaleQuirk; }
191 
192     void setMockGestureTapHighlightsEnabled(bool);
193     bool mockGestureTapHighlightsEnabled() const;
194 
195 private:
196     Settings* m_settings;
197     InspectorController* m_inspectorController;
198     bool m_showFPSCounter;
199     bool m_showPaintRects;
200     bool m_renderVSyncNotificationEnabled;
201     bool m_autoZoomFocusedNodeToLegibleScale;
202     bool m_deferredImageDecodingEnabled;
203     bool m_doubleTapToZoomEnabled;
204     bool m_perTilePaintingEnabled;
205     bool m_supportDeprecatedTargetDensityDPI;
206     bool m_shrinksViewportContentToFit;
207     // This quirk is to maintain compatibility with Android apps built on
208     // the Android SDK prior to and including version 18. Presumably, this
209     // can be removed any time after 2015. See http://crbug.com/277369.
210     bool m_viewportMetaLayoutSizeQuirk;
211     // This quirk is to maintain compatibility with Android apps built on
212     // the Android SDK prior to and including version 18. Presumably, this
213     // can be removed any time after 2015. See http://crbug.com/312691.
214     bool m_viewportMetaNonUserScalableQuirk;
215     // This quirk is to maintain compatibility with Android apps built on
216     // the Android SDK prior to and including version 18. Presumably, this
217     // can be removed any time after 2015. See http://crbug.com/313754.
218     bool m_clobberUserAgentInitialScaleQuirk;
219     bool m_mainFrameResizesAreOrientationChanges;
220 };
221 
222 } // namespace blink
223 
224 #endif
225