Class WebView.Builder<B extends WebView.Builder<B>>
- Type Parameters:
B
- the type of the Builder that is returned
- All Implemented Interfaces:
BuilderInterface
,Accessible.Builder<B>
- Enclosing class:
WebView
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Finish building theWebView
object.This signal is emitted when the user is challenged with HTTP authentication.onClose
(WebView.CloseCallback handler) Emitted when closing aWebKitWebView
is requested.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.Emitted afterWebKitWebView
::context-menu signal, if the context menu is shown, to notify that the context menu is dismissed.onCreate
(WebView.CreateCallback handler) Emitted when the creation of a newWebKitWebView
is requested.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.Emitted when JavaScript code calls <function>element.webkitRequestFullScreen</function>.Deprecated.Emitted when theWebKitWebView
is about to restore its top level window out of its full screen state.onLoadChanged
(WebView.LoadChangedCallback handler) Emitted when a load operation inwebView
changes.onLoadFailed
(WebView.LoadFailedCallback handler) Emitted when an error occurs during a load operation.Emitted when a TLS error occurs during a load operation.This signal is emitted when the mouse cursor moves over an element such as a link, image or a media element.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.onPrint
(WebView.PrintCallback handler) Emitted when printing is requested onwebView
, usually by a JavaScript call, before the print dialog is shown.This signal allows the User-Agent to respond to permission requests for powerful features, as specified by the Permissions W3C Specification.onReadyToShow
(WebView.ReadyToShowCallback handler) Emitted afterWebKitWebView
::create on the newly createdWebKitWebView
when it should be displayed to the user.Emitted when a new resource is going to be loaded.onRunAsModal
(WebView.RunAsModalCallback handler) Emitted afterWebKitWebView
::ready-to-show on the newly createdWebKitWebView
when JavaScript code calls <function>window.showModalDialog</function>.This signal is emitted when the user interacts with a <input type='color' /> HTML element, requesting from WebKit to show a dialog to select a color.This signal is emitted when the user interacts with a <input type='file' /> HTML element, requesting from WebKit to show a dialog to select one or more files to be uploaded.Emitted when JavaScript code calls <function>window.alert</function>, <function>window.confirm</function> or <function>window.prompt</function>, or when <function>onbeforeunload</function> event is fired.This signal is emitted when a notification should be presented to the user.This signal is emitted when a select element inwebView
needs to display a dropdown menu.onSubmitForm
(WebView.SubmitFormCallback handler) This signal is emitted when a form is about to be submitted.This signal is emitted when aWebKitUserMessage
is received from theWebKitWebPage
corresponding towebView
.This signal is emitted when the web process terminates abnormally due toreason
.setAutomationPresentationType
(AutomationBrowsingContextPresentation automationPresentationType) TheWebKitAutomationBrowsingContextPresentation
ofWebKitWebView
.setCameraCaptureState
(MediaCaptureState cameraCaptureState) Capture state of the camera device.setDefaultContentSecurityPolicy
(String defaultContentSecurityPolicy) The default Content-Security-Policy used by the webview as if it were set by an HTTP header.setDisplayCaptureState
(MediaCaptureState displayCaptureState) Capture state of the display device.setEditable
(boolean editable) Whether the pages loaded insideWebKitWebView
are editable.setIsControlledByAutomation
(boolean isControlledByAutomation) Whether theWebKitWebView
is controlled by automation.setIsMuted
(boolean isMuted) Whether theWebKitWebView
audio is muted.setMicrophoneCaptureState
(MediaCaptureState microphoneCaptureState) Capture state of the microphone device.setNetworkSession
(NetworkSession networkSession) TheWebKitNetworkSession
of the viewsetRelatedView
(WebView relatedView) The relatedWebKitWebView
used when creating the view to share the same web process and network session.setSettings
(Settings settings) TheWebKitSettings
of the view.setUserContentManager
(UserContentManager userContentManager) TheWebKitUserContentManager
of the view.setWebContext
(WebContext webContext) TheWebKitWebContext
of the view.setWebExtensionMode
(WebExtensionMode webExtensionMode) This configureswebView
to treat the content as a WebExtension.setWebsitePolicies
(WebsitePolicies websitePolicies) TheWebKitWebsitePolicies
for the view.setZoomLevel
(double zoomLevel) The zoom level of theWebKitWebView
content.Methods inherited from class org.gnome.gtk.Widget.Builder
onDestroy, onDirectionChanged, onHide, onKeynavFailed, onMap, onMnemonicActivate, onMoveFocus, onQueryTooltip, onRealize, onShow, onStateFlagsChanged, onUnmap, onUnrealize, setCanFocus, setCanTarget, setCssClasses, setCssName, setCursor, setFocusable, setFocusOnClick, setHalign, setHasTooltip, setHeightRequest, setHexpand, setHexpandSet, setLayoutManager, setMarginBottom, setMarginEnd, setMarginStart, setMarginTop, setName, setOpacity, setOverflow, setReceivesDefault, setSensitive, setTooltipMarkup, setTooltipText, setValign, setVexpand, setVexpandSet, setVisible, setWidthRequest
Methods inherited from class org.gnome.gobject.GObject.Builder
onNotify
Methods inherited from class io.github.jwharm.javagi.gobject.Builder
addBuilderProperty, connect, connect, connectSignals, getArena, getNames, getValues
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.gnome.gtk.Accessible.Builder
setAccessibleRole
Methods inherited from interface io.github.jwharm.javagi.gobject.BuilderInterface
addBuilderProperty, connect, connect, getArena
-
Constructor Details
-
Builder
protected Builder()Default constructor for aBuilder
object.
-
-
Method Details
-
build
Finish building theWebView
object. This will callGObject.withProperties(org.gnome.glib.Type, java.lang.String[], org.gnome.gobject.Value[])
to create a new GObject instance, which is then cast toWebView
.- Overrides:
build
in classWebViewBase.Builder<B extends WebView.Builder<B>>
- Returns:
- a new instance of
WebView
with the properties that were set in the Builder object. - Throws:
UnsupportedPlatformException
- when run on an unsupported platform
-
setAutomationPresentationType
public B setAutomationPresentationType(AutomationBrowsingContextPresentation automationPresentationType) TheWebKitAutomationBrowsingContextPresentation
ofWebKitWebView
. This should only be used when creating a newWebKitWebView
as a response toWebKitAutomationSession
::create-web-view signal request. If the new WebView was added to a new tab of current browsing context windowAutomationBrowsingContextPresentation.TAB
should be used.- Parameters:
automationPresentationType
- the value for theautomation-presentation-type
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setCameraCaptureState
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 toMediaCaptureState.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
orMediaCaptureState.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 thecamera-capture-state
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setDefaultContentSecurityPolicy
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 thedefault-content-security-policy
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setDisplayCaptureState
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 toMediaCaptureState.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
orMediaCaptureState.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 thedisplay-capture-state
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setEditable
Whether the pages loaded insideWebKitWebView
are editable. For more information see webkit_web_view_set_editable().- Parameters:
editable
- the value for theeditable
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setIsControlledByAutomation
Whether theWebKitWebView
is controlled by automation. This should only be used when creating a newWebKitWebView
as a response toWebKitAutomationSession
::create-web-view signal request.- Parameters:
isControlledByAutomation
- the value for theis-controlled-by-automation
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setIsMuted
Whether theWebKitWebView
audio is muted. Whentrue
, audio is silenced. It may still be playing, i.e.WebKitWebView
:is-playing-audio may betrue
.- Parameters:
isMuted
- the value for theis-muted
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setMicrophoneCaptureState
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 toMediaCaptureState.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
orMediaCaptureState.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 themicrophone-capture-state
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setNetworkSession
TheWebKitNetworkSession
of the view- Parameters:
networkSession
- the value for thenetwork-session
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setRelatedView
The relatedWebKitWebView
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 therelated-view
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setSettings
-
setUserContentManager
TheWebKitUserContentManager
of the view.- Parameters:
userContentManager
- the value for theuser-content-manager
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setWebContext
TheWebKitWebContext
of the view.- Parameters:
webContext
- the value for theweb-context
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setWebExtensionMode
This configureswebView
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 theweb-extension-mode
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setWebsitePolicies
TheWebKitWebsitePolicies
for the view.- Parameters:
websitePolicies
- the value for thewebsite-policies
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setZoomLevel
The zoom level of theWebKitWebView
content. See webkit_web_view_set_zoom_level() for more details.- Parameters:
zoomLevel
- the value for thezoom-level
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
onAuthenticate
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 theWebKitAuthenticationRequest
in therequest
argument. To handle this signal asynchronously you should keep a ref of the request and returntrue
. To disable HTTP authentication entirely, connect to this signal and simply returntrue
.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 - See Also:
-
onClose
Emitted when closing aWebKitWebView
is requested. This occurs when a call is made from JavaScript's <function>window.close</function> function or after trying to close thewebView
with webkit_web_view_try_close(). It is the owner's responsibility to handle this signal to hide or destroy theWebKitWebView
, if necessary.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onContextMenu
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. <itemizedlist> <listitem><para> To customize the proposed menu you can use webkit_context_menu_prepend(), webkit_context_menu_append() or webkit_context_menu_insert() to add newWebKitContextMenuItem
<!-- -->s tocontextMenu
, webkit_context_menu_move_item() to reorder existing items, or webkit_context_menu_remove() to remove an existing item. The signal handler should returnfalse
, and the menu represented bycontextMenu
will be shown. </para></listitem> <listitem><para> To prevent the menu from being displayed you can just connect to this signal and returntrue
so that the proposed menu will not be shown. </para></listitem> <listitem><para> 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 returnfalse
so that the menu will be shown. You can also ignore the proposedWebKitContextMenu
, build your ownGtkMenu
and returntrue
to prevent the proposed menu from being shown. </para></listitem> <listitem><para> 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. </para></listitem> </itemizedlist>If the signal handler returns
false
the context menu represented bycontextMenu
will be shown, if it returntrue
the context menu will not be shown.The proposed
WebKitContextMenu
passed incontextMenu
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
Emitted afterWebKitWebView
::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
Emitted when the creation of a newWebKitWebView
is requested. If this signal is handled the signal handler should return the newly createdWebKitWebView
.The
WebKitNavigationAction
parameter contains information about the navigation action that triggered this signal.The new
WebKitWebView
must be related towebView
, seeWebKitWebView
:related-view for more details.The new
WebKitWebView
should not be displayed to the user until theWebKitWebView
::ready-to-show signal is emitted.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onDecidePolicy
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. TheWebKitNavigationPolicyDecision
passed in thedecision
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 returningtrue
to block the default signal handler. If the last reference is removed on aWebKitPolicyDecision
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 givenWebKitPolicyDecision
will have any affect.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onEnterFullscreen
Emitted when JavaScript code calls <function>element.webkitRequestFullScreen</function>. If the signal is not handled theWebKitWebView
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.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
Emitted when theWebKitWebView
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 theWebKitWebView
::enter-fullscreen stage for instance.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onLoadChanged
Emitted when a load operation inwebView
changes. The signal is always emitted withLoadEvent.STARTED
when a new load request is made andLoadEvent.FINISHED
when the load finishes successfully or due to an error. When the ongoing load operation failsWebKitWebView
::load-failed signal is emitted beforeWebKitWebView
::load-changed is emitted withLoadEvent.FINISHED
. If a redirection is received from the server, this signal is emitted withLoadEvent.REDIRECTED
after the initial emission withLoadEvent.STARTED
and beforeLoadEvent.COMMITTED
. When the page content starts arriving the signal is emitted withLoadEvent.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
Emitted when an error occurs during a load operation. If the error happened when starting to load data for a pageloadEvent
will beLoadEvent.STARTED
. If it happened while loading a committed data sourceloadEvent
will beLoadEvent.COMMITTED
. Since a load error causes the load operation to finish, the signal WebKitWebView::load-changed will always be emitted withLoadEvent.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
Emitted when a TLS error occurs during a load operation. To allow an exception for thiscertificate
and the host offailingUri
use webkit_web_context_allow_tls_certificate_for_host().To handle this signal asynchronously you should call g_object_ref() on
certificate
and returntrue
.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 - See Also:
-
onMouseTargetChanged
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 thehitTestResult
argument. Themodifiers
argument is a bitmask ofGdkModifierType
flags indicating the state of modifier keys. The signal is emitted again when the mouse is moved out of the current element with a newhitTestResult
.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onPermissionRequest
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 returningtrue
to block the default signal handler. If the last reference is removed on aWebKitPermissionRequest
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 specificWebKitPermissionRequest
that could allow or deny it. Check the documentation of classes implementingWebKitPermissionRequest
interface to know their default action.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onPrint
Emitted when printing is requested onwebView
, 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 ofprintOperation
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 returnfalse
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
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 returningtrue
. If the last reference ofquery
is removed and the query has not been handled, the query result will be set toWEBKIT_QUERY_PERMISSION_PROMPT
.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onReadyToShow
Emitted afterWebKitWebView
::create on the newly createdWebKitWebView
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 theWebKitWindowProperties
ofwebView
. 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
Emitted when a new resource is going to be loaded. Therequest
parameter contains theWebKitURIRequest
that will be sent to the server. You can monitor the load operation by connecting to the different signals ofresource
.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onRunAsModal
Emitted afterWebKitWebView
::ready-to-show on the newly createdWebKitWebView
when JavaScript code calls <function>window.showModalDialog</function>. 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 parentWebKitWebView
until the new dialog is closed.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onRunColorChooser
This signal is emitted when the user interacts with a <input type='color' /> 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 theWebKitColorChooserRequest
in therequest
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 - See Also:
-
onRunFileChooser
This signal is emitted when the user interacts with a <input type='file' /> 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 theWebKitFileChooserRequest
in therequest
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
Emitted when JavaScript code calls <function>window.alert</function>, <function>window.confirm</function> or <function>window.prompt</function>, or when <function>onbeforeunload</function> event is fired. Thedialog
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: <itemizedlist> <listitem><para>ScriptDialogType.ALERT
: message dialog with a single Close button. </para></listitem> <listitem><para>ScriptDialogType.CONFIRM
: message dialog with OK and Cancel buttons. </para></listitem> <listitem><para>ScriptDialogType.PROMPT
: message dialog with OK and Cancel buttons and a text entry with the default text. </para></listitem> <listitem><para>ScriptDialogType.BEFORE_UNLOAD_CONFIRM
: message dialog with Stay and Leave buttons. </para></listitem> </itemizedlist>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 aWebKitScriptDialog
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
This signal is emitted when a notification should be presented to the user. Thenotification
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 - See Also:
-
onShowOptionMenu
This signal is emitted when a select element inwebView
needs to display a dropdown menu. This signal can be used to show a custom menu, usingmenu
to get the details of all items that should be displayed. The area of the element in theWebKitWebView
is given asrectangle
parameter, it can be used to position the menu. To handle this signal asynchronously you should keep a ref of themenu
.The default signal handler will pop up a
GtkMenu
.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onSubmitForm
This signal is emitted when a form is about to be submitted. Therequest
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 aWebKitFormSubmissionRequest
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
This signal is emitted when aWebKitUserMessage
is received from theWebKitWebPage
corresponding towebView
. 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 returningtrue
. If the last reference ofmessage
is removed and the message has not been replied to, the operation in theWebKitWebPage
will finish with errorUserMessageError.USER_MESSAGE_UNHANDLED_MESSAGE
.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onWebProcessTerminated
This signal is emitted when the web process terminates abnormally due toreason
.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-