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 "WebSettings.h"
     35 
     36 namespace WebCore {
     37 class Settings;
     38 }
     39 
     40 namespace blink {
     41 
     42 class WebSettingsImpl : public WebSettings {
     43 public:
     44     explicit WebSettingsImpl(WebCore::Settings*);
     45     virtual ~WebSettingsImpl() { }
     46 
     47     virtual bool mainFrameResizesAreOrientationChanges() const;
     48     virtual bool deviceSupportsTouch();
     49     virtual bool scrollAnimatorEnabled() const;
     50     virtual bool touchEditingEnabled() const;
     51     virtual bool viewportEnabled() const;
     52     virtual bool viewportMetaEnabled() const;
     53     virtual void setAccelerated2dCanvasEnabled(bool);
     54     virtual void setAccelerated2dCanvasMSAASampleCount(int);
     55     virtual void setAcceleratedCompositingEnabled(bool);
     56     virtual void setAcceleratedCompositingFor3DTransformsEnabled(bool);
     57     virtual void setAcceleratedCompositingForAnimationEnabled(bool);
     58     virtual void setAcceleratedCompositingForCanvasEnabled(bool);
     59     virtual void setAcceleratedCompositingForFiltersEnabled(bool);
     60     virtual void setAcceleratedCompositingForFixedPositionEnabled(bool);
     61     virtual void setAcceleratedCompositingForOverflowScrollEnabled(bool);
     62     virtual void setCompositorDrivenAcceleratedScrollingEnabled(bool);
     63     virtual void setAcceleratedCompositingForTransitionEnabled(bool);
     64     virtual void setAcceleratedCompositingForFixedRootBackgroundEnabled(bool);
     65     virtual void setAcceleratedCompositingForPluginsEnabled(bool);
     66     virtual void setAcceleratedCompositingForScrollableFramesEnabled(bool);
     67     virtual void setAcceleratedCompositingForVideoEnabled(bool);
     68     virtual void setAcceleratedFiltersEnabled(bool);
     69     virtual void setAllowDisplayOfInsecureContent(bool);
     70     virtual void setAllowFileAccessFromFileURLs(bool);
     71     virtual void setAllowCustomScrollbarInMainFrame(bool);
     72     virtual void setAllowRunningOfInsecureContent(bool);
     73     virtual void setAllowScriptsToCloseWindows(bool);
     74     virtual void setAllowUniversalAccessFromFileURLs(bool);
     75     virtual void setAntialiased2dCanvasEnabled(bool);
     76     virtual void setAsynchronousSpellCheckingEnabled(bool);
     77     virtual void setAutoZoomFocusedNodeToLegibleScale(bool);
     78     virtual void setCaretBrowsingEnabled(bool);
     79     virtual void setClobberUserAgentInitialScaleQuirk(bool);
     80     virtual void setCompositedScrollingForFramesEnabled(bool);
     81     virtual void setCompositorTouchHitTesting(bool);
     82     virtual void setCookieEnabled(bool);
     83     virtual void setCursiveFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON);
     84     virtual void setDNSPrefetchingEnabled(bool);
     85     virtual void setDOMPasteAllowed(bool);
     86     virtual void setDefaultFixedFontSize(int);
     87     virtual void setDefaultFontSize(int);
     88     virtual void setDefaultTextEncodingName(const WebString&);
     89     virtual void setDefaultVideoPosterURL(const WebString&);
     90     virtual void setDeferred2dCanvasEnabled(bool);
     91     virtual void setDeferredImageDecodingEnabled(bool);
     92     virtual void setDeviceScaleAdjustment(float);
     93     virtual void setDeviceSupportsMouse(bool);
     94     virtual void setDeviceSupportsTouch(bool);
     95     virtual void setDoubleTapToZoomEnabled(bool);
     96     virtual void setDownloadableBinaryFontsEnabled(bool);
     97     virtual void setEditableLinkBehaviorNeverLive();
     98     virtual void setEditingBehavior(EditingBehavior);
     99     virtual void setEnableScrollAnimator(bool);
    100     virtual void setEnableTouchAdjustment(bool);
    101     virtual void setRegionBasedColumnsEnabled(bool);
    102     virtual void setExperimentalWebGLEnabled(bool);
    103     virtual void setExperimentalWebSocketEnabled(bool);
    104     virtual void setFantasyFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON);
    105     virtual void setFixedFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON);
    106     virtual void setFixedPositionCreatesStackingContext(bool);
    107     virtual void setForceCompositingMode(bool);
    108     virtual void setFullScreenEnabled(bool);
    109     virtual void setGestureTapHighlightEnabled(bool);
    110     virtual void setHyperlinkAuditingEnabled(bool);
    111     virtual void setIgnoreMainFrameOverflowHiddenQuirk(bool);
    112     virtual void setImagesEnabled(bool);
    113     virtual void setJavaEnabled(bool);
    114     virtual void setJavaScriptCanAccessClipboard(bool);
    115     virtual void setJavaScriptCanOpenWindowsAutomatically(bool);
    116     virtual void setJavaScriptEnabled(bool);
    117     virtual void setLayerSquashingEnabled(bool);
    118     virtual void setLayoutFallbackWidth(int);
    119     virtual void setLoadsImagesAutomatically(bool);
    120     virtual void setLoadWithOverviewMode(bool);
    121     virtual void setLocalStorageEnabled(bool);
    122     virtual void setMainFrameClipsContent(bool);
    123     virtual void setMainFrameResizesAreOrientationChanges(bool);
    124     virtual void setMaxTouchPoints(int);
    125     virtual void setMediaPlaybackRequiresUserGesture(bool);
    126     virtual void setMediaFullscreenRequiresUserGesture(bool);
    127     virtual void setMemoryInfoEnabled(bool);
    128     virtual void setMinimumAccelerated2dCanvasSize(int);
    129     virtual void setMinimumFontSize(int);
    130     virtual void setMinimumLogicalFontSize(int);
    131     virtual void setMockScrollbarsEnabled(bool);
    132     virtual void setNeedsSiteSpecificQuirks(bool);
    133     virtual void setOfflineWebApplicationCacheEnabled(bool);
    134     virtual void setOpenGLMultisamplingEnabled(bool);
    135     virtual void setPasswordEchoDurationInSeconds(double);
    136     virtual void setPasswordEchoEnabled(bool);
    137     virtual void setPerTilePaintingEnabled(bool);
    138     virtual void setPictographFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON);
    139     virtual void setPinchOverlayScrollbarThickness(int);
    140     virtual void setPinchVirtualViewportEnabled(bool);
    141     virtual void setPluginsEnabled(bool);
    142     virtual void setPrivilegedWebGLExtensionsEnabled(bool);
    143     virtual void setRenderVSyncNotificationEnabled(bool);
    144     virtual void setReportScreenSizeInPhysicalPixelsQuirk(bool);
    145     virtual void setSansSerifFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON);
    146     virtual void setSelectTrailingWhitespaceEnabled(bool);
    147     virtual void setSelectionIncludesAltImageText(bool);
    148     virtual void setSerifFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON);
    149     virtual void setShouldDisplayCaptions(bool);
    150     virtual void setShouldDisplaySubtitles(bool);
    151     virtual void setShouldDisplayTextDescriptions(bool);
    152     virtual void setShouldPrintBackgrounds(bool);
    153     virtual void setShouldClearDocumentBackground(bool);
    154     virtual void setShouldRespectImageOrientation(bool);
    155     virtual void setShowFPSCounter(bool);
    156     virtual void setShowPaintRects(bool);
    157     virtual void setShrinksStandaloneImagesToFit(bool);
    158     virtual void setSmartInsertDeleteEnabled(bool);
    159     virtual void setSpatialNavigationEnabled(bool);
    160     virtual void setStandardFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON);
    161     virtual void setSupportDeprecatedTargetDensityDPI(bool);
    162     virtual void setSupportsMultipleWindows(bool);
    163     virtual void setSyncXHRInDocumentsEnabled(bool);
    164     virtual void setTextAreasAreResizable(bool);
    165     virtual void setTextAutosizingEnabled(bool);
    166     virtual void setAccessibilityFontScaleFactor(float);
    167     virtual void setTouchDragDropEnabled(bool);
    168     virtual void setTouchEditingEnabled(bool);
    169     virtual void setThreadedHTMLParser(bool);
    170     virtual void setUnifiedTextCheckerEnabled(bool);
    171     virtual void setUnsafePluginPastingEnabled(bool);
    172     virtual void setUsesEncodingDetector(bool);
    173     virtual void setUseLegacyBackgroundSizeShorthandBehavior(bool);
    174     virtual void setUseSolidColorScrollbars(bool);
    175     virtual void setUseWideViewport(bool);
    176     virtual void setValidationMessageTimerMagnification(int);
    177     virtual void setViewportEnabled(bool);
    178     virtual void setViewportMetaEnabled(bool);
    179     virtual void setViewportMetaLayoutSizeQuirk(bool);
    180     virtual void setViewportMetaMergeContentQuirk(bool);
    181     virtual void setViewportMetaNonUserScalableQuirk(bool);
    182     virtual void setViewportMetaZeroValuesQuirk(bool);
    183     virtual void setWebAudioEnabled(bool);
    184     virtual void setWebGLErrorsToConsoleEnabled(bool);
    185     virtual void setWebSecurityEnabled(bool);
    186     virtual void setWideViewportQuirkEnabled(bool);
    187     virtual void setXSSAuditorEnabled(bool);
    188 
    189     // FIXME: Make chromium stop calling this and delete the method.
    190     virtual void setVisualWordMovementEnabled(bool) { }
    191 
    192     bool showFPSCounter() const { return m_showFPSCounter; }
    193     bool showPaintRects() const { return m_showPaintRects; }
    194     bool renderVSyncNotificationEnabled() const { return m_renderVSyncNotificationEnabled; }
    195     bool autoZoomFocusedNodeToLegibleScale() const { return m_autoZoomFocusedNodeToLegibleScale; }
    196     bool gestureTapHighlightEnabled() const { return m_gestureTapHighlightEnabled; }
    197     bool doubleTapToZoomEnabled() const { return m_doubleTapToZoomEnabled; }
    198     bool perTilePaintingEnabled() const { return m_perTilePaintingEnabled; }
    199     bool supportDeprecatedTargetDensityDPI() const { return m_supportDeprecatedTargetDensityDPI; }
    200     bool viewportMetaLayoutSizeQuirk() const { return m_viewportMetaLayoutSizeQuirk; }
    201     bool viewportMetaNonUserScalableQuirk() const { return m_viewportMetaNonUserScalableQuirk; }
    202     bool clobberUserAgentInitialScaleQuirk() const { return m_clobberUserAgentInitialScaleQuirk; }
    203     int pinchOverlayScrollbarThickness() const { return m_pinchOverlayScrollbarThickness; }
    204 
    205 private:
    206     WebCore::Settings* m_settings;
    207     bool m_showFPSCounter;
    208     bool m_showPaintRects;
    209     bool m_renderVSyncNotificationEnabled;
    210     bool m_gestureTapHighlightEnabled;
    211     bool m_autoZoomFocusedNodeToLegibleScale;
    212     bool m_deferredImageDecodingEnabled;
    213     bool m_doubleTapToZoomEnabled;
    214     bool m_perTilePaintingEnabled;
    215     bool m_supportDeprecatedTargetDensityDPI;
    216     // This quirk is to maintain compatibility with Android apps built on
    217     // the Android SDK prior to and including version 18. Presumably, this
    218     // can be removed any time after 2015. See http://crbug.com/277369.
    219     bool m_viewportMetaLayoutSizeQuirk;
    220     // This quirk is to maintain compatibility with Android apps built on
    221     // the Android SDK prior to and including version 18. Presumably, this
    222     // can be removed any time after 2015. See http://crbug.com/312691.
    223     bool m_viewportMetaNonUserScalableQuirk;
    224     // This quirk is to maintain compatibility with Android apps built on
    225     // the Android SDK prior to and including version 18. Presumably, this
    226     // can be removed any time after 2015. See http://crbug.com/313754.
    227     bool m_clobberUserAgentInitialScaleQuirk;
    228     int m_pinchOverlayScrollbarThickness;
    229     bool m_mainFrameResizesAreOrientationChanges;
    230 };
    231 
    232 } // namespace blink
    233 
    234 #endif
    235