Class Settings.Builder<B extends Settings.Builder<B>>

Type Parameters:
B - the type of the Builder that is returned
All Implemented Interfaces:
BuilderInterface
Enclosing class:
Settings

public static class Settings.Builder<B extends Settings.Builder<B>> extends GObject.Builder<B>
Inner class implementing a builder pattern to construct a GObject with properties.
  • Constructor Details

    • Builder

      protected Builder()
      Default constructor for a Builder object.
  • Method Details

    • build

      public Settings build()
      Finish building the Settings object. This will call GObject.withProperties(Type, String[], Value[]) to create a new GObject instance, which is then cast to Settings.
      Overrides:
      build in class GObject.Builder<B extends Settings.Builder<B>>
      Returns:
      a new instance of Settings with the properties that were set in the Builder object.
    • setAllowFileAccessFromFileUrls

      public B setAllowFileAccessFromFileUrls(boolean allowFileAccessFromFileUrls)
      Whether file access is allowed from file URLs. By default, when something is loaded in a WebKitWebView using a file URI, cross origin requests to other file resources are not allowed. This setting allows you to change that behaviour, so that it would be possible to do a XMLHttpRequest of a local file, for example.
      Parameters:
      allowFileAccessFromFileUrls - the value for the allow-file-access-from-file-urls property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.10
    • setAllowModalDialogs

      public B setAllowModalDialogs(boolean allowModalDialogs)
      Determine whether it's allowed to create and run modal dialogs from a WebKitWebView through JavaScript with window.showModalDialog. If it's set to false, the associated WebKitWebView won't be able to create new modal dialogs, so not even the WebKitWebView::create signal will be emitted.
      Parameters:
      allowModalDialogs - the value for the allow-modal-dialogs property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setAllowTopNavigationToDataUrls

      public B setAllowTopNavigationToDataUrls(boolean allowTopNavigationToDataUrls)
      Whether or not the top frame is allowed to navigate to data URLs. It is disabled by default due to the risk it poses when loading untrusted URLs, with data URLs being used in scamming and phishing attacks. In contrast, a scenario where it could be enabled could be an app that embeds a WebView and you have control of the pages being show instead of a generic browser.
      Parameters:
      allowTopNavigationToDataUrls - the value for the allow-top-navigation-to-data-urls property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.28
    • setAllowUniversalAccessFromFileUrls

      public B setAllowUniversalAccessFromFileUrls(boolean allowUniversalAccessFromFileUrls)
      Whether or not JavaScript running in the context of a file scheme URL should be allowed to access content from any origin. By default, when something is loaded in a WebKitWebView using a file scheme URL, access to the local file system and arbitrary local storage is not allowed. This setting allows you to change that behaviour, so that it would be possible to use local storage, for example.
      Parameters:
      allowUniversalAccessFromFileUrls - the value for the allow-universal-access-from-file-urls property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.14
    • setAutoLoadImages

      public B setAutoLoadImages(boolean autoLoadImages)
      Determines whether images should be automatically loaded or not. On devices where network bandwidth is of concern, it might be useful to turn this property off.
      Parameters:
      autoLoadImages - the value for the auto-load-images property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setCursiveFontFamily

      public B setCursiveFontFamily(String cursiveFontFamily)
      The font family used as the default for content using a cursive font.
      Parameters:
      cursiveFontFamily - the value for the cursive-font-family property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setDefaultCharset

      public B setDefaultCharset(String defaultCharset)
      The default text charset used when interpreting content with an unspecified charset.
      Parameters:
      defaultCharset - the value for the default-charset property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setDefaultFontFamily

      public B setDefaultFontFamily(String defaultFontFamily)
      The font family to use as the default for content that does not specify a font.
      Parameters:
      defaultFontFamily - the value for the default-font-family property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setDefaultFontSize

      public B setDefaultFontSize(int defaultFontSize)
      The default font size in pixels to use for content displayed if no font size is specified.
      Parameters:
      defaultFontSize - the value for the default-font-size property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setDefaultMonospaceFontSize

      public B setDefaultMonospaceFontSize(int defaultMonospaceFontSize)
      The default font size in pixels to use for content displayed in monospace font if no font size is specified.
      Parameters:
      defaultMonospaceFontSize - the value for the default-monospace-font-size property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setDisableWebSecurity

      public B setDisableWebSecurity(boolean disableWebSecurity)

      Enable or disable support for Web Security on pages.

      This setting disables the same-origin policy, allowing every website full control over all other websites. This is for use in special environments where you wish to disable all security and allow websites to hack each other. It is impossible to use this setting securely.

      Parameters:
      disableWebSecurity - the value for the disable-web-security property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.40
    • setDrawCompositingIndicators

      public B setDrawCompositingIndicators(boolean drawCompositingIndicators)
      Whether to draw compositing borders and repaint counters on layers drawn with accelerated compositing. This is useful for debugging issues related to web content that is composited with the GPU.
      Parameters:
      drawCompositingIndicators - the value for the draw-compositing-indicators property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setEnable2dCanvasAcceleration

      public B setEnable2dCanvasAcceleration(boolean enable2dCanvasAcceleration)
      Enable or disable 2D canvas acceleration. If this setting is enabled, the 2D canvas will be accelerated even if Skia CPU is used for rendering. However, the canvas can be unaccelerated even when this setting is enabled, for other reasons like its size or when willReadFrequently property is used.
      Parameters:
      enable2dCanvasAcceleration - the value for the enable-2d-canvas-acceleration property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.46
    • setEnableBackForwardNavigationGestures

      public B setEnableBackForwardNavigationGestures(boolean enableBackForwardNavigationGestures)
      Enable or disable horizontal swipe gesture for back-forward navigation.
      Parameters:
      enableBackForwardNavigationGestures - the value for the enable-back-forward-navigation-gestures property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.24
    • setEnableCaretBrowsing

      public B setEnableCaretBrowsing(boolean enableCaretBrowsing)
      Whether to enable accessibility enhanced keyboard navigation.
      Parameters:
      enableCaretBrowsing - the value for the enable-caret-browsing property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setEnableDeveloperExtras

      public B setEnableDeveloperExtras(boolean enableDeveloperExtras)
      Determines whether or not developer tools, such as the Web Inspector, are enabled.
      Parameters:
      enableDeveloperExtras - the value for the enable-developer-extras property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setEnableDnsPrefetching

      @Deprecated public B setEnableDnsPrefetching(boolean enableDnsPrefetching)
      Deprecated.
      Determines whether or not to prefetch domain names. DNS prefetching attempts to resolve domain names before a user tries to follow a link.
      Parameters:
      enableDnsPrefetching - the value for the enable-dns-prefetching property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setEnableEncryptedMedia

      public B setEnableEncryptedMedia(boolean enableEncryptedMedia)

      Enable or disable support for Encrypted Media API on pages. EncryptedMedia is an experimental JavaScript API for playing encrypted media in HTML. This property will only work as intended if the EncryptedMedia feature is enabled at build time with the ENABLE_ENCRYPTED_MEDIA flag.

      See https://www.w3.org/TR/encrypted-media/

      Parameters:
      enableEncryptedMedia - the value for the enable-encrypted-media property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.20
    • setEnableFullscreen

      public B setEnableFullscreen(boolean enableFullscreen)
      Whether to enable the Javascript Fullscreen API. The API allows any HTML element to request fullscreen display. See also the current draft of the spec: http://www.w3.org/TR/fullscreen/
      Parameters:
      enableFullscreen - the value for the enable-fullscreen property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setEnableHtml5Database

      public B setEnableHtml5Database(boolean enableHtml5Database)
      Whether to enable HTML5 client-side SQL database support (IndexedDB).
      Parameters:
      enableHtml5Database - the value for the enable-html5-database property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setEnableHtml5LocalStorage

      public B setEnableHtml5LocalStorage(boolean enableHtml5LocalStorage)

      Whether to enable HTML5 local storage support. Local storage provides simple synchronous storage access.

      HTML5 local storage specification is available at http://dev.w3.org/html5/webstorage/.

      Parameters:
      enableHtml5LocalStorage - the value for the enable-html5-local-storage property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setEnableHyperlinkAuditing

      @Deprecated public B setEnableHyperlinkAuditing(boolean enableHyperlinkAuditing)
      Deprecated.

      Determines whether or not hyperlink auditing is enabled.

      The hyperlink auditing specification is available at http://www.whatwg.org/specs/web-apps/current-work/multipage/links.htmlhyperlink-auditing.

      Parameters:
      enableHyperlinkAuditing - the value for the enable-hyperlink-auditing property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setEnableJavascript

      public B setEnableJavascript(boolean enableJavascript)
      Determines whether or not JavaScript executes within a page.
      Parameters:
      enableJavascript - the value for the enable-javascript property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setEnableJavascriptMarkup

      public B setEnableJavascriptMarkup(boolean enableJavascriptMarkup)
      Determines whether or not JavaScript markup is allowed in document. When this setting is disabled, all JavaScript-related elements and attributes are removed from the document during parsing. Note that executing JavaScript is still allowed if WebKitSettings:enable-javascript is true.
      Parameters:
      enableJavascriptMarkup - the value for the enable-javascript-markup property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.24
    • setEnableMedia

      public B setEnableMedia(boolean enableMedia)
      Enable or disable support for media playback on pages. This setting is enabled by default. Disabling it means <audio>, <track> and <video> elements will have playback support disabled.
      Parameters:
      enableMedia - the value for the enable-media property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.26
    • setEnableMediaCapabilities

      public B setEnableMediaCapabilities(boolean enableMediaCapabilities)

      Enable or disable support for MediaCapabilities on pages. This specification intends to provide APIs to allow websites to make an optimal decision when picking media content for the user. The APIs will expose information about the decoding and encoding capabilities for a given format but also output capabilities to find the best match based on the device’s display.

      See also https://wicg.github.io/media-capabilities/

      Parameters:
      enableMediaCapabilities - the value for the enable-media-capabilities property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.22
    • setEnableMediaStream

      public B setEnableMediaStream(boolean enableMediaStream)

      Enable or disable support for MediaStream on pages. MediaStream is an experimental proposal for allowing web pages to access audio and video devices for capture.

      See also http://dev.w3.org/2011/webrtc/editor/getusermedia.html

      Parameters:
      enableMediaStream - the value for the enable-media-stream property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.4
    • setEnableMediasource

      public B setEnableMediasource(boolean enableMediasource)

      Enable or disable support for MediaSource on pages. MediaSource extends HTMLMediaElement to allow JavaScript to generate media streams for playback.

      See also http://www.w3.org/TR/media-source/

      Parameters:
      enableMediasource - the value for the enable-mediasource property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.4
    • setEnableMockCaptureDevices

      public B setEnableMockCaptureDevices(boolean enableMockCaptureDevices)
      Enable or disable the Mock Capture Devices. Those are fake Microphone and Camera devices to be used as MediaStream sources.
      Parameters:
      enableMockCaptureDevices - the value for the enable-mock-capture-devices property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.24
    • setEnableOfflineWebApplicationCache

      @Deprecated public B setEnableOfflineWebApplicationCache(boolean enableOfflineWebApplicationCache)
      Deprecated.
      Unsupported setting. This property does nothing.
      Parameters:
      enableOfflineWebApplicationCache - the value for the enable-offline-web-application-cache property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setEnablePageCache

      public B setEnablePageCache(boolean enablePageCache)
      Enable or disable the page cache. Disabling the page cache is generally only useful for special circumstances like low-memory scenarios or special purpose applications like static HTML viewers. This setting only controls the Page Cache, this cache is different than the disk-based or memory-based traditional resource caches, its point is to make going back and forth between pages much faster. For details about the different types of caches and their purposes see: http://webkit.org/blog/427/webkit-page-cache-i-the-basics/
      Parameters:
      enablePageCache - the value for the enable-page-cache property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setEnableResizableTextAreas

      public B setEnableResizableTextAreas(boolean enableResizableTextAreas)
      Determines whether or not text areas can be resized.
      Parameters:
      enableResizableTextAreas - the value for the enable-resizable-text-areas property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setEnableSiteSpecificQuirks

      public B setEnableSiteSpecificQuirks(boolean enableSiteSpecificQuirks)
      Whether to turn on site-specific quirks. Turning this on will tell WebKit to use some site-specific workarounds for better web compatibility. For example, older versions of MediaWiki will incorrectly send to WebKit a CSS file with KHTML workarounds. By turning on site-specific quirks, WebKit will special-case this and other cases to make some specific sites work.
      Parameters:
      enableSiteSpecificQuirks - the value for the enable-site-specific-quirks property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setEnableSmoothScrolling

      public B setEnableSmoothScrolling(boolean enableSmoothScrolling)
      Enable or disable smooth scrolling.
      Parameters:
      enableSmoothScrolling - the value for the enable-smooth-scrolling property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setEnableSpatialNavigation

      public B setEnableSpatialNavigation(boolean enableSpatialNavigation)
      Whether to enable Spatial Navigation. This feature consists in the ability to navigate between focusable elements in a Web page, such as hyperlinks and form controls, by using Left, Right, Up and Down arrow keys. For example, if an user presses the Right key, heuristics determine whether there is an element they might be trying to reach towards the right, and if there are multiple elements, which element they probably wants.
      Parameters:
      enableSpatialNavigation - the value for the enable-spatial-navigation property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.4
    • setEnableTabsToLinks

      public B setEnableTabsToLinks(boolean enableTabsToLinks)
      Determines whether the tab key cycles through the elements on the page. When this setting is enabled, users will be able to focus the next element in the page by pressing the tab key. If the selected element is editable, then pressing tab key will insert the tab character.
      Parameters:
      enableTabsToLinks - the value for the enable-tabs-to-links property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setEnableWebaudio

      public B setEnableWebaudio(boolean enableWebaudio)

      Enable or disable support for WebAudio on pages. WebAudio is an API for processing and synthesizing audio in web applications

      See also https://webaudio.github.io/web-audio-api

      Parameters:
      enableWebaudio - the value for the enable-webaudio property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setEnableWebgl

      public B setEnableWebgl(boolean enableWebgl)
      Enable or disable support for WebGL on pages. WebGL enables web content to use an API based on OpenGL ES 2.0.
      Parameters:
      enableWebgl - the value for the enable-webgl property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setEnableWebrtc

      public B setEnableWebrtc(boolean enableWebrtc)

      Enable WebRTC support for loaded pages.

      Enabling this setting implies that Settings:enable-media-stream will be enabled as well.

      See also https://www.w3.org/TR/webrtc/

      Parameters:
      enableWebrtc - the value for the enable-webrtc property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.38
    • setEnableWriteConsoleMessagesToStdout

      public B setEnableWriteConsoleMessagesToStdout(boolean enableWriteConsoleMessagesToStdout)
      Enable or disable writing console messages to stdout. These are messages sent to the console with console.log and related methods.
      Parameters:
      enableWriteConsoleMessagesToStdout - the value for the enable-write-console-messages-to-stdout property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.2
    • setFantasyFontFamily

      public B setFantasyFontFamily(String fantasyFontFamily)
      The font family used as the default for content using a fantasy font.
      Parameters:
      fantasyFontFamily - the value for the fantasy-font-family property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setHardwareAccelerationPolicy

      public B setHardwareAccelerationPolicy(HardwareAccelerationPolicy hardwareAccelerationPolicy)

      The WebKitHardwareAccelerationPolicy to decide how to enable and disable hardware acceleration. Disabling hardware acceleration might cause some websites to not render correctly or consume more CPU.

      Note that changing this setting might not be possible if hardware acceleration is not supported by the hardware or the system. In that case, you can get the value to know the actual policy being used, but changing the setting will not have any effect.

      Parameters:
      hardwareAccelerationPolicy - the value for the hardware-acceleration-policy property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.16
    • setJavascriptCanAccessClipboard

      public B setJavascriptCanAccessClipboard(boolean javascriptCanAccessClipboard)
      Whether JavaScript can access the clipboard. The default value is false. If set to true, document.execCommand() allows cut, copy and paste commands.
      Parameters:
      javascriptCanAccessClipboard - the value for the javascript-can-access-clipboard property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setJavascriptCanOpenWindowsAutomatically

      public B setJavascriptCanOpenWindowsAutomatically(boolean javascriptCanOpenWindowsAutomatically)
      Whether JavaScript can open popup windows automatically without user intervention.
      Parameters:
      javascriptCanOpenWindowsAutomatically - the value for the javascript-can-open-windows-automatically property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setLoadIconsIgnoringImageLoadSetting

      @Deprecated public B setLoadIconsIgnoringImageLoadSetting(boolean loadIconsIgnoringImageLoadSetting)
      Deprecated.
      Unsupported setting. This property does nothing.
      Parameters:
      loadIconsIgnoringImageLoadSetting - the value for the load-icons-ignoring-image-load-setting property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setMathFontFamily

      public B setMathFontFamily(String mathFontFamily)
      The font family used as the default for content using a math font.
      Parameters:
      mathFontFamily - the value for the math-font-family property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.52
    • setMediaContentTypesRequiringHardwareSupport

      public B setMediaContentTypesRequiringHardwareSupport(String mediaContentTypesRequiringHardwareSupport)
      List of media content types requiring hardware support, split by semicolons (:). For example: 'video/webm; codecs="vp*":video/mp4; codecs="avc*":video/* codecs="av1*"'.
      Parameters:
      mediaContentTypesRequiringHardwareSupport - the value for the media-content-types-requiring-hardware-support property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.30
    • setMediaPlaybackAllowsInline

      public B setMediaPlaybackAllowsInline(boolean mediaPlaybackAllowsInline)
      Whether media playback is full-screen only or inline playback is allowed. This is true by default, so media playback can be inline. Setting it to false allows specifying that media playback should be always fullscreen.
      Parameters:
      mediaPlaybackAllowsInline - the value for the media-playback-allows-inline property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setMediaPlaybackRequiresUserGesture

      public B setMediaPlaybackRequiresUserGesture(boolean mediaPlaybackRequiresUserGesture)
      Whether a user gesture (such as clicking the play button) would be required to start media playback or load media. This is off by default, so media playback could start automatically. Setting it on requires a gesture by the user to start playback, or to load the media.
      Parameters:
      mediaPlaybackRequiresUserGesture - the value for the media-playback-requires-user-gesture property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setMinimumFontSize

      public B setMinimumFontSize(int minimumFontSize)
      The minimum font size in pixels used to display text. This setting controls the absolute smallest size. Values other than 0 can potentially break page layouts.
      Parameters:
      minimumFontSize - the value for the minimum-font-size property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setMonospaceFontFamily

      public B setMonospaceFontFamily(String monospaceFontFamily)
      The font family used as the default for content using a monospace font.
      Parameters:
      monospaceFontFamily - the value for the monospace-font-family property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setPictographFontFamily

      public B setPictographFontFamily(String pictographFontFamily)
      The font family used as the default for content using a pictograph font.
      Parameters:
      pictographFontFamily - the value for the pictograph-font-family property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setPrintBackgrounds

      public B setPrintBackgrounds(boolean printBackgrounds)
      Whether background images should be drawn during printing.
      Parameters:
      printBackgrounds - the value for the print-backgrounds property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setSansSerifFontFamily

      public B setSansSerifFontFamily(String sansSerifFontFamily)
      The font family used as the default for content using a sans-serif font.
      Parameters:
      sansSerifFontFamily - the value for the sans-serif-font-family property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setSerifFontFamily

      public B setSerifFontFamily(String serifFontFamily)
      The font family used as the default for content using a serif font.
      Parameters:
      serifFontFamily - the value for the serif-font-family property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setUserAgent

      public B setUserAgent(String userAgent)

      The user-agent string used by WebKit. Unusual user-agent strings may cause web content to render incorrectly or fail to run, as many web pages are written to parse the user-agent strings of only the most popular browsers. Therefore, it's typically better to not completely override the standard user-agent, but to use webkit_settings_set_user_agent_with_application_details() instead.

      If this property is set to the empty string or null, it will revert to the standard user-agent.

      Parameters:
      userAgent - the value for the user-agent property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setWebrtcUdpPortsRange

      public B setWebrtcUdpPortsRange(String webrtcUdpPortsRange)

      Allow customization of the WebRTC UDP ports range.

      In some constrained environments where a firewall blocks UDP network traffic excepted on a specific port range, this settings can be used to give hints to the WebRTC backend regarding which ports to allocate. The format is min-port:max-port, so for instance 20000:30000. The default empty string value means the OS will use no hints from the WebRTC backend. Using 0 for one of the values is allowed and means the value is unspecified.

      Parameters:
      webrtcUdpPortsRange - the value for the webrtc-udp-ports-range property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.48
    • setZoomTextOnly

      public B setZoomTextOnly(boolean zoomTextOnly)
      Whether WebKitWebView:zoom-level affects only the text of the page or all the contents. Other contents containing text like form controls will be also affected by zoom factor when this property is enabled.
      Parameters:
      zoomTextOnly - the value for the zoom-text-only property
      Returns:
      the Builder instance is returned, to allow method chaining