WebKit2GTK+ Reference Manual | ||||
---|---|---|---|---|
Top | Description | Object Hierarchy | Signals |
struct WebKitWebContext; enum WebKitCacheModel; WebKitWebContext * webkit_web_context_get_default (void
); WebKitCacheModel webkit_web_context_get_cache_model (WebKitWebContext *context
); void webkit_web_context_set_cache_model (WebKitWebContext *context
,WebKitCacheModel cache_model
); void webkit_web_context_clear_cache (WebKitWebContext *context
); WebKitDownload * webkit_web_context_download_uri (WebKitWebContext *context
,const gchar *uri
); WebKitCookieManager * webkit_web_context_get_cookie_manager (WebKitWebContext *context
); void webkit_web_context_set_additional_plugins_directory (WebKitWebContext *context
,const gchar *directory
); void webkit_web_context_get_plugins (WebKitWebContext *context
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
); GList * webkit_web_context_get_plugins_finish (WebKitWebContext *context
,GAsyncResult *result
,GError **error
); void (*WebKitURISchemeRequestCallback) (WebKitURISchemeRequest *request
,gpointer user_data
); void webkit_web_context_register_uri_scheme (WebKitWebContext *context
,const gchar *scheme
,WebKitURISchemeRequestCallback callback
,gpointer user_data
);
typedef enum { WEBKIT_CACHE_MODEL_DOCUMENT_VIEWER, WEBKIT_CACHE_MODEL_WEB_BROWSER, WEBKIT_CACHE_MODEL_DOCUMENT_BROWSER } WebKitCacheModel;
Enum values used for determining the WebKitWebContext cache model.
Disable the cache completely, which substantially reduces memory usage. Useful for applications that only access a single local file, with no navigation to other pages. No remote resources will be cached. | |
Improve document load speed substantially by caching a very large number of resources and previously viewed content. | |
A cache model optimized for viewing a series of local files -- for example, a documentation viewer or a website designer. WebKit will cache a moderate number of resources. |
WebKitWebContext * webkit_web_context_get_default (void
);
Gets the default web context
Returns : |
(transfer none) a WebKitWebContext |
WebKitCacheModel webkit_web_context_get_cache_model (WebKitWebContext *context
);
Returns the current cache model. For more information about this
value check the documentation of the function
webkit_web_context_set_cache_model()
.
|
the WebKitWebContext |
Returns : |
the current WebKitCacheModel |
void webkit_web_context_set_cache_model (WebKitWebContext *context
,WebKitCacheModel cache_model
);
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 WEBKIT_CACHE_MODEL_WEB_BROWSER
. Applications without a
browsing interface can reduce memory usage substantially by
specifying WEBKIT_CACHE_MODEL_DOCUMENT_VIEWER
. The default value is
WEBKIT_CACHE_MODEL_WEB_BROWSER
.
|
the WebKitWebContext |
|
a WebKitCacheModel |
void webkit_web_context_clear_cache (WebKitWebContext *context
);
Clears all resources currently cached.
See also webkit_web_context_set_cache_model()
.
|
a WebKitWebContext |
WebKitDownload * webkit_web_context_download_uri (WebKitWebContext *context
,const gchar *uri
);
Requests downloading of the specified URI string.
|
a WebKitWebContext |
|
the URI to download |
Returns : |
a new WebKitDownload representing the the download operation. [transfer full] |
WebKitCookieManager * webkit_web_context_get_cookie_manager
(WebKitWebContext *context
);
Get the WebKitCookieManager of context
.
|
a WebKitWebContext |
Returns : |
the WebKitCookieManager of context . [transfer none]
|
void webkit_web_context_set_additional_plugins_directory (WebKitWebContext *context
,const gchar *directory
);
Set an additional directory where WebKit will look for plugins.
|
a WebKitWebContext |
|
the directory to add |
void webkit_web_context_get_plugins (WebKitWebContext *context
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
);
Asynchronously get the list of installed plugins.
When the operation is finished, callback
will be called. You can then call
webkit_web_context_get_plugins_finish()
to get the result of the operation.
|
a WebKitWebContext |
|
a GCancellable or NULL to ignore. [allow-none]
|
|
a GAsyncReadyCallback to call when the request is satisfied. [scope async] |
|
the data to pass to callback function. [closure] |
GList * webkit_web_context_get_plugins_finish (WebKitWebContext *context
,GAsyncResult *result
,GError **error
);
Finish an asynchronous operation started with webkit_web_context_get_plugins.
|
a WebKitWebContext |
|
a GAsyncResult |
|
return location for error or NULL to ignore |
Returns : |
a GList of WebKitPlugin. You must free the GList with
g_list_free() and unref the WebKitPlugins with g_object_unref() when you're done with them. [element-type WebKitPlugin][transfer full]
|
void (*WebKitURISchemeRequestCallback) (WebKitURISchemeRequest *request
,gpointer user_data
);
Type definition for a function that will be called back when an URI request is made for a user registered URI scheme.
|
the WebKitURISchemeRequest |
|
user data passed to the callback |
void webkit_web_context_register_uri_scheme (WebKitWebContext *context
,const gchar *scheme
,WebKitURISchemeRequestCallback callback
,gpointer user_data
);
Register scheme
in context
, so that when an URI request with scheme
is made in the
WebKitWebContext, the WebKitURISchemeRequestCallback registered will be called with a
WebKitURISchemeRequest.
It is possible to handle URI scheme requests asynchronously, by calling g_object_ref()
on the
WebKitURISchemeRequest and calling webkit_uri_scheme_request_finish()
later when the data of
the request is available.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
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 { gchar *contents; contents = g_strdup_printf ("<html><body><p>Invalid about:%s page</p></body></html>", path); stream_length = strlen (contents); stream = g_memory_input_stream_new_from_data (contents, stream_length, g_free); } webkit_uri_scheme_request_finish (request, stream, stream_length, "text/html"); g_object_unref (stream); } |
|
a WebKitWebContext |
|
the network scheme to register |
|
a WebKitURISchemeRequestCallback |
|
data to pass to callback function |
"download-started"
signalvoid user_function (WebKitWebContext *context,
WebKitDownload *download,
gpointer user_data) : Run Last
This signal is emitted when a new download request is made.
|
the WebKitWebContext |
|
the WebKitDownload associated with this event |
|
user data set when the signal handler was connected. |