Class WebView.Builder<B extends WebView.Builder<B>>

Type Parameters:
B - the type of the Builder that is returned
All Implemented Interfaces:
Accessible.Builder<B>, BuilderInterface
Enclosing class:
WebView

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

      public B setAutomationPresentationType(AutomationBrowsingContextPresentation automationPresentationType)
      The WebKitAutomationBrowsingContextPresentation of WebKitWebView. This should only be used when creating a new WebKitWebView as a response to WebKitAutomationSession::create-web-view signal request. If the new WebView was added to a new tab of current browsing context window AutomationBrowsingContextPresentation.TAB should be used.
      Parameters:
      automationPresentationType - the value for the automation-presentation-type property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.28
    • setCameraCaptureState

      public B setCameraCaptureState(MediaCaptureState cameraCaptureState)

      Capture state of the camera device. Whenever the user grants a media-request sent by the web page, requesting video capture capabilities (navigator.mediaDevices.getUserMedia({video: true})) this property will be set to MediaCaptureState.ACTIVE.

      The application can monitor this property and provide a visual indicator allowing to optionally deactivate or mute the capture device by setting this property respectively to MediaCaptureState.NONE or MediaCaptureState.MUTED.

      If the capture state of the device is set to MediaCaptureState.NONE the web-page can still re-request the permission to the user. Permission desision caching is left to the application.

      Parameters:
      cameraCaptureState - the value for the camera-capture-state property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.34
    • setDefaultContentSecurityPolicy

      public B setDefaultContentSecurityPolicy(String defaultContentSecurityPolicy)

      The default Content-Security-Policy used by the webview as if it were set by an HTTP header.

      This applies to all content loaded including through navigation or via the various webkit_web_view_load_\* APIs. However do note that many WebKit APIs bypass Content-Security-Policy in general such as WebKitUserContentManager and webkit_web_view_run_javascript().

      Policies are additive so if a website sets its own policy it still applies on top of the policy set here.

      Parameters:
      defaultContentSecurityPolicy - the value for the default-content-security-policy property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.38
    • setDisplayCaptureState

      public B setDisplayCaptureState(MediaCaptureState displayCaptureState)

      Capture state of the display device. Whenever the user grants a media-request sent by the web page, requesting screencasting capabilities (`navigator.mediaDevices.getDisplayMedia() this property will be set to MediaCaptureState.ACTIVE.

      The application can monitor this property and provide a visual indicator allowing to optionally deactivate or mute the capture device by setting this property respectively to MediaCaptureState.NONE or MediaCaptureState.MUTED.

      If the capture state of the device is set to MediaCaptureState.NONE the web-page can still re-request the permission to the user. Permission desision caching is left to the application.

      Parameters:
      displayCaptureState - the value for the display-capture-state property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.34
    • setEditable

      public B setEditable(boolean editable)
      Whether the pages loaded inside WebKitWebView are editable. For more information see webkit_web_view_set_editable().
      Parameters:
      editable - the value for the editable property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.8
    • setIsControlledByAutomation

      public B setIsControlledByAutomation(boolean isControlledByAutomation)

      Whether the WebKitWebView is controlled by automation tools (e.g. WebDriver, Selenium). This is required for views returned as a response to WebKitAutomationSession::create-web-view signal, alongside any view you want to control during an automation session.

      As a ParamFlags.CONSTRUCT_ONLY, you need to set it during construction and it can't be modified.

      If WebKitWebView:related-view is also passed during construction, WebKitWebView:is-controlled-by-automation ignores its own parameter and inherits directly from the related view WebKitWebView:is-controlled-by-automation property. This is the recommended way when creating new views as a response to the WebKitWebView::create signal. For example, as response to JavaScript window.open() calls during an automation session.

      Parameters:
      isControlledByAutomation - the value for the is-controlled-by-automation property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.18
    • setIsMuted

      public B setIsMuted(boolean isMuted)
      Whether the WebKitWebView audio is muted. When true, audio is silenced. It may still be playing, i.e. WebKitWebView:is-playing-audio may be true.
      Parameters:
      isMuted - the value for the is-muted property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.30
    • setMicrophoneCaptureState

      public B setMicrophoneCaptureState(MediaCaptureState microphoneCaptureState)

      Capture state of the microphone device. Whenever the user grants a media-request sent by the web page, requesting audio capture capabilities (navigator.mediaDevices.getUserMedia({audio: true})) this property will be set to MediaCaptureState.ACTIVE.

      The application can monitor this property and provide a visual indicator allowing to optionally deactivate or mute the capture device by setting this property respectively to MediaCaptureState.NONE or MediaCaptureState.MUTED.

      If the capture state of the device is set to MediaCaptureState.NONE the web-page can still re-request the permission to the user. Permission desision caching is left to the application.

      Parameters:
      microphoneCaptureState - the value for the microphone-capture-state property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.34
    • setNetworkSession

      public B setNetworkSession(NetworkSession networkSession)
      The WebKitNetworkSession of the view
      Parameters:
      networkSession - the value for the network-session property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.40
    • setRelatedView

      public B setRelatedView(WebView relatedView)
      The related WebKitWebView used when creating the view to share the same web process and network session. This property is not readable because the related web view is only valid during the object construction.
      Parameters:
      relatedView - the value for the related-view property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.4
    • setSettings

      public B setSettings(Settings settings)
      The WebKitSettings of the view.
      Parameters:
      settings - the value for the settings property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.6
    • setUserContentManager

      public B setUserContentManager(UserContentManager userContentManager)
      The WebKitUserContentManager of the view.
      Parameters:
      userContentManager - the value for the user-content-manager property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.6
    • setWebContext

      public B setWebContext(WebContext webContext)
      The WebKitWebContext of the view.
      Parameters:
      webContext - the value for the web-context property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setWebExtensionMode

      public B setWebExtensionMode(WebExtensionMode webExtensionMode)

      This configures webView to treat the content as a WebExtension.

      Note that this refers to the web standard WebExtensions and not WebKitWebExtensions.

      In practice this limits the Content-Security-Policies that are allowed to be set. Some details can be found in Chrome's documentation.

      Parameters:
      webExtensionMode - the value for the web-extension-mode property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.38
    • setWebsitePolicies

      public B setWebsitePolicies(WebsitePolicies websitePolicies)
      The WebKitWebsitePolicies for the view.
      Parameters:
      websitePolicies - the value for the website-policies property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.30
    • setZoomLevel

      public B setZoomLevel(double zoomLevel)
      The zoom level of the WebKitWebView content. See webkit_web_view_set_zoom_level() for more details.
      Parameters:
      zoomLevel - the value for the zoom-level property
      Returns:
      the Builder instance is returned, to allow method chaining
    • onAuthenticate

      public B onAuthenticate(WebView.AuthenticateCallback handler)

      This signal is emitted when the user is challenged with HTTP authentication. To let the application access or supply the credentials as well as to allow the client application to either cancel the request or perform the authentication, the signal will pass an instance of the WebKitAuthenticationRequest in the request argument. To handle this signal asynchronously you should keep a ref of the request and return true. To disable HTTP authentication entirely, connect to this signal and simply return true.

      The default signal handler will run a default authentication dialog asynchronously for the user to interact with.

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

      public B onClose(WebView.CloseCallback handler)
      Emitted when closing a WebKitWebView is requested. This occurs when a call is made from JavaScript's window.close function or after trying to close the webView with webkit_web_view_try_close(). It is the owner's responsibility to handle this signal to hide or destroy the WebKitWebView, if necessary.
      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      See Also:
    • onContextMenu

      public B onContextMenu(WebView.ContextMenuCallback handler)

      Emitted when a context menu is about to be displayed to give the application a chance to customize the proposed menu, prevent the menu from being displayed, or build its own context menu. To customize the proposed menu you can use webkit_context_menu_prepend(), webkit_context_menu_append() or webkit_context_menu_insert() to add new WebKitContextMenuItems to contextMenu, webkit_context_menu_move_item() to reorder existing items, or webkit_context_menu_remove() to remove an existing item. The signal handler should return false, and the menu represented by contextMenu will be shown. To prevent the menu from being displayed you can just connect to this signal and return true so that the proposed menu will not be shown. To build your own menu, you can remove all items from the proposed menu with webkit_context_menu_remove_all(), add your own items and return false so that the menu will be shown. You can also ignore the proposed WebKitContextMenu, build your own GtkMenu and return true to prevent the proposed menu from being shown. If you just want the default menu to be shown always, simply don't connect to this signal because showing the proposed context menu is the default behaviour.

      If the signal handler returns false the context menu represented by contextMenu will be shown, if it return true the context menu will not be shown.

      The proposed WebKitContextMenu passed in contextMenu argument is only valid during the signal emission.

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

      public B onContextMenuDismissed(WebView.ContextMenuDismissedCallback handler)
      Emitted after WebKitWebView::context-menu signal, if the context menu is shown, to notify that the context menu is dismissed.
      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      See Also:
    • onCreate

      public B onCreate(WebView.CreateCallback handler)

      Emitted when the creation of a new WebKitWebView is requested. If this signal is handled the signal handler should return the newly created WebKitWebView.

      The WebKitNavigationAction parameter contains information about the navigation action that triggered this signal.

      The new WebKitWebView must be related to webView, see WebKitWebView:related-view for more details.

      The new WebKitWebView should not be displayed to the user until the WebKitWebView::ready-to-show signal is emitted.

      For creating views as response to automation tools requests, see the WebKitAutomationSession::create-web-view signal.

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

      public B onDecidePolicy(WebView.DecidePolicyCallback handler)

      This signal is emitted when WebKit is requesting the client to decide a policy decision, such as whether to navigate to a page, open a new window or whether or not to download a resource. The WebKitNavigationPolicyDecision passed in the decision argument is a generic type, but should be casted to a more specific type when making the decision. For example:

      static gboolean
      decide_policy_cb (WebKitWebView *web_view,
                        WebKitPolicyDecision *decision,
                        WebKitPolicyDecisionType type)
      {
          switch (type) {
          case WEBKIT_POLICY_DECISION_TYPE_NAVIGATION_ACTION: {
              WebKitNavigationPolicyDecision *navigation_decision = WEBKIT_NAVIGATION_POLICY_DECISION (decision);
              // Make a policy decision here
              break;
          }
          case WEBKIT_POLICY_DECISION_TYPE_NEW_WINDOW_ACTION: {
              WebKitNavigationPolicyDecision *navigation_decision = WEBKIT_NAVIGATION_POLICY_DECISION (decision);
              // Make a policy decision here
              break;
          }
          case WEBKIT_POLICY_DECISION_TYPE_RESPONSE:
              WebKitResponsePolicyDecision *response = WEBKIT_RESPONSE_POLICY_DECISION (decision);
              // Make a policy decision here
              break;
          default:
              // Making no decision results in webkit_policy_decision_use()
              return FALSE;
          }
          return TRUE;
      }
      

      It is possible to make policy decision asynchronously, by simply calling g_object_ref() on the decision argument and returning true to block the default signal handler. If the last reference is removed on a WebKitPolicyDecision and no decision has been made explicitly, webkit_policy_decision_use() will be the default policy decision. The default signal handler will simply call webkit_policy_decision_use(). Only the first policy decision chosen for a given WebKitPolicyDecision will have any affect.

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

      public B onEnterFullscreen(WebView.EnterFullscreenCallback handler)
      Emitted when JavaScript code calls element.webkitRequestFullScreen. If the signal is not handled the WebKitWebView will proceed to full screen its top level window. This signal can be used by client code to request permission to the user prior doing the full screen transition and eventually prepare the top-level window (e.g. hide some widgets that would otherwise be part of the full screen window).
      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      See Also:
    • onInsecureContentDetected

      @Deprecated public B onInsecureContentDetected(WebView.InsecureContentDetectedCallback handler)
      Deprecated.
      Prior to 2.46, this signal was emitted when insecure content was loaded in a secure content. Since 2.46, this signal is generally no longer emitted.
      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      See Also:
    • onLeaveFullscreen

      public B onLeaveFullscreen(WebView.LeaveFullscreenCallback handler)
      Emitted when the WebKitWebView is about to restore its top level window out of its full screen state. This signal can be used by client code to restore widgets hidden during the WebKitWebView::enter-fullscreen stage for instance.
      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      See Also:
    • onLoadChanged

      public B onLoadChanged(WebView.LoadChangedCallback handler)

      Emitted when a load operation in webView changes. The signal is always emitted with LoadEvent.STARTED when a new load request is made and LoadEvent.FINISHED when the load finishes successfully or due to an error. When the ongoing load operation fails WebKitWebView::load-failed signal is emitted before WebKitWebView::load-changed is emitted with LoadEvent.FINISHED. If a redirection is received from the server, this signal is emitted with LoadEvent.REDIRECTED after the initial emission with LoadEvent.STARTED and before LoadEvent.COMMITTED. When the page content starts arriving the signal is emitted with LoadEvent.COMMITTED event.

      You can handle this signal and use a switch to track any ongoing load operation.

      static void web_view_load_changed (WebKitWebView  *web_view,
                                         WebKitLoadEvent load_event,
                                         gpointer        user_data)
      {
          switch (load_event) {
          case WEBKIT_LOAD_STARTED:
              // New load, we have now a provisional URI
              provisional_uri = webkit_web_view_get_uri (web_view);
              // Here we could start a spinner or update the
              // location bar with the provisional URI
              break;
          case WEBKIT_LOAD_REDIRECTED:
              redirected_uri = webkit_web_view_get_uri (web_view);
              break;
          case WEBKIT_LOAD_COMMITTED:
              // The load is being performed. Current URI is
              // the final one and it won't change unless a new
              // load is requested or a navigation within the
              // same page is performed
              uri = webkit_web_view_get_uri (web_view);
              break;
          case WEBKIT_LOAD_FINISHED:
              // Load finished, we can now stop the spinner
              break;
          }
      }
      
      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      See Also:
    • onLoadFailed

      public B onLoadFailed(WebView.LoadFailedCallback handler)

      Emitted when an error occurs during a load operation. If the error happened when starting to load data for a page loadEvent will be LoadEvent.STARTED. If it happened while loading a committed data source loadEvent will be LoadEvent.COMMITTED. Since a load error causes the load operation to finish, the signal WebKitWebView::load-changed will always be emitted with LoadEvent.FINISHED event right after this one.

      By default, if the signal is not handled, a stock error page will be displayed. You need to handle the signal if you want to provide your own error page.

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

      public B onLoadFailedWithTlsErrors(WebView.LoadFailedWithTlsErrorsCallback handler)

      Emitted when a TLS error occurs during a load operation. To allow an exception for this certificate and the host of failingUri use webkit_web_context_allow_tls_certificate_for_host().

      To handle this signal asynchronously you should call g_object_ref() on certificate and return true.

      If false is returned, WebKitWebView::load-failed will be emitted. The load will finish regardless of the returned value.

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

      public B onMouseTargetChanged(WebView.MouseTargetChangedCallback handler)
      This signal is emitted when the mouse cursor moves over an element such as a link, image or a media element. To determine what type of element the mouse cursor is over, a Hit Test is performed on the current mouse coordinates and the result is passed in the hitTestResult argument. The modifiers argument is a bitmask of GdkModifierType flags indicating the state of modifier keys. The signal is emitted again when the mouse is moved out of the current element with a new hitTestResult.
      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      See Also:
    • onPermissionRequest

      public B onPermissionRequest(WebView.PermissionRequestCallback handler)

      This signal is emitted when WebKit is requesting the client to decide about a permission request, such as allowing the browser to switch to fullscreen mode, sharing its location or similar operations.

      A possible way to use this signal could be through a dialog allowing the user decide what to do with the request:

      static gboolean permission_request_cb (WebKitWebView *web_view,
                                             WebKitPermissionRequest *request,
                                             GtkWindow *parent_window)
      {
          GtkWidget *dialog = gtk_message_dialog_new (parent_window,
                                                      GTK_DIALOG_MODAL,
                                                      GTK_MESSAGE_QUESTION,
                                                      GTK_BUTTONS_YES_NO,
                                                      "Allow Permission Request?");
          gtk_widget_show (dialog);
          gint result = gtk_dialog_run (GTK_DIALOG (dialog));
      
          switch (result) {
          case GTK_RESPONSE_YES:
              webkit_permission_request_allow (request);
              break;
          default:
              webkit_permission_request_deny (request);
              break;
          }
          gtk_widget_destroy (dialog);
      
          return TRUE;
      }
      

      It is possible to handle permission requests asynchronously, by simply calling g_object_ref() on the request argument and returning true to block the default signal handler. If the last reference is removed on a WebKitPermissionRequest and the request has not been handled, webkit_permission_request_deny() will be the default action.

      If the signal is not handled, the request will be completed automatically by the specific WebKitPermissionRequest that could allow or deny it. Check the documentation of classes implementing WebKitPermissionRequest interface to know their default action.

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

      public B onPrint(WebView.PrintCallback handler)

      Emitted when printing is requested on webView, usually by a JavaScript call, before the print dialog is shown. This signal can be used to set the initial print settings and page setup of printOperation to be used as default values in the print dialog. You can call webkit_print_operation_set_print_settings() and webkit_print_operation_set_page_setup() and then return false to propagate the event so that the print dialog is shown.

      You can connect to this signal and return true to cancel the print operation or implement your own print dialog.

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

      public B onQueryPermissionState(WebView.QueryPermissionStateCallback handler)

      This signal allows the User-Agent to respond to permission requests for powerful features, as specified by the Permissions W3C Specification. You can reply to the query using webkit_permission_state_query_finish().

      You can handle the query asynchronously by calling webkit_permission_state_query_ref() on query and returning true. If the last reference of query is removed and the query has not been handled, the query result will be set to WEBKIT_QUERY_PERMISSION_PROMPT.

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

      public B onReadyToShow(WebView.ReadyToShowCallback handler)
      Emitted after WebKitWebView::create on the newly created WebKitWebView when it should be displayed to the user. When this signal is emitted all the information about how the window should look, including size, position, whether the location, status and scrollbars should be displayed, is already set on the WebKitWindowProperties of webView. See also webkit_web_view_get_window_properties().
      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      See Also:
    • onResourceLoadStarted

      public B onResourceLoadStarted(WebView.ResourceLoadStartedCallback handler)
      Emitted when a new resource is going to be loaded. The request parameter contains the WebKitURIRequest that will be sent to the server. You can monitor the load operation by connecting to the different signals of resource.
      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      See Also:
    • onRunAsModal

      public B onRunAsModal(WebView.RunAsModalCallback handler)
      Emitted after WebKitWebView::ready-to-show on the newly created WebKitWebView when JavaScript code calls window.showModalDialog. The purpose of this signal is to allow the client application to prepare the new view to behave as modal. Once the signal is emitted a new main loop will be run to block user interaction in the parent WebKitWebView until the new dialog is closed.
      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      See Also:
    • onRunColorChooser

      public B onRunColorChooser(WebView.RunColorChooserCallback handler)

      This signal is emitted when the user interacts with a HTML element, requesting from WebKit to show a dialog to select a color. To let the application know the details of the color chooser, as well as to allow the client application to either cancel the request or perform an actual color selection, the signal will pass an instance of the WebKitColorChooserRequest in the request argument.

      It is possible to handle this request asynchronously by increasing the reference count of the request.

      The default signal handler will asynchronously run a regular GtkColorChooser for the user to interact with.

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

      public B onRunFileChooser(WebView.RunFileChooserCallback handler)

      This signal is emitted when the user interacts with a HTML element, requesting from WebKit to show a dialog to select one or more files to be uploaded. To let the application know the details of the file chooser, as well as to allow the client application to either cancel the request or perform an actual selection of files, the signal will pass an instance of the WebKitFileChooserRequest in the request argument.

      The default signal handler will asynchronously run a regular GtkFileChooserDialog for the user to interact with.

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

      public B onScriptDialog(WebView.ScriptDialogCallback handler)

      Emitted when JavaScript code calls window.alert, window.confirm or window.prompt, or when onbeforeunload event is fired. The dialog parameter should be used to build the dialog. If the signal is not handled a different dialog will be built and shown depending on the dialog type: ScriptDialogType.ALERT: message dialog with a single Close button. ScriptDialogType.CONFIRM: message dialog with OK and Cancel buttons. ScriptDialogType.PROMPT: message dialog with OK and Cancel buttons and a text entry with the default text. ScriptDialogType.BEFORE_UNLOAD_CONFIRM: message dialog with Stay and Leave buttons.

      It is possible to handle the script dialog request asynchronously, by simply caling webkit_script_dialog_ref() on the dialog argument and calling webkit_script_dialog_close() when done. If the last reference is removed on a WebKitScriptDialog and the dialog has not been closed, webkit_script_dialog_close() will be called.

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

      public B onShowNotification(WebView.ShowNotificationCallback handler)

      This signal is emitted when a notification should be presented to the user. The notification is kept alive until either: 1) the web page cancels it or 2) a navigation happens.

      The default handler will emit a notification using libnotify, if built with support for it.

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

      public B onShowOptionMenu(WebView.ShowOptionMenuCallback handler)

      This signal is emitted when a select element in webView needs to display a dropdown menu. This signal can be used to show a custom menu, using menu to get the details of all items that should be displayed. The area of the element in the WebKitWebView is given as rectangle parameter, it can be used to position the menu. To handle this signal asynchronously you should keep a ref of the menu.

      The default signal handler will pop up a GtkMenu.

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

      public B onSubmitForm(WebView.SubmitFormCallback handler)

      This signal is emitted when a form is about to be submitted. The request argument passed contains information about the text fields of the form. This is typically used to store login information that can be used later to pre-fill the form. The form will not be submitted until webkit_form_submission_request_submit() is called.

      It is possible to handle the form submission request asynchronously, by simply calling g_object_ref() on the request argument and calling webkit_form_submission_request_submit() when done to continue with the form submission. If the last reference is removed on a WebKitFormSubmissionRequest and the form has not been submitted, webkit_form_submission_request_submit() will be called.

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

      public B onUserMessageReceived(WebView.UserMessageReceivedCallback handler)

      This signal is emitted when a WebKitUserMessage is received from the WebKitWebPage corresponding to webView. 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. If the last reference of message is removed and the message has not been replied to, the operation in the WebKitWebPage will finish with error UserMessageError.USER_MESSAGE_UNHANDLED_MESSAGE.

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

      public B onWebProcessTerminated(WebView.WebProcessTerminatedCallback handler)
      This signal is emitted when the web process terminates abnormally due to reason.
      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.20
      See Also: