1231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block/* 2231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * Copyright (C) 2009 Jan Michael C. Alonzo 3231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * 4231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * This library is free software; you can redistribute it and/or 5231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * modify it under the terms of the GNU Library General Public 6231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * License as published by the Free Software Foundation; either 7231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * version 2 of the License, or (at your option) any later version. 8231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * 9231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * This library is distributed in the hope that it will be useful, 10231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * but WITHOUT ANY WARRANTY; without even the implied warranty of 11231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * Library General Public License for more details. 13231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * 14231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * You should have received a copy of the GNU Library General Public License 15231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * along with this library; see the file COPYING.LIB. If not, write to 16231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * Boston, MA 02110-1301, USA. 18231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block */ 19231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 20231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#include "config.h" 21231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#include "webkitwebdatasource.h" 22231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 23231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#include "ArchiveResource.h" 24231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#include "DocumentLoaderGtk.h" 25231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#include "FrameLoader.h" 26f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch#include "FrameLoaderClientGtk.h" 27231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#include "KURL.h" 28231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#include "PlatformString.h" 29231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#include "ResourceRequest.h" 30231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#include "SharedBuffer.h" 31231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#include "SubstituteData.h" 32f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch#include "runtime/InitializeThreading.h" 33cad810f21b803229eb11403f9209855525a25d57Steve Block#include "webkitglobalsprivate.h" 34f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch#include "webkitnetworkrequestprivate.h" 35cad810f21b803229eb11403f9209855525a25d57Steve Block#include "webkitwebdatasourceprivate.h" 36f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch#include "webkitwebframeprivate.h" 37f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch#include "webkitwebresource.h" 38f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch#include "webkitwebviewprivate.h" 39231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#include "wtf/Assertions.h" 40231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#include <glib.h> 41231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 42231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block/** 43231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * SECTION:webkitwebdatasource 44231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * @short_description: Encapsulates the content to be displayed in a #WebKitWebFrame. 45231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * @see_also: #WebKitWebFrame 46231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * 47231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * Data source encapsulates the content of a #WebKitWebFrame. A 48231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * #WebKitWebFrame has a main resource and subresources and the data source 49231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * provides access to these resources. When a request gets loaded initially, 50231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * it is set to a provisional state. The application can request for the 51231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * request that initiated the load by asking for the provisional data source 52231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * and invoking the webkit_web_data_source_get_initial_request method of 53231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * #WebKitWebDataSource. This data source may not have enough data and some 54231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * methods may return empty values. To get a "full" data source with the data 55231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * and resources loaded, you need to get the non-provisional data source 56231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * through #WebKitWebFrame's webkit_web_frame_get_data_source method. This 57231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * data source will have the data after everything was loaded. Make sure that 58231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * the data source was finished loading before using any of its methods. You 59231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * can do this via webkit_web_data_source_is_loading. 60231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block */ 61231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 62231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockusing namespace WebCore; 63231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockusing namespace WebKit; 64231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 65231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockstruct _WebKitWebDataSourcePrivate { 66231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block WebKit::DocumentLoader* loader; 67231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 68231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block WebKitNetworkRequest* initialRequest; 69231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block WebKitNetworkRequest* networkRequest; 70231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block WebKitWebResource* mainresource; 71231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 72231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block GString* data; 73231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 74231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block gchar* textEncoding; 75231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block gchar* unreachableURL; 76231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block}; 77231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 78231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve BlockG_DEFINE_TYPE(WebKitWebDataSource, webkit_web_data_source, G_TYPE_OBJECT); 79231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 80231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockstatic void webkit_web_data_source_dispose(GObject* object) 81231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 82231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block WebKitWebDataSource* webDataSource = WEBKIT_WEB_DATA_SOURCE(object); 83231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block WebKitWebDataSourcePrivate* priv = webDataSource->priv; 84231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 85231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block ASSERT(priv->loader); 86231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block ASSERT(!priv->loader->isLoading()); 87231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block priv->loader->detachDataSource(); 88231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block priv->loader->deref(); 89231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 90231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block if (priv->initialRequest) { 91231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block g_object_unref(priv->initialRequest); 92231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block priv->initialRequest = NULL; 93231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block } 94231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 95231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block if (priv->networkRequest) { 96231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block g_object_unref(priv->networkRequest); 97231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block priv->networkRequest = NULL; 98231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block } 99231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 100231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block if (priv->mainresource) { 101231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block g_object_unref(priv->mainresource); 102231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block priv->mainresource = NULL; 103231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block } 104231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 105231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block G_OBJECT_CLASS(webkit_web_data_source_parent_class)->dispose(object); 106231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 107231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 108231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockstatic void webkit_web_data_source_finalize(GObject* object) 109231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 110231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block WebKitWebDataSource* dataSource = WEBKIT_WEB_DATA_SOURCE(object); 111231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block WebKitWebDataSourcePrivate* priv = dataSource->priv; 112231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 113231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block g_free(priv->unreachableURL); 114231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block g_free(priv->textEncoding); 115231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 116231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block if (priv->data) { 117231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block g_string_free(priv->data, TRUE); 118231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block priv->data = NULL; 119231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block } 120231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 121231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block G_OBJECT_CLASS(webkit_web_data_source_parent_class)->finalize(object); 122231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 123231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 124231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockstatic void webkit_web_data_source_class_init(WebKitWebDataSourceClass* klass) 125231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 126231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block GObjectClass* gobject_class = G_OBJECT_CLASS(klass); 127231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block gobject_class->dispose = webkit_web_data_source_dispose; 128231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block gobject_class->finalize = webkit_web_data_source_finalize; 129231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 130cad810f21b803229eb11403f9209855525a25d57Steve Block webkitInit(); 131231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 132231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block g_type_class_add_private(gobject_class, sizeof(WebKitWebDataSourcePrivate)); 133231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 134231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 135231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockstatic void webkit_web_data_source_init(WebKitWebDataSource* webDataSource) 136231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 137f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch webDataSource->priv = G_TYPE_INSTANCE_GET_PRIVATE(webDataSource, WEBKIT_TYPE_WEB_DATA_SOURCE, WebKitWebDataSourcePrivate); 138231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 139231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 140231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block/** 141231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * webkit_web_data_source_new: 142231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * 143231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * Creates a new #WebKitWebDataSource instance. The URL of the 144231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * #WebKitWebDataSource will be set to "about:blank". 145231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * 146231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * Return: a new #WebKitWebDataSource. 147231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * 148231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * Since: 1.1.14 149231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block */ 150231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve BlockWebKitWebDataSource* webkit_web_data_source_new() 151231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 152231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block WebKitNetworkRequest* request = webkit_network_request_new("about:blank"); 153231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block WebKitWebDataSource* datasource = webkit_web_data_source_new_with_request(request); 154231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block g_object_unref(request); 155231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 156231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return datasource; 157231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 158231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 159231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block/** 160231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * webkit_web_data_source_new_with_request: 161231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * @request: the #WebKitNetworkRequest to use to create this data source 162231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * 163231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * Creates a new #WebKitWebDataSource from a #WebKitNetworkRequest. Normally, 164231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * #WebKitWebFrame objects create their data sources so you will almost never 165231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * want to invoke this method directly. 166231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * 167231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * Returns: a new #WebKitWebDataSource 168231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * 169231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * Since: 1.1.14 170231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block */ 171231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve BlockWebKitWebDataSource* webkit_web_data_source_new_with_request(WebKitNetworkRequest* request) 172231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 173231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block ASSERT(request); 174231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 175231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block const gchar* uri = webkit_network_request_get_uri(request); 176231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 177cad810f21b803229eb11403f9209855525a25d57Steve Block ResourceRequest resourceRequest(ResourceRequest(KURL(KURL(), String::fromUTF8(uri)))); 178cad810f21b803229eb11403f9209855525a25d57Steve Block WebKitWebDataSource* datasource = kitNew(WebKit::DocumentLoader::create(resourceRequest, SubstituteData())); 179231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 180231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block WebKitWebDataSourcePrivate* priv = datasource->priv; 181231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block priv->initialRequest = request; 182231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 183231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return datasource; 184231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 185231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 186231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block/** 187bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen * webkit_web_data_source_get_web_frame: 188231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * @data_source: a #WebKitWebDataSource 189231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * 190231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * Returns the #WebKitWebFrame that represents this data source 191231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * 192bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen * Return value: (transfer none): the #WebKitWebFrame that represents 193bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen * the @data_source. The #WebKitWebFrame is owned by WebKit and should 194bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen * not be freed or destroyed. This will return %NULL if the 195bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen * @data_source is not attached to a frame. 196231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * 197231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * Since: 1.1.14 198231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block */ 199231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve BlockWebKitWebFrame* webkit_web_data_source_get_web_frame(WebKitWebDataSource* webDataSource) 200231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 201231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block g_return_val_if_fail(WEBKIT_IS_WEB_DATA_SOURCE(webDataSource), NULL); 202231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 203231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block WebKitWebDataSourcePrivate* priv = webDataSource->priv; 204231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block FrameLoader* frameLoader = priv->loader->frameLoader(); 205231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 206231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block if (!frameLoader) 207231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return NULL; 208231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 209231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return static_cast<WebKit::FrameLoaderClient*>(frameLoader->client())->webFrame(); 210231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 211231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 212231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block/** 213231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * webkit_web_data_source_get_initial_request: 214231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * @data_source: a #WebKitWebDataSource 215231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * 216231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * Returns a reference to the original request that was used to load the web 217231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * content. The #WebKitNetworkRequest returned by this method is the request 218231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * prior to the "committed" load state. See webkit_web_data_source_get_request 219231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * for getting the "committed" request. 220231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * 221bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen * Return value: (transfer none): the original #WebKitNetworkRequest 222231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * 223231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * Since: 1.1.14 224231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block */ 225231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve BlockWebKitNetworkRequest* webkit_web_data_source_get_initial_request(WebKitWebDataSource* webDataSource) 226231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 227231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block g_return_val_if_fail(WEBKIT_IS_WEB_DATA_SOURCE(webDataSource), NULL); 228231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 229231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block WebKitWebDataSourcePrivate* priv = webDataSource->priv; 230231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block ResourceRequest request = priv->loader->originalRequest(); 231231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 232231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block if (priv->initialRequest) 233231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block g_object_unref(priv->initialRequest); 234231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 235f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch priv->initialRequest = kitNew(request); 236231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return priv->initialRequest; 237231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 238231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 239231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block/** 240231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * webkit_web_data_source_get_request: 241231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * @data_source: a #WebKitWebDataSource 242231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * 243231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * Returns a #WebKitNetworkRequest that was used to create this 244231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * #WebKitWebDataSource. The #WebKitNetworkRequest returned by this method is 245231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * the request that was "committed", and hence, different from the request you 246231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * get from the webkit_web_data_source_get_initial_request method. 247231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * 248bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen * Return value: (transfer none): the #WebKitNetworkRequest that 249bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen * created the @data_source or %NULL if the @data_source is not 250bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen * attached to the frame or the frame hasn't been loaded. 251231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * 252231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * Since: 1.1.14 253231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block */ 254231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve BlockWebKitNetworkRequest* webkit_web_data_source_get_request(WebKitWebDataSource* webDataSource) 255231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 256231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block g_return_val_if_fail(WEBKIT_IS_WEB_DATA_SOURCE(webDataSource), NULL); 257231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 258231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block WebKitWebDataSourcePrivate* priv = webDataSource->priv; 259231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block FrameLoader* frameLoader = priv->loader->frameLoader(); 260231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block if (!frameLoader || !frameLoader->frameHasLoaded()) 261231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return NULL; 262231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 263231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block ResourceRequest request = priv->loader->request(); 264231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 265231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block if (priv->networkRequest) 266231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block g_object_unref(priv->networkRequest); 267231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 268f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch priv->networkRequest = kitNew(request); 269231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return priv->networkRequest; 270231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 271231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 272231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block/** 273231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * webkit_web_data_source_get_encoding: 274231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * @data_source: a #WebKitWebDataSource 275231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * 276231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * Returns the text encoding name as set in the #WebKitWebView, or if not, the 277231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * text encoding of the response. 278231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * 279231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * Return value: the encoding name of the #WebKitWebView or of the response. 280231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * 281231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * Since: 1.1.14 282231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block */ 283231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve BlockG_CONST_RETURN gchar* webkit_web_data_source_get_encoding(WebKitWebDataSource* webDataSource) 284231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 285231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block g_return_val_if_fail(WEBKIT_IS_WEB_DATA_SOURCE(webDataSource), NULL); 286231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 287231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block WebKitWebDataSourcePrivate* priv = webDataSource->priv; 288231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block String textEncodingName = priv->loader->overrideEncoding(); 289231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 290231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block if (!textEncodingName) 291231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block textEncodingName = priv->loader->response().textEncodingName(); 292231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 293231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block CString encoding = textEncodingName.utf8(); 294231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block g_free(priv->textEncoding); 295231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block priv->textEncoding = g_strdup(encoding.data()); 296231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return priv->textEncoding; 297231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 298231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 299231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block/** 300231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * webkit_web_data_source_is_loading: 301231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * @data_source: a #WebKitWebDataSource 302231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * 303231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * Determines whether the data source is in the process of loading its content. 304231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * 305231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * Return value: %TRUE if the @data_source is still loading, %FALSE otherwise 306231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * 307231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * Since: 1.1.14 308231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block */ 309231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockgboolean webkit_web_data_source_is_loading(WebKitWebDataSource* webDataSource) 310231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 311f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch g_return_val_if_fail(WEBKIT_IS_WEB_DATA_SOURCE(webDataSource), FALSE); 312231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 313231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block WebKitWebDataSourcePrivate* priv = webDataSource->priv; 314231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 315231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return priv->loader->isLoadingInAPISense(); 316231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 317231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 318231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block/** 319231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * webkit_web_data_source_get_data: 320231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * @data_source: a #WebKitWebDataSource 321231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * 322231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * Returns the raw data that represents the the frame's content.The data will 323231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * be incomplete until the data has finished loading. Returns %NULL if the web 324231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * frame hasn't loaded any data. Use webkit_web_data_source_is_loading to test 325231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * if data source is in the process of loading. 326231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * 327bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen * Return value: (transfer none): a #GString which contains the raw 328bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen * data that represents the @data_source or %NULL if the @data_source 329bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen * hasn't loaded any data. 330231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * 331231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * Since: 1.1.14 332231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block */ 333231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve BlockGString* webkit_web_data_source_get_data(WebKitWebDataSource* webDataSource) 334231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 335231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block g_return_val_if_fail(WEBKIT_IS_WEB_DATA_SOURCE(webDataSource), NULL); 336231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 337231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block WebKitWebDataSourcePrivate* priv = webDataSource->priv; 338231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 339231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block RefPtr<SharedBuffer> mainResourceData = priv->loader->mainResourceData(); 340231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 341231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block if (!mainResourceData) 342231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return NULL; 343231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 344231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block if (priv->data) { 345231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block g_string_free(priv->data, TRUE); 346231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block priv->data = NULL; 347231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block } 348231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 349231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block priv->data = g_string_new_len(mainResourceData->data(), mainResourceData->size()); 350231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return priv->data; 351231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 352231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 353231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block/** 354231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * webkit_web_data_source_get_main_resource: 355231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * @data_source: a #WebKitWebDataSource 356231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * 357231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * Returns the main resource of the @data_source 358231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * 359bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen * Return value: (transfer none): a new #WebKitWebResource 360bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen * representing the main resource of the @data_source. 361231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * 362231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * Since: 1.1.14 363231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block */ 364231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve BlockWebKitWebResource* webkit_web_data_source_get_main_resource(WebKitWebDataSource* webDataSource) 365231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 366231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block g_return_val_if_fail(WEBKIT_IS_WEB_DATA_SOURCE(webDataSource), NULL); 367231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 368231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block WebKitWebDataSourcePrivate* priv = webDataSource->priv; 369231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 370231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block if (priv->mainresource) 371231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return priv->mainresource; 372231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 373231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block WebKitWebFrame* webFrame = webkit_web_data_source_get_web_frame(webDataSource); 374231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block WebKitWebView* webView = getViewFromFrame(webFrame); 375231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 376231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block priv->mainresource = WEBKIT_WEB_RESOURCE(g_object_ref(webkit_web_view_get_main_resource(webView))); 377231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 378231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return priv->mainresource; 379231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 380231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 381231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block/** 382231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * webkit_web_data_source_get_unreachable_uri: 383231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * @data_source: a #WebKitWebDataSource 384231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * 385231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * Return the unreachable URI of @data_source. The @data_source will have an 386231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * unreachable URL if it was created using #WebKitWebFrame's 387231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * webkit_web_frame_load_alternate_html_string method. 388231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * 389231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * Return value: the unreachable URL of @data_source or %NULL if there is no unreachable URL. 390231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * 391231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * Since: 1.1.14 392231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block */ 393231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve BlockG_CONST_RETURN gchar* webkit_web_data_source_get_unreachable_uri(WebKitWebDataSource* webDataSource) 394231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 395231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block g_return_val_if_fail(WEBKIT_IS_WEB_DATA_SOURCE(webDataSource), NULL); 396231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 397231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block WebKitWebDataSourcePrivate* priv = webDataSource->priv; 398231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block const KURL& unreachableURL = priv->loader->unreachableURL(); 399231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 400231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block if (unreachableURL.isEmpty()) 401231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return NULL; 402231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 403231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block g_free(priv->unreachableURL); 404231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block priv->unreachableURL = g_strdup(unreachableURL.string().utf8().data()); 405231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return priv->unreachableURL; 406231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 407231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 408231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block/** 409bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen * webkit_web_data_source_get_subresources: 410231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * @data_source: a #WebKitWebDataSource 411231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * 412231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * Gives you a #GList of #WebKitWebResource objects that compose the 413dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block * #WebKitWebView to which this #WebKitWebDataSource is attached. 414231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * 415bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen * Return value: (element-type WebKitWebResource) (transfer container): 416bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen * a #GList of #WebKitWebResource objects; the objects are owned by 417bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen * WebKit, but the GList must be freed. 418231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * 419231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * Since: 1.1.15 420231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block */ 421231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve BlockGList* webkit_web_data_source_get_subresources(WebKitWebDataSource* webDataSource) 422231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 423231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block g_return_val_if_fail(WEBKIT_IS_WEB_DATA_SOURCE(webDataSource), NULL); 424231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 425231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block WebKitWebFrame* webFrame = webkit_web_data_source_get_web_frame(webDataSource); 426231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block WebKitWebView* webView = getViewFromFrame(webFrame); 427231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 428231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return webkit_web_view_get_subresources(webView); 429231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 430cad810f21b803229eb11403f9209855525a25d57Steve Block 431cad810f21b803229eb11403f9209855525a25d57Steve Blocknamespace WebKit { 432cad810f21b803229eb11403f9209855525a25d57Steve Block 433cad810f21b803229eb11403f9209855525a25d57Steve BlockWebKitWebDataSource* kitNew(PassRefPtr<WebKit::DocumentLoader> loader) 434cad810f21b803229eb11403f9209855525a25d57Steve Block{ 435cad810f21b803229eb11403f9209855525a25d57Steve Block WebKitWebDataSource* webDataSource = WEBKIT_WEB_DATA_SOURCE(g_object_new(WEBKIT_TYPE_WEB_DATA_SOURCE, NULL)); 436cad810f21b803229eb11403f9209855525a25d57Steve Block WebKitWebDataSourcePrivate* priv = webDataSource->priv; 437cad810f21b803229eb11403f9209855525a25d57Steve Block priv->loader = loader.releaseRef(); 438cad810f21b803229eb11403f9209855525a25d57Steve Block 439cad810f21b803229eb11403f9209855525a25d57Steve Block return webDataSource; 440cad810f21b803229eb11403f9209855525a25d57Steve Block} 441cad810f21b803229eb11403f9209855525a25d57Steve Block 442cad810f21b803229eb11403f9209855525a25d57Steve Block} 443