Home | History | Annotate | Download | only in web
      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 WebCore {
     37 class InspectorController;
     38 class Settings;
     39 }
     40 
     41 namespace blink {
     42 
     43 class WebSettingsImpl FINAL : public WebSettings {
     44 public:
     45     explicit WebSettingsImpl(WebCore::Settings*, WebCore::InspectorController*);
     46     virtual ~WebSettingsImpl() { }
     47 
     48     virtual bool mainFrameResizesAreOrientationChanges() const OVERRIDE;
     49     virtual bool shrinksViewportContentToFit() const OVERRIDE;
     50     virtual bool scrollAnimatorEnabled() const OVERRIDE;
     51     virtual bool touchEditingEnabled() const OVERRIDE;
     52     virtual bool viewportEnabled() const OVERRIDE;
     53     virtual bool viewportMetaEnabled() const OVERRIDE;
     54     virtual void setAccelerated2dCanvasEnabled(bool) OVERRIDE;
     55     virtual void setAccelerated2dCanvasMSAASampleCount(int) OVERRIDE;
     56     virtual void setAcceleratedCompositingEnabled(bool) OVERRIDE;
     57     virtual void setAcceleratedCompositingForCanvasEnabled(bool) OVERRIDE;
     58     virtual void setAcceleratedCompositingForFiltersEnabled(bool) OVERRIDE;
     59     virtual void setAcceleratedCompositingForFixedPositionEnabled(bool) OVERRIDE;
     60     virtual void setAcceleratedCompositingForOverflowScrollEnabled(bool) OVERRIDE;
     61     virtual void setCompositorDrivenAcceleratedScrollingEnabled(bool) OVERRIDE;
     62     virtual void setAcceleratedCompositingForFixedRootBackgroundEnabled(bool) OVERRIDE;
     63     virtual void setAcceleratedCompositingForVideoEnabled(bool) OVERRIDE;
     64     virtual void setAllowDisplayOfInsecureContent(bool) OVERRIDE;
     65     virtual void setAllowFileAccessFromFileURLs(bool) OVERRIDE;
     66     virtual void setAllowCustomScrollbarInMainFrame(bool) OVERRIDE;
     67     virtual void setAllowRunningOfInsecureContent(bool) OVERRIDE;
     68     virtual void setAllowConnectingInsecureWebSocket(bool) OVERRIDE;
     69     virtual void setAllowScriptsToCloseWindows(bool) OVERRIDE;
     70     virtual void setAllowUniversalAccessFromFileURLs(bool) OVERRIDE;
     71     virtual void setAntialiased2dCanvasEnabled(bool) OVERRIDE;
     72     virtual void setAsynchronousSpellCheckingEnabled(bool) OVERRIDE;
     73     virtual void setAutoZoomFocusedNodeToLegibleScale(bool) OVERRIDE;
     74     virtual void setCaretBrowsingEnabled(bool) OVERRIDE;
     75     virtual void setClobberUserAgentInitialScaleQuirk(bool) OVERRIDE;
     76     virtual void setCompositedScrollingForFramesEnabled(bool) OVERRIDE;
     77     virtual void setCompositorTouchHitTesting(bool) OVERRIDE;
     78     virtual void setContainerCullingEnabled(bool) OVERRIDE;
     79     virtual void setCookieEnabled(bool) OVERRIDE;
     80     virtual void setNavigateOnDragDrop(bool) OVERRIDE;
     81     virtual void setCursiveFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON) OVERRIDE;
     82     virtual void setDNSPrefetchingEnabled(bool) OVERRIDE;
     83     virtual void setDOMPasteAllowed(bool) OVERRIDE;
     84     virtual void setDefaultFixedFontSize(int) OVERRIDE;
     85     virtual void setDefaultFontSize(int) OVERRIDE;
     86     virtual void setDefaultTextEncodingName(const WebString&) OVERRIDE;
     87     virtual void setDefaultVideoPosterURL(const WebString&) OVERRIDE;
     88     virtual void setDeferredFiltersEnabled(bool) OVERRIDE;
     89     virtual void setDeferredImageDecodingEnabled(bool) OVERRIDE;
     90     virtual void setDeviceScaleAdjustment(float) OVERRIDE;
     91     virtual void setDeviceSupportsMouse(bool) OVERRIDE;
     92     virtual void setDeviceSupportsTouch(bool) OVERRIDE;
     93     virtual void setDisallowFullscreenForNonMediaElements(bool) OVERRIDE;
     94     virtual void setDoubleTapToZoomEnabled(bool) OVERRIDE;
     95     virtual void setDownloadableBinaryFontsEnabled(bool) OVERRIDE;
     96     virtual void setEditingBehavior(EditingBehavior) OVERRIDE;
     97     virtual void setEnableScrollAnimator(bool) OVERRIDE;
     98     virtual void setEnableTouchAdjustment(bool) OVERRIDE;
     99     virtual void setRegionBasedColumnsEnabled(bool) OVERRIDE;
    100     virtual void setExperimentalWebGLEnabled(bool) OVERRIDE;
    101     virtual void setFantasyFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON) OVERRIDE;
    102     virtual void setFixedFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON) OVERRIDE;
    103     virtual void setFullscreenSupported(bool) OVERRIDE;
    104     virtual void setGestureTapHighlightEnabled(bool) OVERRIDE;
    105     virtual void setForceZeroLayoutHeight(bool) OVERRIDE;
    106     virtual void setHyperlinkAuditingEnabled(bool) OVERRIDE;
    107     virtual void setIgnoreMainFrameOverflowHiddenQuirk(bool) OVERRIDE;
    108     virtual void setImagesEnabled(bool) OVERRIDE;
    109     virtual void setJavaEnabled(bool) OVERRIDE;
    110     virtual void setJavaScriptCanAccessClipboard(bool) OVERRIDE;
    111     virtual void setJavaScriptCanOpenWindowsAutomatically(bool) OVERRIDE;
    112     virtual void setJavaScriptEnabled(bool) OVERRIDE;
    113     virtual void setLayerSquashingEnabled(bool) OVERRIDE;
    114     virtual void setLoadsImagesAutomatically(bool) OVERRIDE;
    115     virtual void setLoadWithOverviewMode(bool) OVERRIDE;
    116     virtual void setLocalStorageEnabled(bool) OVERRIDE;
    117     virtual void setMainFrameClipsContent(bool) OVERRIDE;
    118     virtual void setMainFrameResizesAreOrientationChanges(bool) OVERRIDE;
    119     virtual void setMaxTouchPoints(int) OVERRIDE;
    120     virtual void setMediaControlsOverlayPlayButtonEnabled(bool) OVERRIDE;
    121     virtual void setMediaPlaybackRequiresUserGesture(bool) OVERRIDE;
    122     virtual void setMinimumAccelerated2dCanvasSize(int) OVERRIDE;
    123     virtual void setMinimumFontSize(int) OVERRIDE;
    124     virtual void setMinimumLogicalFontSize(int) OVERRIDE;
    125     virtual void setMockScrollbarsEnabled(bool) OVERRIDE;
    126     virtual void setNeedsSiteSpecificQuirks(bool) OVERRIDE;
    127     virtual void setOfflineWebApplicationCacheEnabled(bool) OVERRIDE;
    128     virtual void setOpenGLMultisamplingEnabled(bool) OVERRIDE;
    129     virtual void setPasswordEchoDurationInSeconds(double) OVERRIDE;
    130     virtual void setPasswordEchoEnabled(bool) OVERRIDE;
    131     virtual void setPerTilePaintingEnabled(bool) OVERRIDE;
    132     virtual void setPictographFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON) OVERRIDE;
    133     virtual void setPinchOverlayScrollbarThickness(int) OVERRIDE;
    134     virtual void setPinchVirtualViewportEnabled(bool) OVERRIDE;
    135     virtual void setPluginsEnabled(bool) OVERRIDE;
    136     virtual void setRenderVSyncNotificationEnabled(bool) OVERRIDE;
    137     virtual void setReportScreenSizeInPhysicalPixelsQuirk(bool) OVERRIDE;
    138     virtual void setSansSerifFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON) OVERRIDE;
    139     virtual void setSelectTrailingWhitespaceEnabled(bool OVERRIDE);
    140     virtual void setSelectionIncludesAltImageText(bool) OVERRIDE;
    141     virtual void setSerifFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON) OVERRIDE;
    142     virtual void setShouldPrintBackgrounds(bool) OVERRIDE;
    143     virtual void setShouldClearDocumentBackground(bool) OVERRIDE;
    144     virtual void setShouldRespectImageOrientation(bool) OVERRIDE;
    145     virtual void setShowFPSCounter(bool) OVERRIDE;
    146     virtual void setShowPaintRects(bool) OVERRIDE;
    147     virtual void setShrinksStandaloneImagesToFit(bool) OVERRIDE;
    148     virtual void setShrinksViewportContentToFit(bool) OVERRIDE;
    149     virtual void setSmartInsertDeleteEnabled(bool) OVERRIDE;
    150     virtual void setSpatialNavigationEnabled(bool) OVERRIDE;
    151     virtual void setStandardFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON) OVERRIDE;
    152     virtual void setSupportDeprecatedTargetDensityDPI(bool) OVERRIDE;
    153     virtual void setSupportsMultipleWindows(bool) OVERRIDE;
    154     virtual void setSyncXHRInDocumentsEnabled(bool) OVERRIDE;
    155     virtual void setTextAreasAreResizable(bool) OVERRIDE;
    156     virtual void setTextAutosizingEnabled(bool) OVERRIDE;
    157     virtual void setAccessibilityFontScaleFactor(float) 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 setUseExpandedHeuristicsForGpuRasterization(bool) OVERRIDE;
    164     virtual void setUseLegacyBackgroundSizeShorthandBehavior(bool) OVERRIDE;
    165     virtual void setUseSolidColorScrollbars(bool) OVERRIDE;
    166     virtual void setUseWideViewport(bool) OVERRIDE;
    167     virtual void setValidationMessageTimerMagnification(int) OVERRIDE;
    168     virtual void setViewportEnabled(bool) OVERRIDE;
    169     virtual void setViewportMetaEnabled(bool) OVERRIDE;
    170     virtual void setViewportMetaLayoutSizeQuirk(bool) OVERRIDE;
    171     virtual void setViewportMetaMergeContentQuirk(bool) OVERRIDE;
    172     virtual void setViewportMetaNonUserScalableQuirk(bool) OVERRIDE;
    173     virtual void setViewportMetaZeroValuesQuirk(bool) OVERRIDE;
    174     virtual void setWebAudioEnabled(bool) OVERRIDE;
    175     virtual void setWebGLErrorsToConsoleEnabled(bool) OVERRIDE;
    176     virtual void setWebSecurityEnabled(bool) OVERRIDE;
    177     virtual void setWideViewportQuirkEnabled(bool) OVERRIDE;
    178     virtual void setXSSAuditorEnabled(bool) OVERRIDE;
    179 
    180     bool showFPSCounter() const { return m_showFPSCounter; }
    181     bool showPaintRects() const { return m_showPaintRects; }
    182     bool renderVSyncNotificationEnabled() const { return m_renderVSyncNotificationEnabled; }
    183     bool autoZoomFocusedNodeToLegibleScale() const { return m_autoZoomFocusedNodeToLegibleScale; }
    184     bool gestureTapHighlightEnabled() const { return m_gestureTapHighlightEnabled; }
    185     bool doubleTapToZoomEnabled() const { return m_doubleTapToZoomEnabled; }
    186     bool perTilePaintingEnabled() const { return m_perTilePaintingEnabled; }
    187     bool supportDeprecatedTargetDensityDPI() const { return m_supportDeprecatedTargetDensityDPI; }
    188     bool useExpandedHeuristicsForGpuRasterization() const { return m_useExpandedHeuristicsForGpuRasterization; }
    189     bool viewportMetaLayoutSizeQuirk() const { return m_viewportMetaLayoutSizeQuirk; }
    190     bool viewportMetaNonUserScalableQuirk() const { return m_viewportMetaNonUserScalableQuirk; }
    191     bool clobberUserAgentInitialScaleQuirk() const { return m_clobberUserAgentInitialScaleQuirk; }
    192 
    193 private:
    194     WebCore::Settings* m_settings;
    195     WebCore::InspectorController* m_inspectorController;
    196     bool m_showFPSCounter;
    197     bool m_showPaintRects;
    198     bool m_renderVSyncNotificationEnabled;
    199     bool m_gestureTapHighlightEnabled;
    200     bool m_autoZoomFocusedNodeToLegibleScale;
    201     bool m_deferredImageDecodingEnabled;
    202     bool m_doubleTapToZoomEnabled;
    203     bool m_perTilePaintingEnabled;
    204     bool m_supportDeprecatedTargetDensityDPI;
    205     bool m_shrinksViewportContentToFit;
    206     bool m_useExpandedHeuristicsForGpuRasterization;
    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