| /* |
| * Copyright (C) 2009 Google Inc. All rights reserved. |
| * |
| * Redistribution and use in source and binary forms, with or without |
| * modification, are permitted provided that the following conditions are |
| * met: |
| * |
| * * Redistributions of source code must retain the above copyright |
| * notice, this list of conditions and the following disclaimer. |
| * * Redistributions in binary form must reproduce the above |
| * copyright notice, this list of conditions and the following disclaimer |
| * in the documentation and/or other materials provided with the |
| * distribution. |
| * * Neither the name of Google Inc. nor the names of its |
| * contributors may be used to endorse or promote products derived from |
| * this software without specific prior written permission. |
| * |
| * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| */ |
| |
| #ifndef WebSettings_h |
| #define WebSettings_h |
| |
| #include <unicode/uscript.h> |
| |
| #include "public/platform/PointerProperties.h" |
| #include "public/platform/WebCommon.h" |
| #include "public/platform/WebEffectiveConnectionType.h" |
| #include "public/platform/WebSize.h" |
| #include "public/platform/WebViewportStyle.h" |
| |
| namespace blink { |
| |
| class WebString; |
| |
| // WebSettings is owned by the WebView and allows code to modify the settings |
| // for the WebView's page without any knowledge of WebCore itself. For the most |
| // part, these functions have a 1:1 mapping with the methods in |
| // WebCore/page/Settings.h. |
| class WebSettings { |
| public: |
| enum ImageAnimationPolicy { |
| kImageAnimationPolicyAllowed, |
| kImageAnimationPolicyAnimateOnce, |
| kImageAnimationPolicyNoAnimation |
| }; |
| |
| enum EditingBehavior { |
| kEditingBehaviorMac, |
| kEditingBehaviorWin, |
| kEditingBehaviorUnix, |
| kEditingBehaviorAndroid |
| }; |
| |
| enum V8CacheOptions { |
| kV8CacheOptionsDefault, |
| kV8CacheOptionsNone, |
| kV8CacheOptionsCode, |
| }; |
| |
| enum class SavePreviousDocumentResources { |
| kNever, |
| kUntilOnDOMContentLoaded, |
| kUntilOnLoad |
| }; |
| |
| // Selection strategy defines how the selection granularity changes when the |
| // selection extent is moved. |
| enum class SelectionStrategyType { |
| // Always uses character granularity. |
| kCharacter, |
| // "Expand by word, shrink by character" selection strategy. |
| // Uses character granularity when selection is shrinking. If the |
| // selection is expanding, granularity doesn't change until a word |
| // boundary is passed, after which the granularity switches to "word". |
| kDirection |
| }; |
| |
| // Defines user preference for text track kind. |
| enum class TextTrackKindUserPreference { |
| // Display only tracks marked as default |
| kDefault, |
| // If available, display captions track in preferred language, else display |
| // subtitles. |
| kCaptions, |
| // If available, display subtitles track in preferred language, else display |
| // captions. |
| kSubtitles |
| }; |
| |
| // Defines the default for 'passive' field used in the AddEventListenerOptions |
| // interface when javascript calls addEventListener. |
| enum class PassiveEventListenerDefault { |
| kFalse, // Default of false. |
| kTrue, // Default of true. |
| kForceAllTrue // Force all values to be true even when specified. |
| }; |
| |
| // Defines the autoplay policy to be used. Should match the enum class in |
| // web_preferences.h |
| enum class AutoplayPolicy { |
| kNoUserGestureRequired = 0, |
| kUserGestureRequired, |
| kUserGestureRequiredForCrossOrigin, |
| kDocumentUserActivationRequired, |
| }; |
| |
| // Sets value of a setting by its string identifier from Settings.in and |
| // string representation of value. An enum's string representation is the |
| // string representation of the integer value of the enum. |
| virtual void SetFromStrings(const WebString& name, |
| const WebString& value) = 0; |
| |
| virtual bool ShrinksViewportContentToFit() const = 0; |
| virtual bool ViewportEnabled() const = 0; |
| virtual void SetAccelerated2dCanvasMSAASampleCount(int) = 0; |
| virtual void SetAcceleratedCompositingEnabled(bool) = 0; |
| virtual void SetPreferCompositingToLCDTextEnabled(bool) = 0; |
| // Not implemented yet, see http://crbug.com/178119 |
| virtual void SetAcceleratedCompositingForTransitionEnabled(bool) {} |
| // If set to true, allows frames with an https origin to display passive |
| // contents at an insecure URL. Otherwise, disallows it. The |
| // LocalFrameClient set to the frame may override the value set by this |
| // method. |
| virtual void SetAccessibilityEnabled(bool) = 0; |
| virtual void SetAccessibilityPasswordValuesEnabled(bool) = 0; |
| virtual void SetAllowFileAccessFromFileURLs(bool) = 0; |
| virtual void SetAllowCustomScrollbarInMainFrame(bool) = 0; |
| virtual void SetAllowGeolocationOnInsecureOrigins(bool) = 0; |
| // If set to true, allows frames with an https origin to run active |
| // contents at an insecure URL. This includes WebSockets. Otherwise, |
| // disallows it. The LocalFrameClient set to the frame may override the |
| // value set by this method. |
| virtual void SetAllowRunningOfInsecureContent(bool) = 0; |
| virtual void SetAllowScriptsToCloseWindows(bool) = 0; |
| virtual void SetAllowUniversalAccessFromFileURLs(bool) = 0; |
| virtual void SetAlwaysShowContextMenuOnTouch(bool) = 0; |
| virtual void SetAntialiased2dCanvasEnabled(bool) = 0; |
| virtual void SetAntialiasedClips2dCanvasEnabled(bool) = 0; |
| virtual void SetAutoplayPolicy(AutoplayPolicy) = 0; |
| virtual void SetAutoZoomFocusedNodeToLegibleScale(bool) = 0; |
| virtual void SetBrowserSideNavigationEnabled(bool) = 0; |
| virtual void SetClobberUserAgentInitialScaleQuirk(bool) = 0; |
| virtual void SetCookieEnabled(bool) = 0; |
| virtual void SetNavigateOnDragDrop(bool) = 0; |
| virtual void SetCursiveFontFamily(const WebString&, |
| UScriptCode = USCRIPT_COMMON) = 0; |
| virtual void SetDNSPrefetchingEnabled(bool) = 0; |
| virtual void SetDOMPasteAllowed(bool) = 0; |
| virtual void SetDefaultFixedFontSize(int) = 0; |
| virtual void SetDefaultFontSize(int) = 0; |
| virtual void SetDefaultTextEncodingName(const WebString&) = 0; |
| virtual void SetDefaultVideoPosterURL(const WebString&) = 0; |
| void SetDeferred2dCanvasEnabled(bool) {} // temporary stub |
| virtual void SetDeviceScaleAdjustment(float) = 0; |
| virtual void SetDisableReadingFromCanvas(bool) = 0; |
| virtual void SetDoubleTapToZoomEnabled(bool) = 0; |
| virtual void SetDownloadableBinaryFontsEnabled(bool) = 0; |
| virtual void SetEditingBehavior(EditingBehavior) = 0; |
| virtual void SetEnableScrollAnimator(bool) = 0; |
| virtual void SetEnableTouchAdjustment(bool) = 0; |
| virtual bool MultiTargetTapNotificationEnabled() = 0; |
| virtual void SetMultiTargetTapNotificationEnabled(bool) = 0; |
| virtual void SetWebGL1Enabled(bool) = 0; |
| virtual void SetWebGL2Enabled(bool) = 0; |
| virtual void SetFantasyFontFamily(const WebString&, |
| UScriptCode = USCRIPT_COMMON) = 0; |
| virtual void SetFixedFontFamily(const WebString&, |
| UScriptCode = USCRIPT_COMMON) = 0; |
| virtual void SetForceMainWorldInitialization(bool) = 0; |
| virtual void SetForcePreloadNoneForMediaElements(bool) = 0; |
| virtual void SetForceZeroLayoutHeight(bool) = 0; |
| virtual void SetFullscreenSupported(bool) = 0; |
| virtual void SetHideDownloadUI(bool) = 0; |
| virtual void SetHistoryEntryRequiresUserGesture(bool) = 0; |
| virtual void SetHyperlinkAuditingEnabled(bool) = 0; |
| virtual void SetIgnoreMainFrameOverflowHiddenQuirk(bool) = 0; |
| virtual void SetImageAnimationPolicy(ImageAnimationPolicy) = 0; |
| virtual void SetImagesEnabled(bool) = 0; |
| virtual void SetInlineTextBoxAccessibilityEnabled(bool) = 0; |
| virtual void SetJavaScriptCanAccessClipboard(bool) = 0; |
| virtual void SetJavaScriptEnabled(bool) = 0; |
| virtual void SetLoadsImagesAutomatically(bool) = 0; |
| virtual void SetLoadWithOverviewMode(bool) = 0; |
| virtual void SetShouldReuseGlobalForUnownedMainFrame(bool) = 0; |
| virtual void SetSavePreviousDocumentResources( |
| SavePreviousDocumentResources) = 0; |
| virtual void SetLocalStorageEnabled(bool) = 0; |
| virtual void SetMainFrameClipsContent(bool) = 0; |
| virtual void SetMainFrameResizesAreOrientationChanges(bool) = 0; |
| virtual void SetMaxTouchPoints(int) = 0; |
| virtual void SetPictureInPictureEnabled(bool) = 0; |
| virtual void SetMediaPlaybackGestureWhitelistScope(const WebString&) = 0; |
| virtual void SetPresentationRequiresUserGesture(bool) = 0; |
| virtual void SetEmbeddedMediaExperienceEnabled(bool) = 0; |
| virtual void SetImmersiveModeEnabled(bool) = 0; |
| virtual void SetMinimumAccelerated2dCanvasSize(int) = 0; |
| virtual void SetMinimumFontSize(int) = 0; |
| virtual void SetMinimumLogicalFontSize(int) = 0; |
| virtual void SetMockScrollbarsEnabled(bool) = 0; |
| virtual void SetHideScrollbars(bool) = 0; |
| virtual void SetOfflineWebApplicationCacheEnabled(bool) = 0; |
| virtual void SetPassiveEventListenerDefault(PassiveEventListenerDefault) = 0; |
| virtual void SetPasswordEchoDurationInSeconds(double) = 0; |
| virtual void SetPasswordEchoEnabled(bool) = 0; |
| virtual void SetPerTilePaintingEnabled(bool) = 0; |
| virtual void SetPictographFontFamily(const WebString&, |
| UScriptCode = USCRIPT_COMMON) = 0; |
| virtual void SetPluginsEnabled(bool) = 0; |
| virtual void SetPresentationReceiver(bool) = 0; |
| virtual void SetAvailablePointerTypes(int) = 0; |
| virtual void SetPrimaryPointerType(PointerType) = 0; |
| virtual void SetAvailableHoverTypes(int) = 0; |
| virtual void SetPrimaryHoverType(HoverType) = 0; |
| virtual void SetPreferHiddenVolumeControls(bool) = 0; |
| virtual void SetRenderVSyncNotificationEnabled(bool) = 0; |
| virtual void SetReportScreenSizeInPhysicalPixelsQuirk(bool) = 0; |
| virtual void SetRubberBandingOnCompositorThread(bool) = 0; |
| virtual void SetSansSerifFontFamily(const WebString&, |
| UScriptCode = USCRIPT_COMMON) = 0; |
| virtual void SetSelectTrailingWhitespaceEnabled(bool) = 0; |
| virtual void SetSelectionIncludesAltImageText(bool) = 0; |
| virtual void SetSelectionStrategy(SelectionStrategyType) = 0; |
| virtual void SetSerifFontFamily(const WebString&, |
| UScriptCode = USCRIPT_COMMON) = 0; |
| virtual void SetShouldPrintBackgrounds(bool) = 0; |
| virtual void SetShouldClearDocumentBackground(bool) = 0; |
| virtual void SetShouldRespectImageOrientation(bool) = 0; |
| virtual void SetShowContextMenuOnMouseUp(bool) = 0; |
| virtual void SetShowFPSCounter(bool) = 0; |
| virtual void SetShowPaintRects(bool) = 0; |
| virtual void SetShrinksViewportContentToFit(bool) = 0; |
| virtual void SetSmartInsertDeleteEnabled(bool) = 0; |
| // Spatial navigation feature, when enabled, improves the experience |
| // of keyboard-controlling the web pages which originally were not designed |
| // for keyboard navigation. It allows to use arrow keys to move focus between |
| // the adjacent HTML elements. As a side effect, it extends the criteria for |
| // elements to be focusable to include any element which has click or keyboard |
| // event handlers specified. User can also trigger click handlers for such |
| // elements using SPACE or ENTER keys. |
| virtual void SetSpatialNavigationEnabled(bool) = 0; |
| virtual void SetSpellCheckEnabledByDefault(bool) = 0; |
| virtual void SetStandardFontFamily(const WebString&, |
| UScriptCode = USCRIPT_COMMON) = 0; |
| virtual void SetStrictMixedContentChecking(bool) = 0; |
| virtual void SetStrictMixedContentCheckingForPlugin(bool) = 0; |
| virtual void SetStrictPowerfulFeatureRestrictions(bool) = 0; |
| virtual void SetStrictlyBlockBlockableMixedContent(bool) = 0; |
| virtual void SetSupportDeprecatedTargetDensityDPI(bool) = 0; |
| virtual void SetSupportsMultipleWindows(bool) = 0; |
| virtual void SetSyncXHRInDocumentsEnabled(bool) = 0; |
| virtual void SetTextAreasAreResizable(bool) = 0; |
| virtual void SetTextAutosizingEnabled(bool) = 0; |
| virtual void SetAccessibilityFontScaleFactor(float) = 0; |
| virtual void SetTextTrackKindUserPreference(TextTrackKindUserPreference) = 0; |
| virtual void SetTextTrackBackgroundColor(const WebString&) = 0; |
| virtual void SetTextTrackFontFamily(const WebString&) = 0; |
| virtual void SetTextTrackFontStyle(const WebString&) = 0; |
| virtual void SetTextTrackFontVariant(const WebString&) = 0; |
| virtual void SetTextTrackMarginPercentage(float) = 0; |
| virtual void SetTextTrackTextColor(const WebString&) = 0; |
| virtual void SetTextTrackTextShadow(const WebString&) = 0; |
| virtual void SetTextTrackTextSize(const WebString&) = 0; |
| virtual void SetThreadedScrollingEnabled(bool) = 0; |
| virtual void SetTouchDragDropEnabled(bool) = 0; |
| virtual void SetBarrelButtonForDragEnabled(bool) = 0; |
| virtual void SetUseLegacyBackgroundSizeShorthandBehavior(bool) = 0; |
| virtual void SetViewportStyle(WebViewportStyle) = 0; |
| virtual void SetUseSolidColorScrollbars(bool) = 0; |
| virtual void SetUseWideViewport(bool) = 0; |
| virtual void SetV8CacheOptions(V8CacheOptions) = 0; |
| virtual void SetValidationMessageTimerMagnification(int) = 0; |
| virtual void SetViewportEnabled(bool) = 0; |
| virtual void SetViewportMetaEnabled(bool) = 0; |
| virtual void SetViewportMetaLayoutSizeQuirk(bool) = 0; |
| virtual void SetViewportMetaMergeContentQuirk(bool) = 0; |
| virtual void SetViewportMetaNonUserScalableQuirk(bool) = 0; |
| virtual void SetViewportMetaZeroValuesQuirk(bool) = 0; |
| virtual void SetWebGLErrorsToConsoleEnabled(bool) = 0; |
| virtual void SetWebSecurityEnabled(bool) = 0; |
| virtual void SetWideViewportQuirkEnabled(bool) = 0; |
| virtual void SetXSSAuditorEnabled(bool) = 0; |
| virtual void SetMediaControlsEnabled(bool) = 0; |
| virtual void SetDoNotUpdateSelectionOnMutatingSelectionRange(bool) = 0; |
| virtual void SetMediaDownloadInProductHelpEnabled(bool) = 0; |
| virtual void SetLowPriorityIframesThreshold(WebEffectiveConnectionType) = 0; |
| |
| protected: |
| ~WebSettings() = default; |
| }; |
| |
| } // namespace blink |
| |
| #endif |