summaryrefslogtreecommitdiffstats
path: root/WebKit/gtk/webkit/webkitwebframe.cpp
diff options
context:
space:
mode:
authorCary Clark <>2009-04-14 06:33:00 -0700
committerThe Android Open Source Project <initial-contribution@android.com>2009-04-14 06:33:00 -0700
commit563af33bc48281d19dce701398dbb88cb54fd7ec (patch)
tree395b4502f029dea8b25b342d66dc06b5d8f99985 /WebKit/gtk/webkit/webkitwebframe.cpp
parent5cfedfef172691d0f4bcf2be5ca3cddd8c9a47f4 (diff)
downloadexternal_webkit-563af33bc48281d19dce701398dbb88cb54fd7ec.zip
external_webkit-563af33bc48281d19dce701398dbb88cb54fd7ec.tar.gz
external_webkit-563af33bc48281d19dce701398dbb88cb54fd7ec.tar.bz2
AI 146110: add missing files to webkit
brings it in sync with webkit svn cl 42046 Automated import of CL 146110
Diffstat (limited to 'WebKit/gtk/webkit/webkitwebframe.cpp')
-rw-r--r--WebKit/gtk/webkit/webkitwebframe.cpp67
1 files changed, 66 insertions, 1 deletions
diff --git a/WebKit/gtk/webkit/webkitwebframe.cpp b/WebKit/gtk/webkit/webkitwebframe.cpp
index 38e23a4..e2b10b6 100644
--- a/WebKit/gtk/webkit/webkitwebframe.cpp
+++ b/WebKit/gtk/webkit/webkitwebframe.cpp
@@ -5,6 +5,7 @@
* Copyright (C) 2008 Christian Dywan <christian@imendio.com>
* Copyright (C) 2008 Collabora Ltd.
* Copyright (C) 2008 Nuanti Ltd.
+ * Copyright (C) 2009 Jan Alonzo <jmalonzo@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -31,6 +32,7 @@
#include "AnimationController.h"
#include "CString.h"
+#include "DocumentLoader.h"
#include "FrameLoader.h"
#include "FrameLoaderClientGtk.h"
#include "FrameTree.h"
@@ -43,6 +45,7 @@
#include "RenderTreeAsText.h"
#include "JSDOMBinding.h"
#include "ScriptController.h"
+#include "SubstituteData.h"
#include <JavaScriptCore/APICast.h>
@@ -373,6 +376,60 @@ WebKitWebFrame* webkit_web_frame_get_parent(WebKitWebFrame* frame)
}
/**
+ * webkit_web_frame_load_uri:
+ * @frame: a #WebKitWebFrame
+ * @uri: an URI string
+ *
+ * Requests loading of the specified URI string.
+ *
+ * Since: 1.1.1
+ */
+void webkit_web_frame_load_uri(WebKitWebFrame* frame, const gchar* uri)
+{
+ g_return_if_fail(WEBKIT_IS_WEB_FRAME(frame));
+ g_return_if_fail(uri);
+
+ Frame* coreFrame = core(frame);
+ if (!coreFrame)
+ return;
+
+ coreFrame->loader()->load(ResourceRequest(KURL(KURL(), String::fromUTF8(uri))), false);
+}
+
+/**
+ * webkit_web_frame_load_string:
+ * @frame: a #WebKitWebFrame
+ * @content: an URI string
+ * @mime_type: the MIME type, or %NULL
+ * @encoding: the encoding, or %NULL
+ * @base_uri: the base URI for relative locations
+ *
+ * Requests loading of the given @content with the specified @mime_type,
+ * @encoding and @base_uri.
+ *
+ * If @mime_type is %NULL, "text/html" is assumed.
+ *
+ * If @encoding is %NULL, "UTF-8" is assumed.
+ *
+ * Since: 1.1.1
+ */
+void webkit_web_frame_load_string(WebKitWebFrame* frame, const gchar* content, const gchar* contentMimeType, const gchar* contentEncoding, const gchar* baseUri)
+{
+ g_return_if_fail(WEBKIT_IS_WEB_FRAME(frame));
+ g_return_if_fail(content);
+
+ Frame* coreFrame = core(frame);
+ if (!coreFrame)
+ return;
+
+ KURL url(KURL(), baseUri ? String::fromUTF8(baseUri) : "");
+ RefPtr<SharedBuffer> sharedBuffer = SharedBuffer::create(content, strlen(content));
+ SubstituteData substituteData(sharedBuffer.release(), contentMimeType ? String(contentMimeType) : "text/html", contentEncoding ? String(contentEncoding) : "UTF-8", blankURL(), url);
+
+ coreFrame->loader()->load(ResourceRequest(url), substituteData, false);
+}
+
+/**
* webkit_web_frame_load_request:
* @frame: a #WebKitWebFrame
* @request: a #WebKitNetworkRequest
@@ -394,7 +451,7 @@ void webkit_web_frame_load_request(WebKitWebFrame* frame, WebKitNetworkRequest*
// TODO: Use the ResourceRequest carried by WebKitNetworkRequest when it is implemented.
String string = String::fromUTF8(webkit_network_request_get_uri(request));
- coreFrame->loader()->load(ResourceRequest(KURL(string)));
+ coreFrame->loader()->load(ResourceRequest(KURL(KURL(), string)), false);
}
/**
@@ -662,4 +719,12 @@ unsigned int webkit_web_frame_number_of_active_animations(WebKitWebFrame* frame)
return controller->numberOfActiveAnimations();
}
+gchar* webkit_web_frame_get_response_mime_type(WebKitWebFrame* frame)
+{
+ Frame* coreFrame = core(frame);
+ DocumentLoader* docLoader = coreFrame->loader()->documentLoader();
+ String mimeType = docLoader->responseMIMEType();
+ return g_strdup(mimeType.utf8().data());
+}
+
}