Documentation ¶
Index ¶
- Constants
- Variables
- func GetSettingsType(setting string) (reflect.Type, error)
- type BackForwardList
- type BackForwardListItem
- type CookieManager
- type Download
- func (d *Download) Cancel()
- func (d *Download) GetDestination() string
- func (d *Download) GetElapsedTime() time.Duration
- func (d *Download) GetEstimatedProgress() float64
- func (d *Download) GetReceivedDataLength() int64
- func (d *Download) GetRequest() *URIRequest
- func (d *Download) GetResponse() (*URIResponse, error)
- func (d *Download) GetWebView() (*WebView, error)
- func (d *Download) SetDestination(to string)
- type FindController
- type NavigationAction
- type NavigationPolicyDecision
- type PolicyDecision
- type ResponsePolicyDecision
- type SecurityManager
- func (sm *SecurityManager) RegisterURISchemeAsCorsEnabled(scheme string)
- func (sm *SecurityManager) RegisterURISchemeAsDisplayIsolated(scheme string)
- func (sm *SecurityManager) RegisterURISchemeAsEmptyDocument(scheme string)
- func (sm *SecurityManager) RegisterURISchemeAsLocal(scheme string)
- func (sm *SecurityManager) RegisterURISchemeAsNoAccess(scheme string)
- func (sm *SecurityManager) RegisterURISchemeAsSecure(scheme string)
- type Settings
- func (s *Settings) Clone() *Settings
- func (s *Settings) GetBool(setting string) bool
- func (s *Settings) GetString(setting string) string
- func (s *Settings) GetUint(setting string) uint
- func (s *Settings) SetBool(setting string, to bool)
- func (s *Settings) SetString(setting string, to string)
- func (s *Settings) SetUint(setting string, to uint)
- type URIRequest
- type URIResponse
- type URISchemeRequest
- type UserContentManager
- type UserStyleSheet
- type WebContext
- func (c *WebContext) DownloadURI(uri string) *Download
- func (c *WebContext) GetCookieManager() *CookieManager
- func (c *WebContext) GetSecurityManager() *SecurityManager
- func (c *WebContext) RegisterURIScheme(scheme string, callback func(*URISchemeRequest))
- func (c *WebContext) SetCacheModel(to C.WebKitCacheModel)
- func (c *WebContext) SetDiskCacheDirectory(to string)
- func (c *WebContext) SetFaviconDatabaseDirectory(path string)
- func (c *WebContext) SetProcessModel(to C.WebKitProcessModel)
- func (c *WebContext) SetWebExtensionsDirectory(to string)
- type WebView
- func (w *WebView) CanGoBack() bool
- func (w *WebView) CanGoForward() bool
- func (w *WebView) GetBackForwardList() *BackForwardList
- func (w *WebView) GetEstimatedLoadProgress() float64
- func (w *WebView) GetFavicon() (uintptr, error)
- func (w *WebView) GetFindController() *FindController
- func (w *WebView) GetPageID() uint64
- func (w *WebView) GetSettings() *Settings
- func (w *WebView) GetTitle() string
- func (w *WebView) GetURI() string
- func (w *WebView) GoBack()
- func (w *WebView) GoForward()
- func (w *WebView) GoToBackForwardListItem(i *BackForwardListItem)
- func (w *WebView) IsLoading() bool
- func (w *WebView) LoadAlternateHTML(content []byte, contentURI, baseURI string)
- func (w *WebView) LoadRequest(req *URIRequest)
- func (w *WebView) LoadURI(uri string)
- func (w *WebView) Reload()
- func (w *WebView) ReloadBypassCache()
- func (w *WebView) SetSettings(s *Settings)
Constants ¶
const ( // CookiePersistentStorageText specifies that the cookies should be saved // in a text format. CookiePersistentStorageText = C.WEBKIT_COOKIE_PERSISTENT_STORAGE_TEXT // CookiePersistentStorageSQLite specifies that the cookies should be // saves in a SQLite format. CookiePersistentStorageSQLite = C.WEBKIT_COOKIE_PERSISTENT_STORAGE_SQLITE )
const ( FindOptionsNone = C.WEBKIT_FIND_OPTIONS_NONE FindOptionsCaseInsensitive = C.WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE FindOptionsAtWordStarts = C.WEBKIT_FIND_OPTIONS_AT_WORD_STARTS FindOptionsTreatMedialCapitalAsWordStart = C.WEBKIT_FIND_OPTIONS_TREAT_MEDIAL_CAPITAL_AS_WORD_START FindOptionsBackwards = C.WEBKIT_FIND_OPTIONS_BACKWARDS FindOptionsWrapAround = C.WEBKIT_FIND_OPTIONS_WRAP_AROUND )
const ( // UserContentInjectAllFrames specifies that user content should be // injected into all frames. UserContentInjectAllFrames = C.WEBKIT_USER_CONTENT_INJECT_ALL_FRAMES // UserContentInjectTopFrame specifies that user content should be // injected only into the top-level frame. UserContentInjectTopFrame = C.WEBKIT_USER_CONTENT_INJECT_TOP_FRAME )
const ( // UserStyleLevelUser specifies that the style is considered dictated by // the user, and overrides any other conflicting CSS. UserStyleLevelUser = C.WEBKIT_USER_STYLE_LEVEL_USER // UserStyleLevelAuthor specifies that the style is considered dictated by // the website, and may be overriden by conflicting CSS. UserStyleLevelAuthor = C.WEBKIT_USER_STYLE_LEVEL_AUTHOR )
const ( // should be shared between all WebViews. ProcessModelSharedSecondaryProcess = C.WEBKIT_PROCESS_MODEL_SHARED_SECONDARY_PROCESS // ProcessModelMultipleSecondaryProcesses specifies that (most) WebViews // should run their own web process. ProcessModelMultipleSecondaryProcesses = C.WEBKIT_PROCESS_MODEL_MULTIPLE_SECONDARY_PROCESSES )
const ( // CacheModelWebBrowser caches a large amount of previously visited // content. CacheModelWebBrowser = C.WEBKIT_CACHE_MODEL_WEB_BROWSER // CacheModelDocumentBrowser caches a moderate amount of content. CacheModelDocumentBrowser = C.WEBKIT_CACHE_MODEL_DOCUMENT_BROWSER // CacheModelDocumentViewer completely disables the cache. CacheModelDocumentViewer = C.WEBKIT_CACHE_MODEL_DOCUMENT_VIEWER )
Variables ¶
var SettingNames []string
SettingNames is a slice of the names of all webkit settings.
Functions ¶
Types ¶
type BackForwardList ¶
A BackForwardList is a list of elements to go back or forward in browser history to.
func (*BackForwardList) GetNthItem ¶
func (bfl *BackForwardList) GetNthItem(n int) (*BackForwardListItem, bool)
GetNthItem retrieves the nth item, relative to the current item, from the BFL.
func (*BackForwardList) GetNthItemWeak ¶
func (bfl *BackForwardList) GetNthItemWeak(n int) (*BackForwardListItem, bool)
GetNthItemWeak tries to behave like GetNthItem, but if it fails, tries to find the closest index for which it doesn't.
If there are no specified items in the given direction (or n == 0), false is returned.
Yes this isn't strictly a wrapper function, but it's very useful.
type BackForwardListItem ¶
type BackForwardListItem struct {
glib.InitiallyUnowned
}
A BackForwardListItem is a single item in a BackForwardList.
type CookieManager ¶
CookieManager wraps WebKitCookieManager.
It keeps track or cookie policy.
func (*CookieManager) SetPersistentStorage ¶
func (cm *CookieManager) SetPersistentStorage( file string, storage C.WebKitCookiePersistentStorage)
SetPersistentStorage sets the file and format in which to store cookies persistently.
type Download ¶
A Download is a wrapper around WebKitDownload
It allows the tracking and controlling of downloads.
func (*Download) GetDestination ¶
GetDestination gets the target uri for the download.
func (*Download) GetElapsedTime ¶
GetElapsedTime gets the Duration which has passed since the download started.
func (*Download) GetEstimatedProgress ¶
GetEstimatedProgress gets an estimate for the download progress.
This is given as a fraction, i.e. a float between 0 and 1.
func (*Download) GetReceivedDataLength ¶
GetReceivedDataLength gets the length of the data received in bytes.
func (*Download) GetRequest ¶
func (d *Download) GetRequest() *URIRequest
GetRequest gets the URIRequest associated with this download.
func (*Download) GetResponse ¶
func (d *Download) GetResponse() (*URIResponse, error)
GetResponse gets the uri response to the download request.
Returns an error if the response is not yet available.
func (*Download) GetWebView ¶
GetWebView gets the web view associated with this download.
func (*Download) SetDestination ¶
SetDestination sets the target uri for the download.
Note the word uri - for most purposes you'll need to use the file:/// protocol.
type FindController ¶
func (*FindController) GetOptions ¶
func (fc *FindController) GetOptions() C.guint32
func (*FindController) GetSearchText ¶
func (fc *FindController) GetSearchText() string
func (*FindController) SearchFinish ¶
func (fc *FindController) SearchFinish()
func (*FindController) SearchNext ¶
func (fc *FindController) SearchNext()
func (*FindController) SearchPrevious ¶
func (fc *FindController) SearchPrevious()
type NavigationAction ¶
type NavigationAction struct {
// contains filtered or unexported fields
}
A NavigationAction describes the action taken to cause a navigation request.
func (*NavigationAction) GetModifiers ¶
func (a *NavigationAction) GetModifiers() uint
GetModifiers returns the modifier key mask pressed when the action was made.
func (*NavigationAction) GetMouseButton ¶
func (a *NavigationAction) GetMouseButton() uint
GetMouseButton returns the mouse button used to trigger the action, or 0 if it wasn't triggered by mouse.
func (*NavigationAction) GetRequest ¶
func (a *NavigationAction) GetRequest() *URIRequest
GetRequest gets the request associated with the navigation action.
type NavigationPolicyDecision ¶
type NavigationPolicyDecision struct {
}A NavigationPolicyDecision is a decision of whether or not to navigate to a page.
func (*NavigationPolicyDecision) Download ¶
func (d *NavigationPolicyDecision) Download()
Download downloads the resource referred to.
func (*NavigationPolicyDecision) GetNavigationAction ¶
func (d *NavigationPolicyDecision) GetNavigationAction() *NavigationAction
GetNavigationAction returns the navigation action causing the navigation.
func (*NavigationPolicyDecision) Ignore ¶
func (d *NavigationPolicyDecision) Ignore()
Ignore ignores the resource referred to.
func (*NavigationPolicyDecision) Use ¶
func (d *NavigationPolicyDecision) Use()
Use proceeds to navigate to the resource referred to.
type PolicyDecision ¶
type PolicyDecision interface { // Download downloads the resource referred to. Download() // Ignore makes the decision to take no action. Ignore() // Use makes the decision to go ahead with the suggested action. Use() }
A PolicyDecision is an interface implemented by the various types of policy decisions, and has methods used to make said decisions.
type ResponsePolicyDecision ¶
A ResponsePolicyDecision is a decision of whether or not to load a particular resource.
func (*ResponsePolicyDecision) Download ¶
func (d *ResponsePolicyDecision) Download()
Download downloads the resource referred to.
func (*ResponsePolicyDecision) GetResponse ¶
func (d *ResponsePolicyDecision) GetResponse() *URIResponse
GetResponse retrieves the uri response associated with this decision.
func (*ResponsePolicyDecision) Ignore ¶
func (d *ResponsePolicyDecision) Ignore()
Ignore ignores the resource referred to.
func (*ResponsePolicyDecision) Use ¶
func (d *ResponsePolicyDecision) Use()
Use proceeds to navigate to the resource referred to.
type SecurityManager ¶
A SecurityManager is a wrapper around WebKitSecurityManager.
It manages the security level of different URI schemes.
func (*SecurityManager) RegisterURISchemeAsCorsEnabled ¶
func (sm *SecurityManager) RegisterURISchemeAsCorsEnabled(scheme string)
RegisterURISchemeAsCorsEnabled registers the scheme as a CORS enabled scheme.
func (*SecurityManager) RegisterURISchemeAsDisplayIsolated ¶
func (sm *SecurityManager) RegisterURISchemeAsDisplayIsolated(scheme string)
RegisterURISchemeAsDisplayIsolated registers a uri scheme such that only pages on the same scheme can display it.
func (*SecurityManager) RegisterURISchemeAsEmptyDocument ¶
func (sm *SecurityManager) RegisterURISchemeAsEmptyDocument(scheme string)
RegisterURISchemeAsEmptyDocument registers a uri scheme as an empty document scheme.
func (*SecurityManager) RegisterURISchemeAsLocal ¶
func (sm *SecurityManager) RegisterURISchemeAsLocal(scheme string)
RegisterURISchemeAsLocal registers a uri scheme as being local, i.e. non- local pages can't interact with it.
func (*SecurityManager) RegisterURISchemeAsNoAccess ¶
func (sm *SecurityManager) RegisterURISchemeAsNoAccess(scheme string)
RegisterURISchemeAsNoAccess registers a uri scheme to have no access to web pages in other schemes.
func (*SecurityManager) RegisterURISchemeAsSecure ¶
func (sm *SecurityManager) RegisterURISchemeAsSecure(scheme string)
RegisterURISchemeAsSecure silences mixed content warning for this scheme on https sites.
type Settings ¶
Settings are a collection of settings for webkit.
func NewSettings ¶
func NewSettings() *Settings
NewSettings creates a new set of settings, with the default contents.
func (*Settings) GetBool ¶
GetBool gets a single boolean setting.
Type checks are not made, if the setting isn't boolean, the behaviour is undefined.
func (*Settings) GetString ¶
GetString gets a single string setting.
Type checks are not made, if the setting isn't a string, the behaviour is undefined.
func (*Settings) GetUint ¶
GetUint gets a single uint setting.
Type checks are not made, if the setting isn't a uint, the behaviour is undefined.
func (*Settings) SetBool ¶
SetBool sets a single boolean setting.
Type checks are not made, if the setting isn't boolean, this method will panic.
type URIRequest ¶
URIRequest wraps a WebKitURIRequest.
It keeps track of a request for a specific URI.
type URIResponse ¶
A URIResponse captures basic information about the response to a web request.
func (*URIResponse) GetMimeType ¶
func (r *URIResponse) GetMimeType() string
GetMimeType retrieves the mime type of the response.
func (*URIResponse) GetURI ¶
func (r *URIResponse) GetURI() string
GetURI gets the uri for which this is the response.
type URISchemeRequest ¶
A URISchemeRequest is a wrapper around a WebKitURISchemeRequest.
This is an object passes to registered scheme handlers when a request to that scheme is made. The scheme handler is responsible for completing the request.
func (*URISchemeRequest) Finish ¶
func (r *URISchemeRequest) Finish(data []byte, mimeType string)
Finish completes the request with given data and mimeType.
This method is temporary and should be considered unstable. It will be replaced with a method using a Reader for retrieving data instead of the raw bytes.
func (*URISchemeRequest) FinishError ¶
func (r *URISchemeRequest) FinishError(err error)
FinishError completes the request with an error.
func (*URISchemeRequest) GetPath ¶
func (r *URISchemeRequest) GetPath() string
GetPath retrieves the URI path of the request.
func (*URISchemeRequest) GetScheme ¶
func (r *URISchemeRequest) GetScheme() string
GetScheme retrieves the scheme of the request.
func (*URISchemeRequest) GetURI ¶
func (r *URISchemeRequest) GetURI() string
GetURI retrieves the URI of the request.
type UserContentManager ¶
A UserContentManager is a wrapper around WebKitUserContentManager.
It manages user content (i.e. scripts and style sheets), for WebViews which link to it.
func NewUserContentManager ¶
func NewUserContentManager() (*UserContentManager, error)
NewUserContentManager creates a new (blank) UserContentManager.
func (*UserContentManager) AddStyleSheet ¶
func (ucm *UserContentManager) AddStyleSheet(s *UserStyleSheet)
AddStyleSheet attaches a UserStyleSheet to this UserContentManager.
type UserStyleSheet ¶
type UserStyleSheet struct {
// contains filtered or unexported fields
}
A UserStyleSheet is a wrapper around WebKitUserStyleSheet.
It represents user-defined CSS rules, which can be applied to a website.
func NewUserStyleSheet ¶
func NewUserStyleSheet( source string, frames C.WebKitUserContentInjectedFrames, level C.WebKitUserStyleLevel, whitelist []string, blacklist []string) (*UserStyleSheet, error)
NewUserStyleSheet creates a new user style sheet.
It takes the raw CSS source code, one of UserContentInjectAllFrames or UserContentInjectTopFrame; one of UserStyleLevelUser or UserStyleLevelAuthor; and uri white- and blacklists.
Passing nil for the whitelist implies all URIs are whitelisted; passing nil for the blacklist implies no URIs are blacklisted.
func (*UserStyleSheet) Native ¶
func (css *UserStyleSheet) Native() uintptr
Native returns the pointer to the native C object of the style sheet.
type WebContext ¶
A WebContext is a wrapper around WebKitWebContext.
It manages aspects common to all WebViews.
func GetDefaultWebContext ¶
func GetDefaultWebContext() *WebContext
GetDefaultWebContext gets the default web context (i.e. the WebContext used by all WebViews by default).
func (*WebContext) DownloadURI ¶
func (c *WebContext) DownloadURI(uri string) *Download
DownloadURI requests the web context to download the specified URI.
func (*WebContext) GetCookieManager ¶
func (c *WebContext) GetCookieManager() *CookieManager
GetCookieManager retrieves the web context's cookie manager.
func (*WebContext) GetSecurityManager ¶
func (c *WebContext) GetSecurityManager() *SecurityManager
GetSecurityManager retrieves the web context's security manager.
func (*WebContext) RegisterURIScheme ¶
func (c *WebContext) RegisterURIScheme(scheme string, callback func(*URISchemeRequest))
RegisterURIScheme registers a custom URI scheme.
func (*WebContext) SetCacheModel ¶
func (c *WebContext) SetCacheModel(to C.WebKitCacheModel)
SetCacheModel sets the cache model to be used.
Should be one of CacheModelWebBrowser, CacheModelDocumentViewer or CacheModelDocumentBrowser
func (*WebContext) SetDiskCacheDirectory ¶
func (c *WebContext) SetDiskCacheDirectory(to string)
SetDiskCacheDirectory sets the directory of the cache on disk.
func (*WebContext) SetFaviconDatabaseDirectory ¶
func (c *WebContext) SetFaviconDatabaseDirectory(path string)
SetFaviconDatabaseDirectory sets the directory for the favicon database.
It also serves to enable said database in the first place.
Passing the empty string indicates using the default directory.
func (*WebContext) SetProcessModel ¶
func (c *WebContext) SetProcessModel(to C.WebKitProcessModel)
SetProcessModel sets the model used for the distribution of web processes for WebViews.
Should be one of ProcessModelSharedSecondaryProcess and ProcessModelMultipleSecondaryProcesses.
func (*WebContext) SetWebExtensionsDirectory ¶
func (c *WebContext) SetWebExtensionsDirectory(to string)
SetWebExtensionsDirectory sets the directory in which web extensions can be found.
type WebView ¶
WebView represents a WebKitWebView widget.
func NewWebView ¶
NewWebView creates and returns a new webkit webview.
func NewWebViewWithUserContentManager ¶
func NewWebViewWithUserContentManager( ucm *UserContentManager) (*WebView, error)
NewWebViewWithUserContentManager creates a new WebView, using a specific UserContentManager.
func (*WebView) CanGoForward ¶
CanGoForward checks whether it is possible to currently go forward.
func (*WebView) GetBackForwardList ¶
func (w *WebView) GetBackForwardList() *BackForwardList
GetBackForwardList gets the views list of back/forward steps in history.
Note that this call is fairly expensive and takes several conversions. Keep a reference if you use it more often.
func (*WebView) GetEstimatedLoadProgress ¶
GetEstimatedLoadProgress gets an estimation for the progress of a load operation.
func (*WebView) GetFavicon ¶
GetFavicon retrieves the pointer to the cairo_surface_t of the favicon.
Returns an error if favicon is nil.
func (*WebView) GetFindController ¶
func (w *WebView) GetFindController() *FindController
GetFindController retrieves the find controller used to control searches in this web view.
func (*WebView) GetSettings ¶
GetSettings retrieves the settings used for this WebView.
func (*WebView) GoForward ¶
func (w *WebView) GoForward()
GoForward goes forward one step in browser history.
func (*WebView) GoToBackForwardListItem ¶
func (w *WebView) GoToBackForwardListItem(i *BackForwardListItem)
GoToBackForwardListItem goes to a specified item in the web views BFL.
func (*WebView) LoadAlternateHTML ¶
LoadAlternateHTML loads html into the web view, with a given uri.
baseURI is used to resolve relative paths in the html.
func (*WebView) LoadRequest ¶
func (w *WebView) LoadRequest(req *URIRequest)
LoadRequest loads a specified URI request.
func (*WebView) ReloadBypassCache ¶
func (w *WebView) ReloadBypassCache()
ReloadBypassCache request the WebView to reload, bypassing the cache..
func (*WebView) SetSettings ¶
SetSettings sets the settings used for this WebView.
Source Files ¶
- backForwardList.go
- cookieManager.go
- download.go
- findController.go
- navigationAction.go
- navigationPolicyDecision.go
- policyDecision.go
- responsePolicyDecision.go
- securityManager.go
- settings.go
- uriRequest.go
- uriResponse.go
- uriSchemeRequest.go
- userContentManager.go
- userStyleSheet.go
- util.go
- webContext.go
- webView.go