webkitwebprocessextension.c.types
C types for webkitwebprocessextension6 library
Types 34
Enum values used to denote the various levels of console messages.
Enum values used to denote the various sources of console messages.
Enum values used to denote the stock actions for #WebKitContextMenuItem<!-- -->s
Enum values with flags representing the context of a #WebKitHitTestResult.
Enum values used to denote errors happening when sending user messages.
Represents the context menu in a #WebKitWebView.
#WebKitContextMenu represents a context menu containing #WebKitContextMenuItem<!-- -->s in a #WebKitWebView.
When a #WebKitWebView is about to display the context menu, it emits the #WebKitWebView::context-menu signal, which has the #WebKitContextMenu as an argument. You can modify it, adding new submenus that you can create with [webkitwebprocessextension.context_menu.ContextMenu.new_], adding new #WebKitContextMenuItem<!-- -->s with [webkitwebprocessextension.context_menu.ContextMenu.prepend], [webkitwebprocessextension.context_menu.ContextMenu.append] or [webkitwebprocessextension.context_menu.ContextMenu.insert], maybe after having removed the existing ones with [webkitwebprocessextension.context_menu.ContextMenu.removeAll].
GObjectClass parentClassOne item of a #WebKitContextMenu.
The #WebKitContextMenu is composed of #WebKitContextMenuItem<!-- -->s. These items can be created from a #GtkAction, from a #WebKitContextMenuAction or from a #WebKitContextMenuAction and a label. These #WebKitContextMenuAction<!-- -->s denote stock actions for the items. You can also create separators and submenus.
GInitiallyUnownedClass parentClassA web page frame.
Each [webkitwebprocessextension.web_page.WebPage] has at least one main frame, and can have any number of subframes.
GObjectClass parentClassResult of a Hit Test.
A Hit Test is an operation to get context information about a given point in a #WebKitWebView. #WebKitHitTestResult represents the result of a Hit Test. It provides context information about what is at the coordinates of the Hit Test, such as if there's a link, an image or a media.
You can get the context of the HitTestResult with [webkitwebprocessextension.hit_test_result.HitTestResult.getContext] that returns a bitmask of #WebKitHitTestResultContext flags. You can also use [webkitwebprocessextension.hit_test_result.HitTestResult.contextIsLink], [webkitwebprocessextension.hit_test_result.HitTestResult.contextIsImage] and [webkitwebprocessextension.hit_test_result.HitTestResult.contextIsMedia] to determine whether there's a link, image or a media element at the coordinates of the Hit Test. Note that it's possible that several #WebKitHitTestResultContext flags are active at the same time, for example if there's a link containing an image.
When the mouse is moved over a #WebKitWebView a Hit Test is performed for the mouse coordinates and #WebKitWebView::mouse-target-changed signal is emitted with a #WebKitHitTestResult.
GObjectClass parentClassGObjectClass parentClassRepresents a URI request.
A #WebKitURIRequest can be created with a URI using the [webkitwebprocessextension.urirequest.URIRequest.new_] method, and you can get the URI of an existing request with the [webkitwebprocessextension.urirequest.URIRequest.getUri] one.
GObjectClass parentClassRepresents an URI response.
A #WebKitURIResponse contains information such as the URI, the status code, the content length, the mime type, the HTTP status or the suggested filename.
GObjectClass parentClassMessage that can be sent between the UI process and web process extensions.
A WebKitUserMessage is a message that can be used for the communication between the UI process and web process extensions. A WebKitUserMessage always has a name, and it can also include parameters and UNIX file descriptors. Messages can be sent from a #WebKitWebContext to all web process extensions, from a web process extension to its corresponding #WebKitWebContext, and from a #WebKitWebView to its corresponding #WebKitWebPage (and vice versa). One to one messages can be replied to directly with [webkitwebprocessextension.user_message.UserMessage.sendReply].
GInitiallyUnownedClass parentClassAccess to editing capabilities of a #WebKitWebPage.
The WebKitWebEditor provides access to various editing capabilities of a #WebKitWebPage such as a possibility to react to the current selection in #WebKitWebPage.
GObjectClass parentClassForm manager of a #WebKitWebPage in a #WebKitScriptWorld
GObject parentGObjectClass parentClassResult of a Hit Test (Web Process Extensions).
WebKitWebHitTestResult extends #WebKitHitTestResult to provide information about the #WebKitDOMNode in the coordinates of the Hit Test.
GObjectClass parentClassA loaded web page.
GObjectClass parentClassRepresents an extension of the web process.
WebKitWebProcessExtension is a loadable module for the web process. It allows you to execute code in the web process and being able to use the DOM API, to change any request or to inject custom JavaScript code, for example.
To create a WebKitWebProcessExtension you should write a module with an initialization function that could be either webkit_web_process_extension_initialize() with prototype #WebKitWebProcessExtensionInitializeFunction or webkit_web_process_extension_initialize_with_user_data() with prototype #WebKitWebProcessExtensionInitializeWithUserDataFunction. This function has to be public and it has to use the #G_MODULE_EXPORT macro. It is called when the web process is initialized.
static void
web_page_created_callback (WebKitWebProcessExtension *extension,
WebKitWebPage *web_page,
gpointer user_data)
{
g_print ("Page %d created for %s\n",
webkit_web_page_get_id (web_page),
webkit_web_page_get_uri (web_page));
}
G_MODULE_EXPORT void
webkit_web_process_extension_initialize (WebKitWebProcessExtension *extension)
{
g_signal_connect (extension, "page-created",
G_CALLBACK (web_page_created_callback),
NULL);
}The previous piece of code shows a trivial example of an extension that notifies when a #WebKitWebPage is created.
WebKit has to know where it can find the created WebKitWebProcessExtension. To do so you should use the webkit_web_context_set_web_extensions_directory() function. The signal #WebKitWebContext::initialize-web-extensions is the recommended place to call it.
To provide the initialization data used by the webkit_web_process_extension_initialize_with_user_data() function, you have to call webkit_web_context_set_web_extensions_initialization_user_data() with the desired data as parameter. You can see an example of this in the following piece of code:
#define WEB_EXTENSIONS_DIRECTORY // ...
static void
initialize_web_extensions (WebKitWebContext *context,
gpointer user_data)
{
// Web Extensions get a different ID for each Web Process
static guint32 unique_id = 0;
webkit_web_context_set_web_extensions_directory (
context, WEB_EXTENSIONS_DIRECTORY);
webkit_web_context_set_web_extensions_initialization_user_data (
context, g_variant_new_uint32 (unique_id++));
}
int main (int argc, char **argv)
{
g_signal_connect (webkit_web_context_get_default (),
"initialize-web-extensions",
G_CALLBACK (initialize_web_extensions),
NULL);
GtkWidget *view = webkit_web_view_new ();
// ...
}GObjectClass parentClass