Class WebContext.Builder<B extends WebContext.Builder<B>>

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

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

      public B setMemoryPressureSettings(MemoryPressureSettings memoryPressureSettings)
      The WebKitMemoryPressureSettings applied to the web processes created by this context.
      Parameters:
      memoryPressureSettings - the value for the memory-pressure-settings property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.34
    • setTimeZoneOverride

      public B setTimeZoneOverride(String timeZoneOverride)

      The timezone override for this web context. Setting this property provides a better alternative to configure the timezone information for all webviews managed by the WebContext. The other, less optimal, approach is to globally set the TZ environment variable in the process before creating the context. However this approach might not be very convenient and can have side-effects in your application.

      The expected values for this property are defined in the IANA timezone database. See this wikipedia page for instance, https://en.wikipedia.org/wiki/List_of_tz_database_time_zones.

      Parameters:
      timeZoneOverride - the value for the time-zone-override property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.38
    • onAutomationStarted

      public B onAutomationStarted(WebContext.AutomationStartedCallback handler)
      This signal is emitted when a new automation request is made. Note that it will never be emitted if automation is not enabled in context, see webkit_web_context_set_automation_allowed() for more details.
      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.18
      See Also:
    • onInitializeNotificationPermissions

      public B onInitializeNotificationPermissions(WebContext.InitializeNotificationPermissionsCallback handler)
      This signal is emitted when a WebKitWebContext needs to set initial notification permissions for a web process. It is emitted when a new web process is about to be launched, and signals the most appropriate moment to use webkit_web_context_initialize_notification_permissions(). If no notification permissions have changed since the last time this signal was emitted, then there is no need to call webkit_web_context_initialize_notification_permissions() again.
      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.16
      See Also:
    • onInitializeWebProcessExtensions

      public B onInitializeWebProcessExtensions(WebContext.InitializeWebProcessExtensionsCallback handler)
      This signal is emitted when a new web process is about to be launched. It signals the most appropriate moment to use webkit_web_context_set_web_process_extensions_initialization_user_data() and webkit_web_context_set_web_process_extensions_directory().
      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.4
      See Also:
    • onUserMessageReceived

      public B onUserMessageReceived(WebContext.UserMessageReceivedCallback handler)

      This signal is emitted when a WebKitUserMessage is received from a web process extension. You can reply to the message using webkit_user_message_send_reply().

      You can handle the user message asynchronously by calling g_object_ref() on message and returning true.

      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.28
      See Also: