summaryrefslogtreecommitdiff
path: root/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-08-21 10:57:44 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-08-21 10:57:44 +0200
commit5ef7c8a6a70875d4430752d146bdcb069605d71d (patch)
treef6256640b6c46d7da221435803cae65326817ba2 /Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp
parentdecad929f578d8db641febc8740649ca6c574638 (diff)
downloadqtwebkit-5ef7c8a6a70875d4430752d146bdcb069605d71d.tar.gz
Imported WebKit commit 356d83016b090995d08ad568f2d2c243aa55e831 (http://svn.webkit.org/repository/webkit/trunk@126147)
New snapshot including various build fixes for newer Qt 5
Diffstat (limited to 'Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp')
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp
index fe9df9f75..620c9a876 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp
@@ -32,6 +32,7 @@
#include "WebKitURISchemeRequestPrivate.h"
#include "WebKitWebContextPrivate.h"
#include <WebCore/FileSystem.h>
+#include <WebCore/Language.h>
#include <wtf/HashMap.h>
#include <wtf/OwnPtr.h>
#include <wtf/gobject/GOwnPtr.h>
@@ -518,6 +519,31 @@ void webkit_web_context_set_spell_checking_languages(WebKitWebContext* context,
#endif
}
+/**
+ * webkit_web_context_set_preferred_languages:
+ * @context: a #WebKitWebContext
+ * @languages: (element-type utf8): a #GList of language identifiers
+ *
+ * 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 #WebKitWebContext.
+ */
+void webkit_web_context_set_preferred_languages(WebKitWebContext* context, GList* languageList)
+{
+ g_return_if_fail(WEBKIT_IS_WEB_CONTEXT(context));
+
+ if (!languageList)
+ return;
+
+ Vector<String> languages;
+ for (GList* iter = languageList; iter; iter = g_list_next(iter))
+ languages.append(String::fromUTF8(static_cast<char*>(iter->data)).lower().replace("_", "-"));
+
+ WebCore::overrideUserPreferredLanguages(languages);
+ WebCore::languageDidChange();
+}
+
WebKitDownload* webkitWebContextGetOrCreateDownload(WKDownloadRef wkDownload)
{
GRefPtr<WebKitDownload> download = downloadsMap().get(wkDownload);