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
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Finish building theWebViewobject.This signal is emitted when the user is challenged with HTTP authentication.onClose(WebView.CloseCallback handler) Emitted when closing aWebKitWebViewis 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 newWebKitWebViewis 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 theWebKitWebViewis about to restore its top level window out of its full screen state.onLoadChanged(WebView.LoadChangedCallback handler) Emitted when a load operation inwebViewchanges.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 createdWebKitWebViewwhen 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 createdWebKitWebViewwhen 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 inwebViewneeds 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 aWebKitUserMessageis received from theWebKitWebPagecorresponding towebView.You can reply to the message using webkit_user_message_send_reply().This signal is emitted when the web process terminates abnormally due toreason.setAutomationPresentationType(AutomationBrowsingContextPresentation automationPresentationType) TheWebKitAutomationBrowsingContextPresentationofWebKitWebView.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 insideWebKitWebVieware editable.setIsControlledByAutomation(boolean isControlledByAutomation) Whether theWebKitWebViewis controlled by automation tools (e.g.setIsMuted(boolean isMuted) Whether theWebKitWebViewaudio is muted.setMicrophoneCaptureState(MediaCaptureState microphoneCaptureState) Capture state of the microphone device.setNetworkSession(NetworkSession networkSession) TheWebKitNetworkSessionof the viewsetRelatedView(WebView relatedView) The relatedWebKitWebViewused when creating the view to share the same web process and network session.setSettings(Settings settings) TheWebKitSettingsof the view.setUserContentManager(UserContentManager userContentManager) TheWebKitUserContentManagerof the view.setWebContext(WebContext webContext) TheWebKitWebContextof the view.setWebExtensionMode(WebExtensionMode webExtensionMode) This configureswebViewto treat the content as a WebExtension.setWebsitePolicies(WebsitePolicies websitePolicies) TheWebKitWebsitePoliciesfor the view.setZoomLevel(double zoomLevel) The zoom level of theWebKitWebViewcontent.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, setLimitEvents, setMarginBottom, setMarginEnd, setMarginStart, setMarginTop, setName, setOpacity, setOverflow, setReceivesDefault, setSensitive, setTooltipMarkup, setTooltipText, setValign, setVexpand, setVexpandSet, setVisible, setWidthRequestMethods inherited from class org.gnome.gobject.GObject.Builder
onNotifyMethods inherited from class org.javagi.gobject.Builder
addBuilderProperty, connect, connect, connectSignals, getArena, getNames, getValuesMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.gnome.gtk.Accessible.Builder
setAccessibleRoleMethods inherited from interface org.javagi.gobject.BuilderInterface
addBuilderProperty, connect, connect, getArena
-
Constructor Details
-
Builder
protected Builder()Default constructor for aBuilderobject.
-
-
Method Details
-
build
Finish building theWebViewobject. 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:
buildin classWebViewBase.Builder<B extends WebView.Builder<B>>- Returns:
- a new instance of
WebViewwith the properties that were set in the Builder object.
-
setAutomationPresentationType
public B setAutomationPresentationType(AutomationBrowsingContextPresentation automationPresentationType) TheWebKitAutomationBrowsingContextPresentationofWebKitWebView. This should only be used when creating a newWebKitWebViewas a response toWebKitAutomationSession::create-web-view signal request. If the new WebView was added to a new tab of current browsing context windowAutomationBrowsingContextPresentation.TABshould be used.- Parameters:
automationPresentationType- the value for theautomation-presentation-typeproperty- Returns:
- the
Builderinstance is returned, to allow method chaining - Since:
- 2.28
-
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.NONEorMediaCaptureState.MUTED.If the capture state of the device is set to
MediaCaptureState.NONEthe 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-stateproperty- Returns:
- the
Builderinstance is returned, to allow method chaining - Since:
- 2.34
-
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
WebKitUserContentManagerand 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-policyproperty- Returns:
- the
Builderinstance is returned, to allow method chaining - Since:
- 2.38
-
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.NONEorMediaCaptureState.MUTED.If the capture state of the device is set to
MediaCaptureState.NONEthe 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-stateproperty- Returns:
- the
Builderinstance is returned, to allow method chaining - Since:
- 2.34
-
setEditable
Whether the pages loaded insideWebKitWebVieware editable. For more information see webkit_web_view_set_editable().- Parameters:
editable- the value for theeditableproperty- Returns:
- the
Builderinstance is returned, to allow method chaining - Since:
- 2.8
-
setIsControlledByAutomation
Whether theWebKitWebViewis controlled by automation tools (e.g. WebDriver, Selenium). This is required for views returned as a response toWebKitAutomationSession::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 viewWebKitWebView:is-controlled-by-automation property. This is the recommended way when creating new views as a response to theWebKitWebView::create signal. For example, as response to JavaScriptwindow.open()calls during an automation session.- Parameters:
isControlledByAutomation- the value for theis-controlled-by-automationproperty- Returns:
- the
Builderinstance is returned, to allow method chaining - Since:
- 2.18
-
setIsMuted
Whether theWebKitWebViewaudio 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-mutedproperty- Returns:
- the
Builderinstance is returned, to allow method chaining - Since:
- 2.30
-
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.NONEorMediaCaptureState.MUTED.If the capture state of the device is set to
MediaCaptureState.NONEthe 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-stateproperty- Returns:
- the
Builderinstance is returned, to allow method chaining - Since:
- 2.34
-
setNetworkSession
TheWebKitNetworkSessionof the view- Parameters:
networkSession- the value for thenetwork-sessionproperty- Returns:
- the
Builderinstance is returned, to allow method chaining - Since:
- 2.40
-
setRelatedView
The relatedWebKitWebViewused 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-viewproperty- Returns:
- the
Builderinstance is returned, to allow method chaining - Since:
- 2.4
-
setSettings
-
setUserContentManager
TheWebKitUserContentManagerof the view.- Parameters:
userContentManager- the value for theuser-content-managerproperty- Returns:
- the
Builderinstance is returned, to allow method chaining - Since:
- 2.6
-
setWebContext
TheWebKitWebContextof the view.- Parameters:
webContext- the value for theweb-contextproperty- Returns:
- the
Builderinstance is returned, to allow method chaining
-
setWebExtensionMode
This configureswebViewto 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-modeproperty- Returns:
- the
Builderinstance is returned, to allow method chaining - Since:
- 2.38
-
setWebsitePolicies
TheWebKitWebsitePoliciesfor the view.- Parameters:
websitePolicies- the value for thewebsite-policiesproperty- Returns:
- the
Builderinstance is returned, to allow method chaining - Since:
- 2.30
-
setZoomLevel
The zoom level of theWebKitWebViewcontent. See webkit_web_view_set_zoom_level() for more details.- Parameters:
zoomLevel- the value for thezoom-levelproperty- Returns:
- the
Builderinstance 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 theWebKitAuthenticationRequestin therequestargument. 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
Builderinstance is returned, to allow method chaining - Since:
- 2.2
- See Also:
-
onClose
Emitted when closing aWebKitWebViewis requested. This occurs when a call is made from JavaScript's <function>window.close</function> function or after trying to close thewebViewwith 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
Builderinstance 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 bycontextMenuwill be shown. </para></listitem> <listitem><para> To prevent the menu from being displayed you can just connect to this signal and returntrueso 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 returnfalseso that the menu will be shown. You can also ignore the proposedWebKitContextMenu, build your ownGtkMenuand returntrueto 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
falsethe context menu represented bycontextMenuwill be shown, if it returntruethe context menu will not be shown.The proposed
WebKitContextMenupassed incontextMenuargument is only valid during the signal emission.- Parameters:
handler- the signal handler- Returns:
- the
Builderinstance 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
Builderinstance is returned, to allow method chaining - See Also:
-
onCreate
Emitted when the creation of a newWebKitWebViewis requested. If this signal is handled the signal handler should return the newly createdWebKitWebView.The
WebKitNavigationActionparameter contains information about the navigation action that triggered this signal.The new
WebKitWebViewmust be related towebView,seeWebKitWebView:related-view for more details.The new
WebKitWebViewshould not be displayed to the user until theWebKitWebView::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
Builderinstance 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. TheWebKitNavigationPolicyDecisionpassed in thedecisionargument 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
decisionargument and returningtrueto block the default signal handler. If the last reference is removed on aWebKitPolicyDecisionand 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 givenWebKitPolicyDecisionwill have any affect.- Parameters:
handler- the signal handler- Returns:
- the
Builderinstance is returned, to allow method chaining - See Also:
-
onEnterFullscreen
Emitted when JavaScript code calls <function>element.webkitRequestFullScreen</function>. If the signal is not handled theWebKitWebViewwill 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
Builderinstance 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
Builderinstance is returned, to allow method chaining - See Also:
-
onLeaveFullscreen
Emitted when theWebKitWebViewis 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
Builderinstance is returned, to allow method chaining - See Also:
-
onLoadChanged
Emitted when a load operation inwebViewchanges. The signal is always emitted withLoadEvent.STARTEDwhen a new load request is made andLoadEvent.FINISHEDwhen 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.REDIRECTEDafter the initial emission withLoadEvent.STARTEDand beforeLoadEvent.COMMITTED. When the page content starts arriving the signal is emitted withLoadEvent.COMMITTEDevent.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
Builderinstance 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 pageloadEventwill beLoadEvent.STARTED. If it happened while loading a committed data sourceloadEventwill beLoadEvent.COMMITTED. Since a load error causes the load operation to finish, the signal WebKitWebView::load-changed will always be emitted withLoadEvent.FINISHEDevent 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
Builderinstance is returned, to allow method chaining - See Also:
-
onLoadFailedWithTlsErrors
Emitted when a TLS error occurs during a load operation. To allow an exception for thiscertificateand the host offailingUriuse webkit_web_context_allow_tls_certificate_for_host().To handle this signal asynchronously you should call g_object_ref() on
certificateand returntrue.If
falseis returned,WebKitWebView::load-failed will be emitted. The load will finish regardless of the returned value.- Parameters:
handler- the signal handler- Returns:
- the
Builderinstance is returned, to allow method chaining - Since:
- 2.6
- 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 thehitTestResultargument. Themodifiersargument is a bitmask ofGdkModifierTypeflags 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
Builderinstance 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
requestargument and returningtrueto block the default signal handler. If the last reference is removed on aWebKitPermissionRequestand the request has not been handled, webkit_permission_request_deny() will be the default action.If the signal is not handled, the
requestwill be completed automatically by the specificWebKitPermissionRequestthat could allow or deny it. Check the documentation of classes implementingWebKitPermissionRequestinterface to know their default action.- Parameters:
handler- the signal handler- Returns:
- the
Builderinstance 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 ofprintOperationto 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 returnfalseto propagate the event so that the print dialog is shown.You can connect to this signal and return
trueto cancel the print operation or implement your own print dialog.- Parameters:
handler- the signal handler- Returns:
- the
Builderinstance 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
queryand returningtrue. If the last reference ofqueryis 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
Builderinstance is returned, to allow method chaining - Since:
- 2.40
- See Also:
-
onReadyToShow
Emitted afterWebKitWebView::create on the newly createdWebKitWebViewwhen 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 theWebKitWindowPropertiesofwebView.See also webkit_web_view_get_window_properties().- Parameters:
handler- the signal handler- Returns:
- the
Builderinstance is returned, to allow method chaining - See Also:
-
onResourceLoadStarted
Emitted when a new resource is going to be loaded. Therequestparameter contains theWebKitURIRequestthat 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
Builderinstance is returned, to allow method chaining - See Also:
-
onRunAsModal
Emitted afterWebKitWebView::ready-to-show on the newly createdWebKitWebViewwhen 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 parentWebKitWebViewuntil the new dialog is closed.- Parameters:
handler- the signal handler- Returns:
- the
Builderinstance 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 theWebKitColorChooserRequestin therequestargument.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
GtkColorChooserfor the user to interact with.- Parameters:
handler- the signal handler- Returns:
- the
Builderinstance is returned, to allow method chaining - Since:
- 2.8
- 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 theWebKitFileChooserRequestin therequestargument.The default signal handler will asynchronously run a regular
GtkFileChooserDialogfor the user to interact with.- Parameters:
handler- the signal handler- Returns:
- the
Builderinstance 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. Thedialogparameter 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
dialogargument and calling webkit_script_dialog_close() when done. If the last reference is removed on aWebKitScriptDialogand the dialog has not been closed, webkit_script_dialog_close() will be called.- Parameters:
handler- the signal handler- Returns:
- the
Builderinstance is returned, to allow method chaining - See Also:
-
onShowNotification
This signal is emitted when a notification should be presented to the user. Thenotificationis 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
Builderinstance is returned, to allow method chaining - Since:
- 2.8
- See Also:
-
onShowOptionMenu
This signal is emitted when a select element inwebViewneeds to display a dropdown menu. This signal can be used to show a custom menu, usingmenuto get the details of all items that should be displayed. The area of the element in theWebKitWebViewis given asrectangleparameter, 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
Builderinstance is returned, to allow method chaining - Since:
- 2.18
- See Also:
-
onSubmitForm
This signal is emitted when a form is about to be submitted. Therequestargument 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
requestargument and calling webkit_form_submission_request_submit() when done to continue with the form submission. If the last reference is removed on aWebKitFormSubmissionRequestand the form has not been submitted, webkit_form_submission_request_submit() will be called.- Parameters:
handler- the signal handler- Returns:
- the
Builderinstance is returned, to allow method chaining - See Also:
-
onUserMessageReceived
This signal is emitted when aWebKitUserMessageis received from theWebKitWebPagecorresponding 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
messageand returningtrue. If the last reference ofmessageis removed and the message has not been replied to, the operation in theWebKitWebPagewill finish with errorUserMessageError.USER_MESSAGE_UNHANDLED_MESSAGE.- Parameters:
handler- the signal handler- Returns:
- the
Builderinstance is returned, to allow method chaining - Since:
- 2.28
- See Also:
-
onWebProcessTerminated
This signal is emitted when the web process terminates abnormally due toreason.- Parameters:
handler- the signal handler- Returns:
- the
Builderinstance is returned, to allow method chaining - Since:
- 2.20
- See Also:
-