webkitwebprocessextension

package
v0.0.0-...-dee1973 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 8, 2024 License: MPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	GTypeContextMenu = coreglib.Type(C.webkit_context_menu_get_type())
)

GType values.

View Source
var (
	GTypeContextMenuItem = coreglib.Type(C.webkit_context_menu_item_get_type())
)

GType values.

View Source
var (
	GTypeFrame = coreglib.Type(C.webkit_frame_get_type())
)

GType values.

View Source
var (
	GTypeHitTestResult = coreglib.Type(C.webkit_hit_test_result_get_type())
)

GType values.

View Source
var (
	GTypeScriptWorld = coreglib.Type(C.webkit_script_world_get_type())
)

GType values.

View Source
var (
	GTypeURIRequest = coreglib.Type(C.webkit_uri_request_get_type())
)

GType values.

View Source
var (
	GTypeURIResponse = coreglib.Type(C.webkit_uri_response_get_type())
)

GType values.

View Source
var (
	GTypeUserMessage = coreglib.Type(C.webkit_user_message_get_type())
)

GType values.

View Source
var (
	GTypeWebEditor = coreglib.Type(C.webkit_web_editor_get_type())
)

GType values.

View Source
var (
	GTypeWebFormManager = coreglib.Type(C.webkit_web_form_manager_get_type())
)

GType values.

View Source
var (
	GTypeWebHitTestResult = coreglib.Type(C.webkit_web_hit_test_result_get_type())
)

GType values.

View Source
var (
	GTypeWebPage = coreglib.Type(C.webkit_web_page_get_type())
)

GType values.

View Source
var (
	GTypeWebProcessExtension = coreglib.Type(C.webkit_web_process_extension_get_type())
)

GType values.

Functions

func UserMessageErrorQuark

func UserMessageErrorQuark() glib.Quark

UserMessageErrorQuark gets the quark for the domain of user message errors.

The function returns the following values:

  • quark: user message error domain.

func WebFormManagerInputElementAutoFill

func WebFormManagerInputElementAutoFill(element *javascriptcore.Value, value string)

WebFormManagerInputElementAutoFill: set the value of an HTML input element as if it had been edited by the user, triggering a change event, and set it as filled automatically. If element is not an HTML input element this function does nothing.

The function takes the following parameters:

  • element: CValue.
  • value: text to set.

func WebFormManagerInputElementIsAutoFilled

func WebFormManagerInputElementIsAutoFilled(element *javascriptcore.Value) bool

WebFormManagerInputElementIsAutoFilled: get whether element is an HTML input element that has been filled automatically.

The function takes the following parameters:

  • element: CValue.

The function returns the following values:

  • ok: TRUE if element is an HTML input element that has been filled automatically, or FALSE otherwise.

func WebFormManagerInputElementIsUserEdited

func WebFormManagerInputElementIsUserEdited(element *javascriptcore.Value) bool

WebFormManagerInputElementIsUserEdited: get whether element is an HTML text input element that has been edited by a user action.

The function takes the following parameters:

  • element: CValue.

The function returns the following values:

  • ok: TRUE if element is an HTML text input element that has been edited by a user action, or FALSE otherwise.

Types

type ContextMenu

type ContextMenu struct {
	*coreglib.Object
	// contains filtered or unexported fields
}

ContextMenu represents the context menu in a KitWebView.

KitContextMenu represents a context menu containing KitContextMenuItem<!-- -->s in a KitWebView.

When a KitWebView is about to display the context menu, it emits the KitWebView::context-menu signal, which has the KitContextMenu as an argument. You can modify it, adding new submenus that you can create with webkit_context_menu_new(), adding new KitContextMenuItem<!-- -->s with webkit_context_menu_prepend(), webkit_context_menu_append() or webkit_context_menu_insert(), maybe after having removed the existing ones with webkit_context_menu_remove_all().

func NewContextMenu

func NewContextMenu() *ContextMenu

NewContextMenu creates a new KitContextMenu object.

Creates a new KitContextMenu object to be used as a submenu of an existing KitContextMenu. The context menu of a KitWebView is created by the view and passed as an argument of KitWebView::context-menu signal. To add items to the menu use webkit_context_menu_prepend(), webkit_context_menu_append() or webkit_context_menu_insert(). See also webkit_context_menu_new_with_items() to create a KitContextMenu with a list of initial items.

The function returns the following values:

  • contextMenu: newly created KitContextMenu object.

func NewContextMenuWithItems

func NewContextMenuWithItems(items []*ContextMenuItem) *ContextMenu

NewContextMenuWithItems creates a new KitContextMenu object with the given items.

Creates a new KitContextMenu object to be used as a submenu of an existing KitContextMenu with the given initial items. See also webkit_context_menu_new().

The function takes the following parameters:

  • items of KitContextMenuItem.

The function returns the following values:

  • contextMenu: newly created KitContextMenu object.

func (*ContextMenu) Append

func (menu *ContextMenu) Append(item *ContextMenuItem)

Append adds item at the end of the menu.

The function takes the following parameters:

  • item to add.

func (*ContextMenu) Event

func (menu *ContextMenu) Event() gdk.Eventer

Event gets the Event that triggered the context menu. This function only returns a valid Event when called for a KitContextMenu passed to KitWebView::context-menu signal; in all other cases, NULL is returned.

The returned Event is expected to be one of the following types: <itemizedlist> <listitem><para> a EventButton of type GDK_BUTTON_PRESS when the context menu was triggered with mouse. </para></listitem> <listitem><para> a EventKey of type GDK_KEY_PRESS if the keyboard was used to show the menu. </para></listitem> <listitem><para> a generic Event of type GDK_NOTHING when the Widget::popup-menu signal was used to show the context menu. </para></listitem> </itemizedlist>.

The function returns the following values:

  • event: menu event or NULL.

func (*ContextMenu) First

func (menu *ContextMenu) First() *ContextMenuItem

First gets the first item in the menu.

The function returns the following values:

  • contextMenuItem: first KitContextMenuItem of menu, or NULL if the KitContextMenu is empty.

func (*ContextMenu) Insert

func (menu *ContextMenu) Insert(item *ContextMenuItem, position int)

Insert inserts item into the menu at the given position.

If position is negative, or is larger than the number of items in the KitContextMenu, the item is added on to the end of the menu. The first position is 0.

The function takes the following parameters:

  • item to add.
  • position to insert the item.

func (*ContextMenu) ItemAtPosition

func (menu *ContextMenu) ItemAtPosition(position uint) *ContextMenuItem

ItemAtPosition gets the item at the given position in the menu.

The function takes the following parameters:

  • position of the item, counting from 0.

The function returns the following values:

  • contextMenuItem at position position in menu, or NULL if the position is off the end of the menu.

func (*ContextMenu) Items

func (menu *ContextMenu) Items() []*ContextMenuItem

Items returns the item list of menu.

The function returns the following values:

  • list of KitContextMenuItem<!-- -->s.

func (*ContextMenu) Last

func (menu *ContextMenu) Last() *ContextMenuItem

Last gets the last item in the menu.

The function returns the following values:

  • contextMenuItem: last KitContextMenuItem of menu, or NULL if the KitContextMenu is empty.

func (*ContextMenu) MoveItem

func (menu *ContextMenu) MoveItem(item *ContextMenuItem, position int)

MoveItem moves item to the given position in the menu.

If position is negative, or is larger than the number of items in the KitContextMenu, the item is added on to the end of the menu. The first position is 0.

The function takes the following parameters:

  • item to add.
  • position: new position to move the item.

func (*ContextMenu) NItems

func (menu *ContextMenu) NItems() uint

NItems gets the length of the menu.

The function returns the following values:

  • guint: number of KitContextMenuItem<!-- -->s in menu.

func (*ContextMenu) Prepend

func (menu *ContextMenu) Prepend(item *ContextMenuItem)

Prepend adds item at the beginning of the menu.

The function takes the following parameters:

  • item to add.

func (*ContextMenu) Remove

func (menu *ContextMenu) Remove(item *ContextMenuItem)

Remove removes item from the menu.

See also webkit_context_menu_remove_all() to remove all items.

The function takes the following parameters:

  • item to remove.

func (*ContextMenu) RemoveAll

func (menu *ContextMenu) RemoveAll()

RemoveAll removes all items of the menu.

func (*ContextMenu) SetUserData

func (menu *ContextMenu) SetUserData(userData *glib.Variant)

SetUserData sets user data to menu.

This function can be used from a Web Process extension to set user data that can be retrieved from the UI Process using webkit_context_menu_get_user_data(). If the user_data #GVariant is floating, it is consumed.

The function takes the following parameters:

  • userData: #GVariant.

func (*ContextMenu) UserData

func (menu *ContextMenu) UserData() *glib.Variant

UserData gets the user data of menu.

This function can be used from the UI Process to get user data previously set from the Web Process with webkit_context_menu_set_user_data().

The function returns the following values:

  • variant: user data of menu, or NULL if menu doesn't have user data.

type ContextMenuAction

type ContextMenuAction C.gint

ContextMenuAction: enum values used to denote the stock actions for KitContextMenuItem<!-- -->s.

const (
	// ContextMenuActionNoAction: no action, used by separator menu items.
	ContextMenuActionNoAction ContextMenuAction = 0
	// ContextMenuActionOpenLink: open current link.
	ContextMenuActionOpenLink ContextMenuAction = 1
	// ContextMenuActionOpenLinkInNewWindow: open current link in a new window.
	ContextMenuActionOpenLinkInNewWindow ContextMenuAction = 2
	// ContextMenuActionDownloadLinkToDisk: download link destination.
	ContextMenuActionDownloadLinkToDisk ContextMenuAction = 3
	// ContextMenuActionCopyLinkToClipboard: copy link location to the
	// clipboard.
	ContextMenuActionCopyLinkToClipboard ContextMenuAction = 4
	// ContextMenuActionOpenImageInNewWindow: open current image in a new
	// window.
	ContextMenuActionOpenImageInNewWindow ContextMenuAction = 5
	// ContextMenuActionDownloadImageToDisk: download current image.
	ContextMenuActionDownloadImageToDisk ContextMenuAction = 6
	// ContextMenuActionCopyImageToClipboard: copy current image to the
	// clipboard.
	ContextMenuActionCopyImageToClipboard ContextMenuAction = 7
	// ContextMenuActionCopyImageURLToClipboard: copy current image location to
	// the clipboard.
	ContextMenuActionCopyImageURLToClipboard ContextMenuAction = 8
	// ContextMenuActionOpenFrameInNewWindow: open current frame in a new
	// window.
	ContextMenuActionOpenFrameInNewWindow ContextMenuAction = 9
	// ContextMenuActionGoBack: load the previous history item.
	ContextMenuActionGoBack ContextMenuAction = 10
	// ContextMenuActionGoForward: load the next history item.
	ContextMenuActionGoForward ContextMenuAction = 11
	// ContextMenuActionStop: stop any ongoing loading operation.
	ContextMenuActionStop ContextMenuAction = 12
	// ContextMenuActionReload: reload the contents of current view.
	ContextMenuActionReload ContextMenuAction = 13
	// ContextMenuActionCopy: copy current selection the clipboard.
	ContextMenuActionCopy ContextMenuAction = 14
	// ContextMenuActionCut: cut current selection to the clipboard.
	ContextMenuActionCut ContextMenuAction = 15
	// ContextMenuActionPaste: paste clipboard contents.
	ContextMenuActionPaste ContextMenuAction = 16
	// ContextMenuActionDelete: delete current selection.
	ContextMenuActionDelete ContextMenuAction = 17
	// ContextMenuActionSelectAll: select all text.
	ContextMenuActionSelectAll ContextMenuAction = 18
	// ContextMenuActionInputMethods: input methods menu.
	ContextMenuActionInputMethods ContextMenuAction = 19
	// ContextMenuActionUnicode: unicode menu.
	ContextMenuActionUnicode ContextMenuAction = 20
	// ContextMenuActionSpellingGuess: proposed replacement for a misspelled
	// word.
	ContextMenuActionSpellingGuess ContextMenuAction = 21
	// ContextMenuActionNoGuessesFound: indicator that spellchecking found no
	// proposed replacements.
	ContextMenuActionNoGuessesFound ContextMenuAction = 22
	// ContextMenuActionIgnoreSpelling causes the spellchecker to ignore the
	// word for this session.
	ContextMenuActionIgnoreSpelling ContextMenuAction = 23
	// ContextMenuActionLearnSpelling causes the spellchecker to add the word to
	// the dictionary.
	ContextMenuActionLearnSpelling ContextMenuAction = 24
	// ContextMenuActionIgnoreGrammar: ignore grammar.
	ContextMenuActionIgnoreGrammar ContextMenuAction = 25
	// ContextMenuActionFontMenu: font options menu.
	ContextMenuActionFontMenu ContextMenuAction = 26
	// ContextMenuActionBold: bold.
	ContextMenuActionBold ContextMenuAction = 27
	// ContextMenuActionItalic: italic.
	ContextMenuActionItalic ContextMenuAction = 28
	// ContextMenuActionUnderline: underline.
	ContextMenuActionUnderline ContextMenuAction = 29
	// ContextMenuActionOutline: outline.
	ContextMenuActionOutline ContextMenuAction = 30
	// ContextMenuActionInspectElement: open current element in the inspector.
	ContextMenuActionInspectElement ContextMenuAction = 31
	// ContextMenuActionOpenVideoInNewWindow: open current video element in a
	// new window.
	ContextMenuActionOpenVideoInNewWindow ContextMenuAction = 32
	// ContextMenuActionOpenAudioInNewWindow: open current audio element in a
	// new window.
	ContextMenuActionOpenAudioInNewWindow ContextMenuAction = 33
	// ContextMenuActionCopyVideoLinkToClipboard: copy video link location in to
	// the clipboard.
	ContextMenuActionCopyVideoLinkToClipboard ContextMenuAction = 34
	// ContextMenuActionCopyAudioLinkToClipboard: copy audio link location in to
	// the clipboard.
	ContextMenuActionCopyAudioLinkToClipboard ContextMenuAction = 35
	// ContextMenuActionToggleMediaControls: enable or disable media controls.
	ContextMenuActionToggleMediaControls ContextMenuAction = 36
	// ContextMenuActionToggleMediaLoop: enable or disable media loop.
	ContextMenuActionToggleMediaLoop ContextMenuAction = 37
	// ContextMenuActionEnterVideoFullscreen: show current video element in
	// fullscreen mode.
	ContextMenuActionEnterVideoFullscreen ContextMenuAction = 38
	// ContextMenuActionMediaPlay: play current media element.
	ContextMenuActionMediaPlay ContextMenuAction = 39
	// ContextMenuActionMediaPause: pause current media element.
	ContextMenuActionMediaPause ContextMenuAction = 40
	// ContextMenuActionMediaMute: mute current media element.
	ContextMenuActionMediaMute ContextMenuAction = 41
	// ContextMenuActionDownloadVideoToDisk: download video to disk. Since 2.2.
	ContextMenuActionDownloadVideoToDisk ContextMenuAction = 42
	// ContextMenuActionDownloadAudioToDisk: download audio to disk. Since 2.2.
	ContextMenuActionDownloadAudioToDisk ContextMenuAction = 43
	// ContextMenuActionInsertEmoji: insert an emoji. Since 2.26.
	ContextMenuActionInsertEmoji ContextMenuAction = 44
	// ContextMenuActionPasteAsPlainText: paste clipboard contents as plain
	// text. Since 2.30.
	ContextMenuActionPasteAsPlainText ContextMenuAction = 45
	// ContextMenuActionCustom: custom action defined by applications.
	ContextMenuActionCustom ContextMenuAction = 10000
)

func (ContextMenuAction) String

func (c ContextMenuAction) String() string

String returns the name in string for ContextMenuAction.

type ContextMenuClass

type ContextMenuClass struct {
	// contains filtered or unexported fields
}

ContextMenuClass: instance of this type is always passed by reference.

type ContextMenuItem

type ContextMenuItem struct {
	coreglib.InitiallyUnowned
	// contains filtered or unexported fields
}

ContextMenuItem: one item of a KitContextMenu.

The KitContextMenu is composed of KitContextMenuItem<!-- -->s. These items can be created from a Action, from a KitContextMenuAction or from a KitContextMenuAction and a label. These KitContextMenuAction<!-- -->s denote stock actions for the items. You can also create separators and submenus.

func NewContextMenuItemFromGaction

func NewContextMenuItemFromGaction(action gio.Actioner, label string, target *glib.Variant) *ContextMenuItem

NewContextMenuItemFromGaction creates a new KitContextMenuItem for the given action and label.

On activation target will be passed as parameter to the callback.

The function takes the following parameters:

  • action: #GAction.
  • label: menu item label text.
  • target (optional) to use as the action target.

The function returns the following values:

  • contextMenuItem: newly created KitContextMenuItem object.

func NewContextMenuItemFromStockAction

func NewContextMenuItemFromStockAction(action ContextMenuAction) *ContextMenuItem

NewContextMenuItemFromStockAction creates a new KitContextMenuItem for the given stock action.

Stock actions are handled automatically by WebKit so that, for example, when a menu item created with a WEBKIT_CONTEXT_MENU_ACTION_STOP is activated the action associated will be handled by WebKit and the current load operation will be stopped. You can get the #GAction of a KitContextMenuItem created with a KitContextMenuAction with webkit_context_menu_item_get_gaction() and connect to the Action::activate signal to be notified when the item is activated, but you can't prevent the associated action from being performed.

The function takes the following parameters:

  • action stock action.

The function returns the following values:

  • contextMenuItem: newly created KitContextMenuItem object.

func NewContextMenuItemFromStockActionWithLabel

func NewContextMenuItemFromStockActionWithLabel(action ContextMenuAction, label string) *ContextMenuItem

NewContextMenuItemFromStockActionWithLabel creates a new KitContextMenuItem for the given stock action using the given label.

Stock actions have a predefined label, this method can be used to create a KitContextMenuItem for a KitContextMenuAction but using a custom label.

The function takes the following parameters:

  • action stock action.
  • label: custom label text to use instead of the predefined one.

The function returns the following values:

  • contextMenuItem: newly created KitContextMenuItem object.

func NewContextMenuItemSeparator

func NewContextMenuItemSeparator() *ContextMenuItem

NewContextMenuItemSeparator creates a new KitContextMenuItem representing a separator.

The function returns the following values:

  • contextMenuItem: newly created KitContextMenuItem object.

func NewContextMenuItemWithSubmenu

func NewContextMenuItemWithSubmenu(label string, submenu *ContextMenu) *ContextMenuItem

NewContextMenuItemWithSubmenu creates a new KitContextMenuItem using the given label with a submenu.

The function takes the following parameters:

  • label: menu item label text.
  • submenu to set.

The function returns the following values:

  • contextMenuItem: newly created KitContextMenuItem object.

func (*ContextMenuItem) Gaction

func (item *ContextMenuItem) Gaction() *gio.Action

Gaction gets the action associated to item as a #GAction.

The function returns the following values:

  • action associated to the KitContextMenuItem, or NULL if item is a separator.

func (*ContextMenuItem) IsSeparator

func (item *ContextMenuItem) IsSeparator() bool

IsSeparator checks whether item is a separator.

The function returns the following values:

  • ok: TRUE is item is a separator or FALSE otherwise.

func (*ContextMenuItem) SetSubmenu

func (item *ContextMenuItem) SetSubmenu(submenu *ContextMenu)

SetSubmenu sets or replaces the item submenu.

If submenu is NULL the current submenu of item is removed.

The function takes the following parameters:

  • submenu (optional): KitContextMenu.

func (*ContextMenuItem) StockAction

func (item *ContextMenuItem) StockAction() ContextMenuAction

StockAction gets the KitContextMenuAction of item.

If the KitContextMenuItem was not created for a stock action WEBKIT_CONTEXT_MENU_ACTION_CUSTOM will be returned. If the KitContextMenuItem is a separator WEBKIT_CONTEXT_MENU_ACTION_NO_ACTION will be returned.

The function returns the following values:

  • contextMenuAction of item.

func (*ContextMenuItem) Submenu

func (item *ContextMenuItem) Submenu() *ContextMenu

Submenu gets the submenu of item.

The function returns the following values:

  • contextMenu representing the submenu of item or NULL if item doesn't have a submenu.

type ContextMenuItemClass

type ContextMenuItemClass struct {
	// contains filtered or unexported fields
}

ContextMenuItemClass: instance of this type is always passed by reference.

type ContextMenuItemOverrides

type ContextMenuItemOverrides struct {
}

ContextMenuItemOverrides contains methods that are overridable.

type ContextMenuOverrides

type ContextMenuOverrides struct {
}

ContextMenuOverrides contains methods that are overridable.

type Frame

type Frame struct {
	*coreglib.Object
	// contains filtered or unexported fields
}

Frame: web page frame.

Each WebKitWebPage has at least one main frame, and can have any number of subframes.

func (*Frame) ID

func (frame *Frame) ID() uint64

ID gets the process-unique identifier of this KitFrame. No other frame in the same web process will have the same ID; however, frames in other web processes may.

The function returns the following values:

  • guint64: identifier of frame.

func (*Frame) IsMainFrame

func (frame *Frame) IsMainFrame() bool

IsMainFrame gets whether frame is the main frame of a KitWebPage.

The function returns the following values:

  • ok: TRUE if frame is a main frame or FALSE otherwise.

func (*Frame) JsContext

func (frame *Frame) JsContext() *javascriptcore.Context

JsContext: get the JavaScript execution context of frame. Use this function to bridge between the WebKit and JavaScriptCore APIs.

The function returns the following values:

  • context for the JavaScript execution context of frame.

func (*Frame) JsContextForScriptWorld

func (frame *Frame) JsContextForScriptWorld(world *ScriptWorld) *javascriptcore.Context

JsContextForScriptWorld: get the JavaScript execution context of frame for the given KitScriptWorld.

The function takes the following parameters:

  • world: KitScriptWorld.

The function returns the following values:

  • context for the JavaScript execution context of frame for world.

func (*Frame) URI

func (frame *Frame) URI() string

URI gets the current active URI of frame.

The function returns the following values:

  • utf8: current active URI of frame or NULL if nothing has been loaded yet.

type FrameClass

type FrameClass struct {
	// contains filtered or unexported fields
}

FrameClass: instance of this type is always passed by reference.

type FrameOverrides

type FrameOverrides struct {
}

FrameOverrides contains methods that are overridable.

type HitTestResult

type HitTestResult struct {
	*coreglib.Object
	// contains filtered or unexported fields
}

HitTestResult: result of a Hit Test.

A Hit Test is an operation to get context information about a given point in a KitWebView. KitHitTestResult 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 webkit_hit_test_result_get_context() that returns a bitmask of KitHitTestResultContext flags. You can also use webkit_hit_test_result_context_is_link(), webkit_hit_test_result_context_is_image() and webkit_hit_test_result_context_is_media() 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 KitHitTestResultContext flags are active at the same time, for example if there's a link containing an image.

When the mouse is moved over a KitWebView a Hit Test is performed for the mouse coordinates and KitWebView::mouse-target-changed signal is emitted with a KitHitTestResult.

func (*HitTestResult) Context

func (hitTestResult *HitTestResult) Context() uint

Context gets the value of the KitHitTestResult:context property.

The function returns the following values:

  • guint: bitmask of KitHitTestResultContext flags.

func (*HitTestResult) ContextIsEditable

func (hitTestResult *HitTestResult) ContextIsEditable() bool

ContextIsEditable gets whether WEBKIT_HIT_TEST_RESULT_CONTEXT_EDITABLE flag is present in KitHitTestResult:context.

The function returns the following values:

  • ok: TRUE if there's an editable element at the coordinates of the hit_test_result, or FALSE otherwise.

func (*HitTestResult) ContextIsImage

func (hitTestResult *HitTestResult) ContextIsImage() bool

ContextIsImage gets whether WEBKIT_HIT_TEST_RESULT_CONTEXT_IMAGE flag is present in KitHitTestResult:context.

The function returns the following values:

  • ok: TRUE if there's an image element in the coordinates of the Hit Test, or FALSE otherwise.
func (hitTestResult *HitTestResult) ContextIsLink() bool

ContextIsLink gets whether WEBKIT_HIT_TEST_RESULT_CONTEXT_LINK flag is present in KitHitTestResult:context.

The function returns the following values:

  • ok: TRUE if there's a link element in the coordinates of the Hit Test, or FALSE otherwise.

func (*HitTestResult) ContextIsMedia

func (hitTestResult *HitTestResult) ContextIsMedia() bool

ContextIsMedia gets whether WEBKIT_HIT_TEST_RESULT_CONTEXT_MEDIA flag is present in KitHitTestResult:context.

The function returns the following values:

  • ok: TRUE if there's a media element in the coordinates of the Hit Test, or FALSE otherwise.

func (*HitTestResult) ContextIsScrollbar

func (hitTestResult *HitTestResult) ContextIsScrollbar() bool

ContextIsScrollbar gets whether WEBKIT_HIT_TEST_RESULT_CONTEXT_SCROLLBAR flag is present in KitHitTestResult:context.

The function returns the following values:

  • ok: TRUE if there's a scrollbar element at the coordinates of the hit_test_result, or FALSE otherwise.

func (*HitTestResult) ContextIsSelection

func (hitTestResult *HitTestResult) ContextIsSelection() bool

ContextIsSelection gets whether WEBKIT_HIT_TEST_RESULT_CONTEXT_SELECTION flag is present in KitHitTestResult:context.

The function returns the following values:

  • ok: TRUE if there's a selected element at the coordinates of the hit_test_result, or FALSE otherwise.

func (*HitTestResult) ImageURI

func (hitTestResult *HitTestResult) ImageURI() string

ImageURI gets the value of the KitHitTestResult:image-uri property.

The function returns the following values:

  • utf8: URI of the image element in the coordinates of the Hit Test, or NULL if there isn't an image element in hit_test_result context.

func (*HitTestResult) LinkLabel

func (hitTestResult *HitTestResult) LinkLabel() string

LinkLabel gets the value of the KitHitTestResult:link-label property.

The function returns the following values:

  • utf8: label of the link element in the coordinates of the Hit Test, or NULL if there isn't a link element in hit_test_result context or the link element doesn't have a label.

func (*HitTestResult) LinkTitle

func (hitTestResult *HitTestResult) LinkTitle() string

LinkTitle gets the value of the KitHitTestResult:link-title property.

The function returns the following values:

  • utf8: title of the link element in the coordinates of the Hit Test, or NULL if there isn't a link element in hit_test_result context or the link element doesn't have a title.

func (*HitTestResult) LinkURI

func (hitTestResult *HitTestResult) LinkURI() string

LinkURI gets the value of the KitHitTestResult:link-uri property.

The function returns the following values:

  • utf8: URI of the link element in the coordinates of the Hit Test, or NULL if there isn't a link element in hit_test_result context.

func (*HitTestResult) MediaURI

func (hitTestResult *HitTestResult) MediaURI() string

MediaURI gets the value of the KitHitTestResult:media-uri property.

The function returns the following values:

  • utf8: URI of the media element in the coordinates of the Hit Test, or NULL if there isn't a media element in hit_test_result context.

type HitTestResultClass

type HitTestResultClass struct {
	// contains filtered or unexported fields
}

HitTestResultClass: instance of this type is always passed by reference.

type HitTestResultContext

type HitTestResultContext C.guint

HitTestResultContext: enum values with flags representing the context of a KitHitTestResult.

const (
	// HitTestResultContextDocument: anywhere in the document.
	HitTestResultContextDocument HitTestResultContext = 0b10
	// HitTestResultContextLink: hyperlink element.
	HitTestResultContextLink HitTestResultContext = 0b100
	// HitTestResultContextImage: image element.
	HitTestResultContextImage HitTestResultContext = 0b1000
	// HitTestResultContextMedia: video or audio element.
	HitTestResultContextMedia HitTestResultContext = 0b10000
	// HitTestResultContextEditable: editable element.
	HitTestResultContextEditable HitTestResultContext = 0b100000
	// HitTestResultContextScrollbar: scrollbar element.
	HitTestResultContextScrollbar HitTestResultContext = 0b1000000
	// HitTestResultContextSelection: selected element. Since 2.8.
	HitTestResultContextSelection HitTestResultContext = 0b10000000
)

func (HitTestResultContext) Has

Has returns true if h contains other.

func (HitTestResultContext) String

func (h HitTestResultContext) String() string

String returns the names in string for HitTestResultContext.

type HitTestResultOverrides

type HitTestResultOverrides struct {
}

HitTestResultOverrides contains methods that are overridable.

type ScriptWorld

type ScriptWorld struct {
	*coreglib.Object
	// contains filtered or unexported fields
}

func NewScriptWorld

func NewScriptWorld() *ScriptWorld

NewScriptWorld creates a new isolated KitScriptWorld. Scripts executed in isolated worlds have access to the DOM but not to other variable or functions created by the page. The KitScriptWorld is created with a generated unique name. Use webkit_script_world_new_with_name() if you want to create it with a custom name. You can get the JavaScript execution context of a KitScriptWorld for a given KitFrame with webkit_frame_get_javascript_context_for_script_world().

The function returns the following values:

  • scriptWorld: new isolated KitScriptWorld.

func NewScriptWorldWithName

func NewScriptWorldWithName(name string) *ScriptWorld

NewScriptWorldWithName creates a new isolated KitScriptWorld with a name. Scripts executed in isolated worlds have access to the DOM but not to other variable or functions created by the page. You can get the JavaScript execution context of a KitScriptWorld for a given KitFrame with webkit_frame_get_javascript_context_for_script_world().

The function takes the following parameters:

  • name for the script world.

The function returns the following values:

  • scriptWorld: new isolated KitScriptWorld.

func ScriptWorldGetDefault

func ScriptWorldGetDefault() *ScriptWorld

ScriptWorldGetDefault: get the default KitScriptWorld. This is the normal script world where all scripts are executed by default. You can get the JavaScript execution context of a KitScriptWorld for a given KitFrame with webkit_frame_get_javascript_context_for_script_world().

The function returns the following values:

  • scriptWorld: default KitScriptWorld.

func (*ScriptWorld) ConnectWindowObjectCleared

func (world *ScriptWorld) ConnectWindowObjectCleared(f func(page *WebPage, frame *Frame)) coreglib.SignalHandle

ConnectWindowObjectCleared is emitted when the JavaScript window object in a KitScriptWorld has been cleared. This is the preferred place to set custom properties on the window object using the JavaScriptCore API. You can get the window object of frame from the JavaScript execution context of world that is returned by webkit_frame_get_js_context_for_script_world().

func (*ScriptWorld) Name

func (world *ScriptWorld) Name() string

Name: get the name of a KitScriptWorld.

The function returns the following values:

  • utf8: name of world.

type ScriptWorldClass

type ScriptWorldClass struct {
	// contains filtered or unexported fields
}

ScriptWorldClass: instance of this type is always passed by reference.

type ScriptWorldOverrides

type ScriptWorldOverrides struct {
}

ScriptWorldOverrides contains methods that are overridable.

type URIRequest

type URIRequest struct {
	*coreglib.Object
	// contains filtered or unexported fields
}

URIRequest represents a URI request.

A KitURIRequest can be created with a URI using the webkit_uri_request_new() method, and you can get the URI of an existing request with the webkit_uri_request_get_uri() one.

func NewURIRequest

func NewURIRequest(uri string) *URIRequest

NewURIRequest creates a new KitURIRequest for the given URI.

The function takes the following parameters:

  • uri: URI.

The function returns the following values:

  • uriRequest: new KitURIRequest.

func (*URIRequest) HTTPHeaders

func (request *URIRequest) HTTPHeaders() *soup.MessageHeaders

HTTPHeaders: get the HTTP headers of a KitURIRequest as a MessageHeaders.

The function returns the following values:

  • messageHeaders with the HTTP headers of request or NULL if request is not an HTTP request.

func (*URIRequest) HTTPMethod

func (request *URIRequest) HTTPMethod() string

HTTPMethod: get the HTTP method of the KitURIRequest.

The function returns the following values:

  • utf8: HTTP method of the KitURIRequest or NULL if request is not an HTTP request.

func (*URIRequest) SetURI

func (request *URIRequest) SetURI(uri string)

SetURI: set the URI of request.

The function takes the following parameters:

  • uri: URI.

func (*URIRequest) URI

func (request *URIRequest) URI() string

URI obtains the request URI.

The function returns the following values:

  • utf8: request URI, as a string.

type URIRequestClass

type URIRequestClass struct {
	// contains filtered or unexported fields
}

URIRequestClass: instance of this type is always passed by reference.

type URIRequestOverrides

type URIRequestOverrides struct {
}

URIRequestOverrides contains methods that are overridable.

type URIResponse

type URIResponse struct {
	*coreglib.Object
	// contains filtered or unexported fields
}

URIResponse represents an URI response.

A KitURIResponse contains information such as the URI, the status code, the content length, the mime type, the HTTP status or the suggested filename.

func (*URIResponse) ContentLength

func (response *URIResponse) ContentLength() uint64

ContentLength: get the expected content length of the KitURIResponse.

It can be 0 if the server provided an incorrect or missing Content-Length.

The function returns the following values:

  • guint64: expected content length of response.

func (*URIResponse) HTTPHeaders

func (response *URIResponse) HTTPHeaders() *soup.MessageHeaders

HTTPHeaders: get the HTTP headers of a KitURIResponse as a MessageHeaders.

The function returns the following values:

  • messageHeaders with the HTTP headers of response or NULL if response is not an HTTP response.

func (*URIResponse) MIMEType

func (response *URIResponse) MIMEType() string

MIMEType gets the MIME type of the response.

The function returns the following values:

  • utf8: MIME type, as a string.

func (*URIResponse) StatusCode

func (response *URIResponse) StatusCode() uint

StatusCode: get the status code of the KitURIResponse.

Get the status code of the KitURIResponse as returned by the server. It will normally be a KnownStatusCode, for example SOUP_STATUS_OK, though the server can respond with any unsigned integer.

The function returns the following values:

  • guint status code of response.

func (*URIResponse) SuggestedFilename

func (response *URIResponse) SuggestedFilename() string

SuggestedFilename: get the suggested filename for response.

Get the suggested filename for response, as specified by the 'Content-Disposition' HTTP header, or NULL if it's not present.

The function returns the following values:

  • utf8: suggested filename or NULL if the 'Content-Disposition' HTTP header is not present.

func (*URIResponse) URI

func (response *URIResponse) URI() string

URI gets the URI which resulted in the response.

The function returns the following values:

  • utf8: response URI, as a string.

type URIResponseClass

type URIResponseClass struct {
	// contains filtered or unexported fields
}

URIResponseClass: instance of this type is always passed by reference.

type URIResponseOverrides

type URIResponseOverrides struct {
}

URIResponseOverrides contains methods that are overridable.

type UserMessage

type UserMessage struct {
	coreglib.InitiallyUnowned
	// contains filtered or unexported fields
}

UserMessage: message 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 KitWebContext to all web process extensions, from a web process extension to its corresponding KitWebContext, and from a KitWebView to its corresponding KitWebPage (and vice versa). One to one messages can be replied to directly with webkit_user_message_send_reply().

func NewUserMessage

func NewUserMessage(name string, parameters *glib.Variant) *UserMessage

NewUserMessage: create a new KitUserMessage with name.

The function takes the following parameters:

  • name: message name.
  • parameters (optional): message parameters as a #GVariant, or NULL.

The function returns the following values:

  • userMessage: newly created KitUserMessage object.

func (*UserMessage) Name

func (message *UserMessage) Name() string

Name: get the message name.

The function returns the following values:

  • utf8: message name.

func (*UserMessage) Parameters

func (message *UserMessage) Parameters() *glib.Variant

Parameters: get the message parameters.

The function returns the following values:

  • variant (optional): message parameters.

func (*UserMessage) SendReply

func (message *UserMessage) SendReply(reply *UserMessage)

SendReply: send a reply to an user message.

If reply is floating, it's consumed. You can only send a reply to a KitUserMessage that has been received.

The function takes the following parameters:

  • reply to send as reply.

type UserMessageClass

type UserMessageClass struct {
	// contains filtered or unexported fields
}

UserMessageClass: instance of this type is always passed by reference.

type UserMessageError

type UserMessageError C.gint

UserMessageError: enum values used to denote errors happening when sending user messages.

const (
	// UserMessageUnhandledMessage: message was not handled by the receiver.
	UserMessageUnhandledMessage UserMessageError = iota
)

func (UserMessageError) String

func (u UserMessageError) String() string

String returns the name in string for UserMessageError.

type UserMessageOverrides

type UserMessageOverrides struct {
}

UserMessageOverrides contains methods that are overridable.

type WebEditor

type WebEditor struct {
	*coreglib.Object
	// contains filtered or unexported fields
}

WebEditor access to editing capabilities of a KitWebPage.

The WebKitWebEditor provides access to various editing capabilities of a KitWebPage such as a possibility to react to the current selection in KitWebPage.

func (*WebEditor) ConnectSelectionChanged

func (editor *WebEditor) ConnectSelectionChanged(f func()) coreglib.SignalHandle

ConnectSelectionChanged: this signal is emitted for every selection change inside a KitWebPage as well as for every caret position change as the caret is a collapsed selection.

func (*WebEditor) Page

func (editor *WebEditor) Page() *WebPage

Page gets the KitWebPage that is associated with the KitWebEditor.

The function returns the following values:

  • webPage: associated KitWebPage.

type WebEditorClass

type WebEditorClass struct {
	// contains filtered or unexported fields
}

WebEditorClass: instance of this type is always passed by reference.

type WebEditorOverrides

type WebEditorOverrides struct {
}

WebEditorOverrides contains methods that are overridable.

type WebFormManager

type WebFormManager struct {
	*coreglib.Object
	// contains filtered or unexported fields
}

WebFormManager: form manager of a KitWebPage in a KitScriptWorld.

func (*WebFormManager) ConnectWillSendSubmitEvent

func (v *WebFormManager) ConnectWillSendSubmitEvent(f func(form *javascriptcore.Value, sourceFrame, targetFrame *Frame)) coreglib.SignalHandle

ConnectWillSendSubmitEvent: this signal is emitted when the DOM submit event is about to be fired for form. JavaScript code may rely on the submit event to detect that the user has clicked on a submit button, and to possibly cancel the form submission before KitWebFormManager::will-submit-form signal is emitted. However, beware that, for historical reasons, the submit event is not emitted at all if the form submission is triggered by JavaScript. For these reasons, this signal may not be used to reliably detect whether a form will be submitted. Instead, use it to detect if a user has clicked on a form's submit button even if JavaScript later cancels the form submission, or to read the values of the form's fields even if JavaScript later clears certain fields before submitting. This may be needed, for example, to implement a robust browser password manager, as some misguided websites may use such techniques to attempt to thwart password managers.

func (*WebFormManager) ConnectWillSubmitForm

func (v *WebFormManager) ConnectWillSubmitForm(f func(form *javascriptcore.Value, sourceFrame, targetFrame *Frame)) coreglib.SignalHandle

ConnectWillSubmitForm: this signal is emitted when form will imminently be submitted. It can no longer be cancelled. This event always occurs immediately before a form is submitted to its target, so use this event to reliably detect when a form is submitted. This signal is emitted after KitWebFormManager::will-send-submit-event if that signal is emitted.

type WebFormManagerClass

type WebFormManagerClass struct {
	// contains filtered or unexported fields
}

WebFormManagerClass: instance of this type is always passed by reference.

type WebFormManagerOverrides

type WebFormManagerOverrides struct {
}

WebFormManagerOverrides contains methods that are overridable.

type WebHitTestResult

type WebHitTestResult struct {
	*coreglib.Object
	// contains filtered or unexported fields
}

WebHitTestResult: result of a Hit Test (Web Process Extensions).

WebKitWebHitTestResult extends KitHitTestResult to provide information about the KitDOMNode in the coordinates of the Hit Test.

func (*WebHitTestResult) Context

func (webHitTestResult *WebHitTestResult) Context() uint

Context gets the the context flags for the hit test result.

The function returns the following values:

  • guint: bitmask of KitHitTestResultContext flags.

func (*WebHitTestResult) ContextIsEditable

func (webHitTestResult *WebHitTestResult) ContextIsEditable() bool

ContextIsEditable: check whether there is an editable element at the hit test position.

Checks whether WEBKIT_HIT_TEST_RESULT_CONTEXT_EDITABLE flag is present in the context flags.

The function returns the following values:

  • ok: TRUE if the hit test covers an editable element or FALSE otherwise.

func (*WebHitTestResult) ContextIsImage

func (webHitTestResult *WebHitTestResult) ContextIsImage() bool

ContextIsImage: check whether there is an image element at the hit test position.

Checks whether WEBKIT_HIT_TEST_RESULT_CONTEXT_IMAGE flag is present in the context flags.

The function returns the following values:

  • ok: TRUE if the hit test covers an image element or FALSE otherwise.
func (webHitTestResult *WebHitTestResult) ContextIsLink() bool

ContextIsLink: check whether there is a link element at the hit test position.

Checks whether WEBKIT_HIT_TEST_RESULT_CONTEXT_LINK flag is present in the context flags.

The function returns the following values:

  • ok: TRUE if the hit test covers a link element or FALSE otherwise.

func (*WebHitTestResult) ContextIsMedia

func (webHitTestResult *WebHitTestResult) ContextIsMedia() bool

ContextIsMedia: check whether there is a media element at the hit test position.

Checks whether WEBKIT_HIT_TEST_RESULT_CONTEXT_MEDIA flag is present in the context flags.

The function returns the following values:

  • ok: TRUE if the hit test covers a media element or FALSE otherwise.

func (*WebHitTestResult) ContextIsScrollbar

func (webHitTestResult *WebHitTestResult) ContextIsScrollbar() bool

ContextIsScrollbar: check whether there is a scrollbar at the hit test position.

Checks whether WEBKIT_HIT_TEST_RESULT_CONTEXT_SCROLLBAR flag is present in the context flags.

The function returns the following values:

  • ok: TRUE if the hit test covers a scrollbar or FALSE otherwise.

func (*WebHitTestResult) ContextIsSelection

func (webHitTestResult *WebHitTestResult) ContextIsSelection() bool

ContextIsSelection: check whether there is a selected element at the hit test position.

Checks whether WEBKIT_HIT_TEST_RESULT_CONTEXT_SELECTION flag is present in the context flags.

The function returns the following values:

  • ok: TRUE if the hit test covers a selected element or FALSE otherwise.

func (*WebHitTestResult) ImageURI

func (webHitTestResult *WebHitTestResult) ImageURI() string

ImageURI obtains the URI associated with the image element at the hit test position.

The function returns the following values:

  • utf8: URI of the image element, or NULL if the hit test does not cover an image element.

func (*WebHitTestResult) JsNode

func (webHitTestResult *WebHitTestResult) JsNode(world *ScriptWorld) *javascriptcore.Value

JsNode: get the CValue for the DOM node in world at the coordinates of the Hit Test.

The function takes the following parameters:

  • world (optional) or NULL to use the default.

The function returns the following values:

  • value (optional) for the DOM node, or NULL.

func (*WebHitTestResult) LinkLabel

func (webHitTestResult *WebHitTestResult) LinkLabel() string

LinkLabel obtains the label associated with the link element at the hit test position.

The function returns the following values:

  • utf8: label of the link element, or NULL if the hit test does not cover a link element or the link element does not have a label.

func (*WebHitTestResult) LinkTitle

func (webHitTestResult *WebHitTestResult) LinkTitle() string

LinkTitle obtains the title associated with the link element at the hit test position.

The function returns the following values:

  • utf8: title of the link element, or NULL if the hit test does not cover a link element or the link element does not have a title.

func (*WebHitTestResult) LinkURI

func (webHitTestResult *WebHitTestResult) LinkURI() string

LinkURI obtains the URI associated with the link element at the hit test position.

The function returns the following values:

  • utf8: URI of the link element, or NULL if the hit test does not cover a link element.

func (*WebHitTestResult) MediaURI

func (webHitTestResult *WebHitTestResult) MediaURI() string

MediaURI obtains the URI associated with the media element at the hit test position.

The function returns the following values:

  • utf8: URI of the media element, or NULL if the hit test does not cover a media element.

type WebHitTestResultClass

type WebHitTestResultClass struct {
	// contains filtered or unexported fields
}

WebHitTestResultClass: instance of this type is always passed by reference.

type WebHitTestResultOverrides

type WebHitTestResultOverrides struct {
}

WebHitTestResultOverrides contains methods that are overridable.

type WebPage

type WebPage struct {
	*coreglib.Object
	// contains filtered or unexported fields
}

WebPage: loaded web page.

func (*WebPage) ConnectContextMenu

func (webPage *WebPage) ConnectContextMenu(f func(contextMenu *ContextMenu, hitTestResult *WebHitTestResult) (ok bool)) coreglib.SignalHandle

ConnectContextMenu is 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 the hit_test_result. Otherwise, it's recommended to use KitWebView::context-menu signal instead.

func (*WebPage) ConnectDocumentLoaded

func (webPage *WebPage) ConnectDocumentLoaded(f func()) coreglib.SignalHandle

ConnectDocumentLoaded: this signal is emitted when the DOM document of a KitWebPage has been loaded.

You can wait for this signal to get the DOM document.

func (*WebPage) ConnectSendRequest

func (webPage *WebPage) ConnectSendRequest(f func(request *URIRequest, redirectedResponse *URIResponse) (ok bool)) coreglib.SignalHandle

ConnectSendRequest: this signal is emitted when request is about to be sent to the server. This signal can be used to modify the KitURIRequest that will be sent to the server. You can also cancel the resource load operation by connecting to this signal and returning TRUE.

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 the redirected_response parameter containing the response received by the server for the initial request.

Modifications to the KitURIRequest and its associated MessageHeaders will be taken into account when the request is sent over the network.

func (*WebPage) ConnectUserMessageReceived

func (webPage *WebPage) ConnectUserMessageReceived(f func(message *UserMessage) (ok bool)) coreglib.SignalHandle

ConnectUserMessageReceived: this signal is emitted when a KitUserMessage is received from the KitWebView corresponding to web_page. 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 been replied, the operation in the KitWebView will finish with error WEBKIT_USER_MESSAGE_UNHANDLED_MESSAGE.

func (*WebPage) Editor

func (webPage *WebPage) Editor() *WebEditor

Editor gets the KitWebEditor of a KitWebPage.

The function returns the following values:

  • webEditor: KitWebEditor.

func (*WebPage) FormManager

func (webPage *WebPage) FormManager(world *ScriptWorld) *WebFormManager

FormManager: get the KitWebFormManager of web_page in world.

The function takes the following parameters:

  • world (optional): KitScriptWorld.

The function returns the following values:

  • webFormManager: KitWebFormManager.

func (*WebPage) ID

func (webPage *WebPage) ID() uint64

ID: get the identifier of the KitWebPage.

The function returns the following values:

  • guint64: identifier of web_page.

func (*WebPage) MainFrame

func (webPage *WebPage) MainFrame() *Frame

MainFrame returns the main frame of a KitWebPage.

The function returns the following values:

  • frame that is the main frame of web_page.

func (*WebPage) SendMessageToViewFinish

func (webPage *WebPage) SendMessageToViewFinish(result gio.AsyncResulter) (*UserMessage, error)

SendMessageToViewFinish: finish an asynchronous operation started with webkit_web_page_send_message_to_view().

The function takes the following parameters:

  • result: Result.

The function returns the following values:

  • userMessage with the reply or NULL in case of error.

func (*WebPage) URI

func (webPage *WebPage) URI() string

URI returns the current active URI of web_page.

You can monitor the active URI by connecting to the notify::uri signal of web_page.

The function returns the following values:

  • utf8: current active URI of web_view or NULL if nothing has been loaded yet.

type WebPageClass

type WebPageClass struct {
	// contains filtered or unexported fields
}

WebPageClass: instance of this type is always passed by reference.

type WebPageOverrides

type WebPageOverrides struct {
}

WebPageOverrides contains methods that are overridable.

type WebProcessExtension

type WebProcessExtension struct {
	*coreglib.Object
	// contains filtered or unexported fields
}

WebProcessExtension represents 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 KitWebProcessExtensionInitializeFunction or webkit_web_process_extension_initialize_with_user_data() with prototype KitWebProcessExtensionInitializeWithUserDataFunction. This function has to be public and it has to use the 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 KitWebPage 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 KitWebContext::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 ();

  // ...
}.

func (*WebProcessExtension) ConnectPageCreated

func (extension *WebProcessExtension) ConnectPageCreated(f func(webPage *WebPage)) coreglib.SignalHandle

ConnectPageCreated: this signal is emitted when a new KitWebPage is created in the Web Process.

func (*WebProcessExtension) ConnectUserMessageReceived

func (extension *WebProcessExtension) ConnectUserMessageReceived(f func(message *UserMessage)) coreglib.SignalHandle

ConnectUserMessageReceived: this signal is emitted when a KitUserMessage is received from the KitWebContext corresponding to extension. Messages sent by KitWebContext are always broadcasted to all web extensions and they can't be replied to. Calling webkit_user_message_send_reply() will do nothing.

func (*WebProcessExtension) Page

func (extension *WebProcessExtension) Page(pageId uint64) *WebPage

Page: get the web page of the given page_id.

The function takes the following parameters:

  • pageId: identifier of the KitWebPage to get.

The function returns the following values:

  • webPage for the given page_id, or NULL if the identifier doesn't correspond to an existing web page.

func (*WebProcessExtension) SendMessageToContextFinish

func (extension *WebProcessExtension) SendMessageToContextFinish(result gio.AsyncResulter) (*UserMessage, error)

SendMessageToContextFinish: finish an asynchronous operation started with webkit_web_process_extension_send_message_to_context().

The function takes the following parameters:

  • result: Result.

The function returns the following values:

  • userMessage with the reply or NULL in case of error.

type WebProcessExtensionClass

type WebProcessExtensionClass struct {
	// contains filtered or unexported fields
}

WebProcessExtensionClass: instance of this type is always passed by reference.

type WebProcessExtensionOverrides

type WebProcessExtensionOverrides struct {
}

WebProcessExtensionOverrides contains methods that are overridable.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL