gi-webkit2-4.0.11: WebKit2 bindings

CopyrightWill Thompson, Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria (garetxe@gmail.com)
Safe HaskellNone
LanguageHaskell2010

GI.WebKit2.Objects.WebContext

Contents

Description

 

Synopsis

Exported types

Methods

allowTlsCertificateForHost

webContextAllowTlsCertificateForHost Source #

Arguments

:: (HasCallStack, MonadIO m, IsWebContext a, IsTlsCertificate b) 
=> a

context: a WebContext

-> b

certificate: a TlsCertificate

-> Text

host: the host for which a certificate is to be allowed

-> m () 

Ignore further TLS errors on the host for the certificate present in info.

Since: 2.6

clearCache

webContextClearCache Source #

Arguments

:: (HasCallStack, MonadIO m, IsWebContext a) 
=> a

context: a WebContext

-> m () 

Clears all resources currently cached. See also webContextSetCacheModel.

downloadUri

webContextDownloadUri Source #

Arguments

:: (HasCallStack, MonadIO m, IsWebContext a) 
=> a

context: a WebContext

-> Text

uri: the URI to download

-> m Download

Returns: a new Download representing the the download operation.

Requests downloading of the specified URI string. The download operation will not be associated to any WebView, if you are interested in starting a download from a particular WebView use webViewDownloadUri instead.

getCacheModel

webContextGetCacheModel Source #

Arguments

:: (HasCallStack, MonadIO m, IsWebContext a) 
=> a

context: the WebContext

-> m CacheModel

Returns: the current CacheModel

Returns the current cache model. For more information about this value check the documentation of the function webContextSetCacheModel.

getCookieManager

webContextGetCookieManager Source #

Arguments

:: (HasCallStack, MonadIO m, IsWebContext a) 
=> a

context: a WebContext

-> m CookieManager

Returns: the CookieManager of context.

Get the CookieManager of context.

getDefault

webContextGetDefault Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m WebContext

Returns: a WebContext

Gets the default web context

getFaviconDatabase

webContextGetFaviconDatabase Source #

Arguments

:: (HasCallStack, MonadIO m, IsWebContext a) 
=> a

context: a WebContext

-> m FaviconDatabase

Returns: the FaviconDatabase of context.

Get the FaviconDatabase associated with context.

To initialize the database you need to call webContextSetFaviconDatabaseDirectory.

getFaviconDatabaseDirectory

webContextGetFaviconDatabaseDirectory Source #

Arguments

:: (HasCallStack, MonadIO m, IsWebContext a) 
=> a

context: a WebContext

-> m Text

Returns: the path of the directory of the favicons database associated with context, or Nothing.

Get the directory path being used to store the favicons database for context, or Nothing if webContextSetFaviconDatabaseDirectory hasn't been called yet.

This function will always return the same path after having called webContextSetFaviconDatabaseDirectory for the first time.

getPlugins

webContextGetPlugins Source #

Arguments

:: (HasCallStack, MonadIO m, IsWebContext a, IsCancellable b) 
=> a

context: a WebContext

-> Maybe b

cancellable: a Cancellable or Nothing to ignore

-> Maybe AsyncReadyCallback

callback: a AsyncReadyCallback to call when the request is satisfied

-> m () 

Asynchronously get the list of installed plugins.

When the operation is finished, callback will be called. You can then call webContextGetPluginsFinish to get the result of the operation.

getPluginsFinish

webContextGetPluginsFinish Source #

Arguments

:: (HasCallStack, MonadIO m, IsWebContext a, IsAsyncResult b) 
=> a

context: a WebContext

-> b

result: a AsyncResult

-> m [Plugin]

Returns: a List of Plugin. You must free the List with g_list_free() and unref the Plugin<!-- -->s with objectUnref when you're done with them. (Can throw GError)

Finish an asynchronous operation started with webkit_web_context_get_plugins.

getProcessModel

webContextGetProcessModel Source #

Arguments

:: (HasCallStack, MonadIO m, IsWebContext a) 
=> a

context: the WebContext

-> m ProcessModel

Returns: the current ProcessModel

Returns the current process model. For more information about this value see webContextSetProcessModel.

Since: 2.4

getSecurityManager

webContextGetSecurityManager Source #

Arguments

:: (HasCallStack, MonadIO m, IsWebContext a) 
=> a

context: a WebContext

-> m SecurityManager

Returns: the SecurityManager of context.

Get the SecurityManager of context.

getSpellCheckingEnabled

webContextGetSpellCheckingEnabled Source #

Arguments

:: (HasCallStack, MonadIO m, IsWebContext a) 
=> a

context: a WebContext

-> m Bool

Returns: True If spell checking is enabled, or False otherwise.

Get whether spell checking feature is currently enabled.

getSpellCheckingLanguages

webContextGetSpellCheckingLanguages Source #

Arguments

:: (HasCallStack, MonadIO m, IsWebContext a) 
=> a

context: a WebContext

-> m [Text]

Returns: A Nothing-terminated array of languages if available, or Nothing otherwise.

Get the the list of spell checking languages associated with context, or Nothing if no languages have been previously set.

See webContextSetSpellCheckingLanguages for more details on the format of the languages in the list.

getTlsErrorsPolicy

webContextGetTlsErrorsPolicy Source #

Arguments

:: (HasCallStack, MonadIO m, IsWebContext a) 
=> a

context: a WebContext

-> m TLSErrorsPolicy

Returns: a TLSErrorsPolicy

Get the TLS errors policy of context

getWebProcessCountLimit

webContextGetWebProcessCountLimit Source #

Arguments

:: (HasCallStack, MonadIO m, IsWebContext a) 
=> a

context: the WebContext

-> m Word32

Returns: the maximum limit of web processes, or 0 if there isn't a limit.

Gets the maximum number of web processes that can be created at the same time for the context.

Since: 2.10

getWebsiteDataManager

webContextGetWebsiteDataManager Source #

Arguments

:: (HasCallStack, MonadIO m, IsWebContext a) 
=> a

context: the WebContext

-> m WebsiteDataManager

Returns: a WebsiteDataManager

Get the WebsiteDataManager of context.

Since: 2.10

new

webContextNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m WebContext

Returns: a newly created WebContext

Create a new WebContext

Since: 2.8

newWithWebsiteDataManager

webContextNewWithWebsiteDataManager Source #

Arguments

:: (HasCallStack, MonadIO m, IsWebsiteDataManager a) 
=> a

manager: a WebsiteDataManager

-> m WebContext

Returns: a newly created WebContext

Create a new WebContext with a WebsiteDataManager.

Since: 2.10

prefetchDns

webContextPrefetchDns Source #

Arguments

:: (HasCallStack, MonadIO m, IsWebContext a) 
=> a

context: a WebContext

-> Text

hostname: a hostname to be resolved

-> m () 

Resolve the domain name of the given hostname in advance, so that if a URI of hostname is requested the load will be performed more quickly.

registerUriScheme

webContextRegisterUriScheme Source #

Arguments

:: (HasCallStack, MonadIO m, IsWebContext a) 
=> a

context: a WebContext

-> Text

scheme: the network scheme to register

-> URISchemeRequestCallback

callback: a URISchemeRequestCallback

-> m () 

Register scheme in context, so that when an URI request with scheme is made in the WebContext, the URISchemeRequestCallback registered will be called with a URISchemeRequest. It is possible to handle URI scheme requests asynchronously, by calling objectRef on the URISchemeRequest and calling uRISchemeRequestFinish later when the data of the request is available or uRISchemeRequestFinishError in case of error.

<informalexample><programlisting> static void about_uri_scheme_request_cb (WebKitURISchemeRequest *request, gpointer user_data) { GInputStream *stream; gsize stream_length; const gchar *path;

path = webkit_uri_scheme_request_get_path (request); if (!g_strcmp0 (path, "plugins")) { /<!-- -->* Create a GInputStream with the contents of plugins about page, and set its length to stream_length *<!-- -->/ } else if (!g_strcmp0 (path, "memory")) { /<!-- -->* Create a GInputStream with the contents of memory about page, and set its length to stream_length *<!-- -->/ } else if (!g_strcmp0 (path, "applications")) { /<!-- -->* Create a GInputStream with the contents of applications about page, and set its length to stream_length *<!-- -->/ } else if (!g_strcmp0 (path, "example")) { gchar *contents;

contents = g_strdup_printf ("&lt;html&gt;&lt;body&gt;&lt;p&gt;Example about page&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;"); stream_length = strlen (contents); stream = g_memory_input_stream_new_from_data (contents, stream_length, g_free); } else { GError *error;

error = g_error_new (ABOUT_HANDLER_ERROR, ABOUT_HANDLER_ERROR_INVALID, "Invalid about:s page.", path); webkit_uri_scheme_request_finish_error (request, error); g_error_free (error); return; } webkit_uri_scheme_request_finish (request, stream, stream_length, "text/html"); g_object_unref (stream); } </programlisting></informalexample>

setAdditionalPluginsDirectory

webContextSetAdditionalPluginsDirectory Source #

Arguments

:: (HasCallStack, MonadIO m, IsWebContext a) 
=> a

context: a WebContext

-> Text

directory: the directory to add

-> m () 

Set an additional directory where WebKit will look for plugins.

setCacheModel

webContextSetCacheModel Source #

Arguments

:: (HasCallStack, MonadIO m, IsWebContext a) 
=> a

context: the WebContext

-> CacheModel

cacheModel: a CacheModel

-> m () 

Specifies a usage model for WebViews, which WebKit will use to determine its caching behavior. All web views follow the cache model. This cache model determines the RAM and disk space to use for caching previously viewed content .

Research indicates that users tend to browse within clusters of documents that hold resources in common, and to revisit previously visited documents. WebKit and the frameworks below it include built-in caches that take advantage of these patterns, substantially improving document load speed in browsing situations. The WebKit cache model controls the behaviors of all of these caches, including various WebCore caches.

Browsers can improve document load speed substantially by specifying CacheModelWebBrowser. Applications without a browsing interface can reduce memory usage substantially by specifying CacheModelDocumentViewer. The default value is CacheModelWebBrowser.

setDiskCacheDirectory

webContextSetDiskCacheDirectory Source #

Arguments

:: (HasCallStack, MonadIO m, IsWebContext a) 
=> a

context: a WebContext

-> Text

directory: the directory to set

-> m () 

Deprecated: (Since version 2.10.)Use webContextNewWithWebsiteDataManager instead.

Set the directory where disk cache files will be stored This method must be called before loading anything in this context, otherwise it will not have any effect.

Note that this method overrides the directory set in the WebsiteDataManager, but it doesn't change the value returned by websiteDataManagerGetDiskCacheDirectory since the WebsiteDataManager is immutable.

setFaviconDatabaseDirectory

webContextSetFaviconDatabaseDirectory Source #

Arguments

:: (HasCallStack, MonadIO m, IsWebContext a) 
=> a

context: a WebContext

-> Maybe Text

path: an absolute path to the icon database directory or Nothing to use the defaults

-> m () 

Set the directory path to be used to store the favicons database for context on disk. Passing Nothing as path means using the default directory for the platform (see getUserDataDir).

Calling this method also means enabling the favicons database for its use from the applications, so that's why it's expected to be called only once. Further calls for the same instance of WebContext won't cause any effect.

setPreferredLanguages

webContextSetPreferredLanguages Source #

Arguments

:: (HasCallStack, MonadIO m, IsWebContext a) 
=> a

context: a WebContext

-> Maybe [Text]

languages: a Nothing-terminated list of language identifiers

-> m () 

Set the list of preferred languages, sorted from most desirable to least desirable. The list will be used to build the "Accept-Language" header that will be included in the network requests started by the WebContext.

setProcessModel

webContextSetProcessModel Source #

Arguments

:: (HasCallStack, MonadIO m, IsWebContext a) 
=> a

context: the WebContext

-> ProcessModel

processModel: a ProcessModel

-> m () 

Specifies a process model for WebViews, which WebKit will use to determine how auxiliary processes are handled. The default setting (ProcessModelSharedSecondaryProcess) is suitable for most applications which embed a small amount of WebViews, or are used to display documents which are considered safe — like local files.

Applications which may potentially use a large amount of WebViews —for example a multi-tabbed web browser— may want to use ProcessModelMultipleSecondaryProcesses, which will use one process per view most of the time, while still allowing for web views to share a process when needed (for example when different views interact with each other). Using this model, when a process hangs or crashes, only the WebViews using it stop working, while the rest of the WebViews in the application will still function normally.

This method **must be called before any web process has been created**, as early as possible in your application. Calling it later will make your application crash.

Since: 2.4

setSpellCheckingEnabled

webContextSetSpellCheckingEnabled Source #

Arguments

:: (HasCallStack, MonadIO m, IsWebContext a) 
=> a

context: a WebContext

-> Bool

enabled: Value to be set

-> m () 

Enable or disable the spell checking feature.

setSpellCheckingLanguages

webContextSetSpellCheckingLanguages Source #

Arguments

:: (HasCallStack, MonadIO m, IsWebContext a) 
=> a

context: a WebContext

-> [Text]

languages: a Nothing-terminated list of spell checking languages

-> m () 

Set the list of spell checking languages to be used for spell checking.

The locale string typically is in the form lang_COUNTRY, where lang is an ISO-639 language code, and COUNTRY is an ISO-3166 country code. For instance, sv_FI for Swedish as written in Finland or pt_BR for Portuguese as written in Brazil.

You need to call this function with a valid list of languages at least once in order to properly enable the spell checking feature in WebKit.

setTlsErrorsPolicy

webContextSetTlsErrorsPolicy Source #

Arguments

:: (HasCallStack, MonadIO m, IsWebContext a) 
=> a

context: a WebContext

-> TLSErrorsPolicy

policy: a TLSErrorsPolicy

-> m () 

Set the TLS errors policy of context as policy

setWebExtensionsDirectory

webContextSetWebExtensionsDirectory Source #

Arguments

:: (HasCallStack, MonadIO m, IsWebContext a) 
=> a

context: a WebContext

-> Text

directory: the directory to add

-> m () 

Set the directory where WebKit will look for Web Extensions. This method must be called before loading anything in this context, otherwise it will not have any effect. You can connect to WebContext::initialize-web-extensions to call this method before anything is loaded.

setWebExtensionsInitializationUserData

webContextSetWebExtensionsInitializationUserData Source #

Arguments

:: (HasCallStack, MonadIO m, IsWebContext a) 
=> a

context: a WebContext

-> GVariant

userData: a GVariant

-> m () 

Set user data to be passed to Web Extensions on initialization. The data will be passed to the WebKitWebExtensionInitializeWithUserDataFunction. This method must be called before loading anything in this context, otherwise it will not have any effect. You can connect to WebContext::initialize-web-extensions to call this method before anything is loaded.

Since: 2.4

setWebProcessCountLimit

webContextSetWebProcessCountLimit Source #

Arguments

:: (HasCallStack, MonadIO m, IsWebContext a) 
=> a

context: the WebContext

-> Word32

limit: the maximum number of web processes

-> m () 

Sets the maximum number of web processes that can be created at the same time for the context. The default value is 0 and means no limit.

This method **must be called before any web process has been created**, as early as possible in your application. Calling it later will make your application crash.

Since: 2.10

Properties

localStorageDirectory

data WebContextLocalStorageDirectoryPropertyInfo Source #

Instances

AttrInfo WebContextLocalStorageDirectoryPropertyInfo Source # 
type AttrOrigin WebContextLocalStorageDirectoryPropertyInfo Source # 
type AttrLabel WebContextLocalStorageDirectoryPropertyInfo Source # 
type AttrGetType WebContextLocalStorageDirectoryPropertyInfo Source # 
type AttrBaseTypeConstraint WebContextLocalStorageDirectoryPropertyInfo Source # 
type AttrSetTypeConstraint WebContextLocalStorageDirectoryPropertyInfo Source # 
type AttrAllowedOps WebContextLocalStorageDirectoryPropertyInfo Source # 

websiteDataManager

data WebContextWebsiteDataManagerPropertyInfo Source #

Instances

AttrInfo WebContextWebsiteDataManagerPropertyInfo Source # 
type AttrOrigin WebContextWebsiteDataManagerPropertyInfo Source # 
type AttrLabel WebContextWebsiteDataManagerPropertyInfo Source # 
type AttrGetType WebContextWebsiteDataManagerPropertyInfo Source # 
type AttrBaseTypeConstraint WebContextWebsiteDataManagerPropertyInfo Source # 
type AttrSetTypeConstraint WebContextWebsiteDataManagerPropertyInfo Source # 
type AttrAllowedOps WebContextWebsiteDataManagerPropertyInfo Source # 

Signals

downloadStarted

initializeWebExtensions