Class WebPage
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
WebPage.Builder<B extends WebPage.Builder<B>>
Inner class implementing a builder pattern to construct a GObject with properties.static interface
Functional interface declaration of theConsoleMessageSentCallback
callback.static interface
Functional interface declaration of theContextMenuCallback
callback.static interface
Functional interface declaration of theDocumentLoadedCallback
callback.static interface
Functional interface declaration of theSendRequestCallback
callback.static interface
Functional interface declaration of theUserMessageReceivedCallback
callback.static class
Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass
-
Constructor Summary
ConstructorDescriptionWebPage
(MemorySegment address) Create a WebPage proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected WebPage
asParent()
Returns this instance as if it were its parent type.static WebPage.Builder
<? extends WebPage.Builder> builder()
AWebPage.Builder
object constructs aWebPage
with the specified properties.void
emitConsoleMessageSent
(ConsoleMessage consoleMessage) Emits the "console-message-sent" signal.boolean
emitContextMenu
(ContextMenu contextMenu, WebHitTestResult hitTestResult) Emits the "context-menu" signal.void
Emits the "document-loaded" signal.boolean
emitSendRequest
(URIRequest request, URIResponse redirectedResponse) Emits the "send-request" signal.boolean
emitUserMessageReceived
(UserMessage message) Emits the "user-message-received" signal.Gets theWebKitWebEditor
of aWebKitWebPage
.getFormManager
(@Nullable ScriptWorld world) Get theWebKitWebFormManager
of this WebPage inworld
.long
getId()
Get the identifier of theWebKitWebPage
Returns the main frame of aWebKitWebPage
.static Type
getType()
Get the GType of the WebPage classgetUri()
Returns the current active URI of this WebPage.Emitted when a message is sent to the console.onContextMenu
(WebPage.ContextMenuCallback handler) Emitted before a context menu is displayed in the UI Process to give the application a chance to customize the proposed menu, build its own context menu or pass user data to the UI Process.This signal is emitted when the DOM document of aWebKitWebPage
has been loaded.onSendRequest
(WebPage.SendRequestCallback handler) This signal is emitted whenrequest
is about to be sent to the server.This signal is emitted when aWebKitUserMessage
is received from theWebKitWebView
corresponding towebPage
.void
sendMessageToView
(UserMessage message, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Sendmessage
to theWebKitWebView
corresponding to this WebPage.sendMessageToViewFinish
(AsyncResult result) Finish an asynchronous operation started with webkit_web_page_send_message_to_view().Methods inherited from class org.gnome.gobject.GObject
addToggleRef, addWeakPointer, bindProperty, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, connect, constructed, disconnect, dispatchPropertiesChanged, dispose, dupData, dupQdata, emit, emitNotify, finalize_, forceFloating, freezeNotify, get, getData, getMemoryLayout, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, newInstance, newInstance, newInstance, newInstance, newv, notify_, notify_, notifyByPspec, onNotify, ref, refSink, removeToggleRef, removeWeakPointer, replaceData, replaceQdata, runDispose, set, setData, setDataFull, setProperty, setProperty, setProperty, setQdata, setQdataFull, setv, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref, withProperties
Methods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, getPrivate, readGClass, writeGClass
Methods inherited from class io.github.jwharm.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
WebPage
Create a WebPage proxy instance for the provided memory address.- Parameters:
address
- the memory address of the native object
-
-
Method Details
-
getType
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuper
keyword, but will set the native typeclass function pointers to the parent type. When overriding a native virtual method in Java, "chaining up" withsuper.methodName()
doesn't work, because it invokes the overridden function pointer again. To chain up, callasParent().methodName()
. This will call the native function pointer of this virtual method in the typeclass of the parent type. -
getEditor
Gets theWebKitWebEditor
of aWebKitWebPage
.- Returns:
- the
WebKitWebEditor
-
getFormManager
Get theWebKitWebFormManager
of this WebPage inworld
.- Parameters:
world
- aWebKitScriptWorld
- Returns:
- a
WebKitWebFormManager
-
getId
public long getId()Get the identifier of theWebKitWebPage
- Returns:
- the identifier of this WebPage
-
getMainFrame
Returns the main frame of aWebKitWebPage
.- Returns:
- the
WebKitFrame
that is the main frame of this WebPage
-
getUri
Returns the current active URI of this WebPage.You can monitor the active URI by connecting to the notify::uri signal of this WebPage.
- Returns:
- the current active URI of
webView
ornull
if nothing has been loaded yet.
-
sendMessageToView
public void sendMessageToView(UserMessage message, @Nullable @Nullable Cancellable cancellable, @Nullable @Nullable AsyncReadyCallback callback) Sendmessage
to theWebKitWebView
corresponding to this WebPage. Ifmessage
is floating, it's consumed.If you don't expect any reply, or you simply want to ignore it, you can pass
null
ascallback
. When the operation is finished,callback
will be called. You can then call webkit_web_page_send_message_to_view_finish() to get the message reply.- Parameters:
message
- aWebKitUserMessage
cancellable
- aGCancellable
ornull
to ignorecallback
- AGAsyncReadyCallback
to call when the request is satisfied ornull
-
sendMessageToViewFinish
Finish an asynchronous operation started with webkit_web_page_send_message_to_view().- Parameters:
result
- aGAsyncResult
- Returns:
- a
WebKitUserMessage
with the reply ornull
in case of error. - Throws:
GErrorException
- seeGError
-
onConsoleMessageSent
public SignalConnection<WebPage.ConsoleMessageSentCallback> onConsoleMessageSent(WebPage.ConsoleMessageSentCallback handler) Emitted when a message is sent to the console. This can be a message produced by the use of JavaScript console API, a JavaScript exception, a security error or other errors, warnings, debug or log messages. TheconsoleMessage
contains information of the message.- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitConsoleMessageSent
Emits the "console-message-sent" signal. SeeonConsoleMessageSent(org.gnome.webkit.wpe.WebPage.ConsoleMessageSentCallback)
. -
onContextMenu
public SignalConnection<WebPage.ContextMenuCallback> onContextMenu(WebPage.ContextMenuCallback handler) Emitted before a context menu is displayed in the UI Process to give the application a chance to customize the proposed menu, build its own context menu or pass user data to the UI Process. This signal is useful when the information available in the UI Process is not enough to build or customize the context menu, for example, to add menu entries depending on the node at the coordinates of thehitTestResult
. Otherwise, it's recommended to useWebKitWebView
::context-menu signal instead.- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitContextMenu
Emits the "context-menu" signal. SeeonContextMenu(org.gnome.webkit.wpe.WebPage.ContextMenuCallback)
. -
onDocumentLoaded
public SignalConnection<WebPage.DocumentLoadedCallback> onDocumentLoaded(WebPage.DocumentLoadedCallback handler) This signal is emitted when the DOM document of aWebKitWebPage
has been loaded.You can wait for this signal to get the DOM document
- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitDocumentLoaded
public void emitDocumentLoaded()Emits the "document-loaded" signal. SeeonDocumentLoaded(org.gnome.webkit.wpe.WebPage.DocumentLoadedCallback)
. -
onSendRequest
public SignalConnection<WebPage.SendRequestCallback> onSendRequest(WebPage.SendRequestCallback handler) This signal is emitted whenrequest
is about to be sent to the server. This signal can be used to modify theWebKitURIRequest
that will be sent to the server. You can also cancel the resource load operation by connecting to this signal and returningtrue
.In case of a server redirection this signal is emitted again with the
request
argument containing the new request to be sent to the server due to the redirection and theredirectedResponse
parameter containing the response received by the server for the initial request.Modifications to the
WebKitURIRequest
and its associatedSoupMessageHeaders
will be taken into account when the request is sent over the network.- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitSendRequest
Emits the "send-request" signal. SeeonSendRequest(org.gnome.webkit.wpe.WebPage.SendRequestCallback)
. -
onUserMessageReceived
public SignalConnection<WebPage.UserMessageReceivedCallback> onUserMessageReceived(WebPage.UserMessageReceivedCallback handler) This signal is emitted when aWebKitUserMessage
is received from theWebKitWebView
corresponding towebPage
. 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 been replied, the operation in theWebKitWebView
will finish with errorUserMessageError.USER_MESSAGE_UNHANDLED_MESSAGE
.- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitUserMessageReceived
Emits the "user-message-received" signal. SeeonUserMessageReceived(org.gnome.webkit.wpe.WebPage.UserMessageReceivedCallback)
. -
builder
AWebPage.Builder
object constructs aWebPage
with the specified properties. Use the variousset...()
methods to set properties, and finish construction withWebPage.Builder.build()
.
-