From 49346115d92275d32f6e2c5e4a73376973078193 Mon Sep 17 00:00:00 2001 From: Xan Lopez Date: Thu, 26 Feb 2009 21:20:44 +0200 Subject: [PATCH] /: 2009-02-26 Xan Lopez Reviewed by NOBODY (OOPS!). https://bugs.webkit.org/show_bug.cgi?id=16947 [GTK] Missing HTTP Auth challenge Add HTTP authentication dialog with optional GNOME Keyring storage. * GNUmakefile.am: * configure.ac: WebCore: 2009-02-26 Xan Lopez Reviewed by NOBODY (OOPS!). https://bugs.webkit.org/show_bug.cgi?id=16947 [GTK] Missing HTTP Auth challenge Add HTTP authentication dialog with optional GNOME Keyring storage. * GNUmakefile.am: * platform/network/ResourceHandleInternal.h: (WebCore::ResourceHandleInternal::ResourceHandleInternal): * platform/network/soup/ResourceHandleSoup.cpp: (WebCore::currentToplevelCallback): (WebCore::ResourceHandle::startHttp): (WebCore::ResourceHandle::start): * platform/network/soup/webkit-soup-auth-dialog.c: Added. (webkit_soup_auth_dialog_class_init): (webkit_soup_auth_dialog_init): (webkit_soup_auth_dialog_session_feature_init): (free_authData): (set_password_callback): (response_callback): (show_auth_dialog): (find_password_callback): (session_authenticate): (attach): * platform/network/soup/webkit-soup-auth-dialog.h: Added. --- ChangeLog | 13 + GNUmakefile.am | 4 +- WebCore/ChangeLog | 32 ++ WebCore/GNUmakefile.am | 9 +- WebCore/platform/network/ResourceHandleInternal.h | 3 + .../platform/network/soup/ResourceHandleSoup.cpp | 40 +++- .../network/soup/webkit-soup-auth-dialog.c | 344 ++++++++++++++++++++ .../network/soup/webkit-soup-auth-dialog.h | 48 +++ configure.ac | 19 + 9 files changed, 509 insertions(+), 3 deletions(-) create mode 100644 WebCore/platform/network/soup/webkit-soup-auth-dialog.c create mode 100644 WebCore/platform/network/soup/webkit-soup-auth-dialog.h diff --git a/ChangeLog b/ChangeLog index 5a1790d..dd2db79 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,19 @@ https://bugs.webkit.org/show_bug.cgi?id=16947 [GTK] Missing HTTP Auth challenge + Add HTTP authentication dialog with optional GNOME Keyring + storage. + + * GNUmakefile.am: + * configure.ac: + +2009-02-26 Xan Lopez + + Reviewed by NOBODY (OOPS!). + + https://bugs.webkit.org/show_bug.cgi?id=16947 + [GTK] Missing HTTP Auth challenge + Take marshallers to be built from a manually maintained list instead of grepping the sources. diff --git a/GNUmakefile.am b/GNUmakefile.am index efed2aa..d925c82 100644 --- a/GNUmakefile.am +++ b/GNUmakefile.am @@ -181,7 +181,8 @@ libWebCore_la_CFLAGS = \ $(LIBXSLT_CFLAGS) \ $(COVERAGE_CFLAGS) \ $(HILDON_CFLAGS) \ - $(GEOCLUE_CFLAGS) + $(GEOCLUE_CFLAGS) \ + $(GNOMEKEYRING_CFLAGS) libWebCore_la_CPPFLAGS = \ $(global_cppflags) \ @@ -210,6 +211,7 @@ libWebCore_la_LIBADD = \ $(JPEG_LIBS) \ $(PNG_LIBS) \ $(GEOCLUE_LIBS) \ + $(GNOMEKEYRING_LIBS) \ -lpthread # WebKit diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog index 6f38c7e..7ceb631 100644 --- a/WebCore/ChangeLog +++ b/WebCore/ChangeLog @@ -1,3 +1,35 @@ +2009-02-26 Xan Lopez + + Reviewed by NOBODY (OOPS!). + + WARNING: NO TEST CASES ADDED OR CHANGED + + https://bugs.webkit.org/show_bug.cgi?id=16947 + [GTK] Missing HTTP Auth challenge + + Add HTTP authentication dialog with optional GNOME Keyring + storage. + + * GNUmakefile.am: + * platform/network/ResourceHandleInternal.h: + (WebCore::ResourceHandleInternal::ResourceHandleInternal): + * platform/network/soup/ResourceHandleSoup.cpp: + (WebCore::currentToplevelCallback): + (WebCore::ResourceHandle::startHttp): + (WebCore::ResourceHandle::start): + * platform/network/soup/webkit-soup-auth-dialog.c: Added. + (webkit_soup_auth_dialog_class_init): + (webkit_soup_auth_dialog_init): + (webkit_soup_auth_dialog_session_feature_init): + (free_authData): + (set_password_callback): + (response_callback): + (show_auth_dialog): + (find_password_callback): + (session_authenticate): + (attach): + * platform/network/soup/webkit-soup-auth-dialog.h: Added. + 2009-02-26 Simon Fraser Build fix, no review. diff --git a/WebCore/GNUmakefile.am b/WebCore/GNUmakefile.am index aecf10c..9f8348a 100644 --- a/WebCore/GNUmakefile.am +++ b/WebCore/GNUmakefile.am @@ -1817,7 +1817,14 @@ webcore_sources += \ WebCore/platform/network/soup/ResourceError.h \ WebCore/platform/network/soup/ResourceHandleSoup.cpp \ WebCore/platform/network/soup/ResourceRequest.h \ - WebCore/platform/network/soup/ResourceResponse.h + WebCore/platform/network/soup/ResourceResponse.h \ + WebCore/platform/network/soup/webkit-soup-auth-dialog.c \ + WebCore/platform/network/soup/webkit-soup-auth-dialog.h + +if USE_GNOMEKEYRING +webcore_cppflags += \ + -DWTF_USE_GNOMEKEYRING=1 +endif # --- # Freetype font backend diff --git a/WebCore/platform/network/ResourceHandleInternal.h b/WebCore/platform/network/ResourceHandleInternal.h index 66aa4c1..4e4417c 100644 --- a/WebCore/platform/network/ResourceHandleInternal.h +++ b/WebCore/platform/network/ResourceHandleInternal.h @@ -47,6 +47,7 @@ #if USE(SOUP) #include +class Frame; #endif #if PLATFORM(QT) @@ -117,6 +118,7 @@ namespace WebCore { , m_bufsize(0) , m_total(0) , m_idleHandler(0) + , m_frame(0) #endif #if PLATFORM(QT) , m_job(0) @@ -187,6 +189,7 @@ namespace WebCore { char* m_buffer; gsize m_bufsize, m_total; guint m_idleHandler; + Frame* m_frame; #endif #if PLATFORM(QT) #if QT_VERSION < 0x040400 diff --git a/WebCore/platform/network/soup/ResourceHandleSoup.cpp b/WebCore/platform/network/soup/ResourceHandleSoup.cpp index d148729..c16d728 100644 --- a/WebCore/platform/network/soup/ResourceHandleSoup.cpp +++ b/WebCore/platform/network/soup/ResourceHandleSoup.cpp @@ -28,21 +28,25 @@ #include "Base64.h" #include "CookieJarSoup.h" +#include "ChromeClient.h" #include "CString.h" #include "DocLoader.h" #include "Frame.h" #include "HTTPParsers.h" #include "MIMETypeRegistry.h" #include "NotImplemented.h" +#include "Page.h" #include "ResourceError.h" #include "ResourceHandleClient.h" #include "ResourceHandleInternal.h" #include "ResourceResponse.h" #include "TextEncoding.h" +#include "webkit-soup-auth-dialog.h" #include #include #include +#include #include #include #include @@ -370,6 +374,31 @@ static SoupSession* createSoupSession() return soup_session_async_new(); } +static GtkWidget* currentToplevelCallback(WebKitSoupAuthDialog* feature, SoupMessage* message, gpointer userData) +{ + gpointer messageData = g_object_get_data(G_OBJECT(message), "resourceHandle"); + if (!messageData) + return NULL; + + ResourceHandle* handle = static_cast(messageData); + if (!handle) + return NULL; + + ResourceHandleInternal* d = handle->getInternal(); + if (!d) + return NULL; + + Frame* frame = d->m_frame; + if (!frame) + return NULL; + + GtkWidget* toplevel = gtk_widget_get_toplevel(GTK_WIDGET(frame->page()->chrome()->platformWindow())); + if (GTK_WIDGET_TOPLEVEL(toplevel)) + return toplevel; + else + return NULL; +} + static void ensureSessionIsInitialized(SoupSession* session) { if (g_object_get_data(G_OBJECT(session), "webkit-init")) @@ -381,6 +410,11 @@ static void ensureSessionIsInitialized(SoupSession* session) else setDefaultCookieJar(jar); + SoupSessionFeature* authDialog = static_cast(g_object_new(WEBKIT_TYPE_SOUP_AUTH_DIALOG, NULL)); + g_signal_connect(authDialog, "current-toplevel", G_CALLBACK(currentToplevelCallback), NULL); + soup_session_add_feature(session, authDialog); + g_object_unref(authDialog); + const char* webkit_debug = g_getenv("WEBKIT_DEBUG"); if (!soup_session_get_feature(session, SOUP_TYPE_LOGGER) && webkit_debug && !strcmp(webkit_debug, "network")) { @@ -400,10 +434,11 @@ bool ResourceHandle::startHttp(String urlString) SoupMessage* msg; msg = soup_message_new(request().httpMethod().utf8().data(), urlString.utf8().data()); g_signal_connect(msg, "restarted", G_CALLBACK(restartedCallback), this); - g_signal_connect(msg, "got-headers", G_CALLBACK(gotHeadersCallback), this); g_signal_connect(msg, "got-chunk", G_CALLBACK(gotChunkCallback), this); + g_object_set_data(G_OBJECT(msg), "resourceHandle", reinterpret_cast(this)); + HTTPHeaderMap customHeaders = d->m_request.httpHeaderFields(); if (!customHeaders.isEmpty()) { HTTPHeaderMap::const_iterator end = customHeaders.end(); @@ -518,6 +553,9 @@ bool ResourceHandle::start(Frame* frame) String urlString = url.string(); String protocol = url.protocol(); + // Used to set the authentication dialog toplevel; may be NULL + d->m_frame = frame; + if (equalIgnoringCase(protocol, "data")) return startData(urlString); else if ((equalIgnoringCase(protocol, "http") || equalIgnoringCase(protocol, "https")) && SOUP_URI_VALID_FOR_HTTP(soup_uri_new(urlString.utf8().data()))) diff --git a/WebCore/platform/network/soup/webkit-soup-auth-dialog.c b/WebCore/platform/network/soup/webkit-soup-auth-dialog.c new file mode 100644 index 0000000..875825f --- /dev/null +++ b/WebCore/platform/network/soup/webkit-soup-auth-dialog.c @@ -0,0 +1,344 @@ +/* + * Copyright (C) 2009 Igalia S.L., Author: Xan Lopez + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "config.h" + +#include +#include +#if USE(GNOMEKEYRING) +#include +#endif + +#include "webkitmarshal.h" +#include "webkit-soup-auth-dialog.h" + +static void webkit_soup_auth_dialog_session_feature_init(SoupSessionFeatureInterface* feature_interface, gpointer interface_data); +static void attach(SoupSessionFeature *manager, SoupSession *session); +static void detach(SoupSessionFeature *manager, SoupSession *session); + +enum { + CURRENT_TOPLEVEL, + LAST_SIGNAL +}; + +static guint signals[LAST_SIGNAL] = { 0 }; + +G_DEFINE_TYPE_WITH_CODE(WebKitSoupAuthDialog, webkit_soup_auth_dialog, G_TYPE_OBJECT, + G_IMPLEMENT_INTERFACE(SOUP_TYPE_SESSION_FEATURE, + webkit_soup_auth_dialog_session_feature_init)) + +static void webkit_soup_auth_dialog_class_init(WebKitSoupAuthDialogClass *klass) +{ + GObjectClass* object_class = G_OBJECT_CLASS(klass); + + signals[CURRENT_TOPLEVEL] = + g_signal_new("current-toplevel", + G_OBJECT_CLASS_TYPE(object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(WebKitSoupAuthDialogClass, current_toplevel), + NULL, NULL, + webkit_marshal_OBJECT__OBJECT, + GTK_TYPE_WIDGET, 1, + SOUP_TYPE_MESSAGE); +} + +static void webkit_soup_auth_dialog_init(WebKitSoupAuthDialog* instance) +{ +} + +static void webkit_soup_auth_dialog_session_feature_init(SoupSessionFeatureInterface *feature_interface, + gpointer interface_data) +{ + feature_interface->attach = attach; + feature_interface->detach = detach; +} + +typedef struct _WebKitAuthData { + SoupMessage* msg; + SoupAuth* auth; + SoupSession* session; + SoupSessionFeature* manager; + GtkWidget* loginEntry; + GtkWidget* passwordEntry; +#if USE(GNOMEKEYRING) + GtkWidget* checkButton; +#endif +} WebKitAuthData; + +static void free_authData(WebKitAuthData* authData) +{ + g_object_unref(authData->msg); + g_slice_free(WebKitAuthData, authData); +} + +#if USE(GNOMEKEYRING) +static void set_password_callback(GnomeKeyringResult result, guint32 val, gpointer user_data) +{ + /* Dummy callback, gnome_keyring_set_network_password does not accept a NULL one */ +} +#endif + +static void response_callback(GtkDialog* dialog, gint response_id, WebKitAuthData* authData) +{ + const char* login; + const char* password; +#if USE(GNOMEKEYRING) + SoupURI* uri; + gboolean storePassword; +#endif + + switch(response_id) { + case GTK_RESPONSE_OK: + login = gtk_entry_get_text(GTK_ENTRY(authData->loginEntry)); + password = gtk_entry_get_text(GTK_ENTRY(authData->passwordEntry)); + soup_auth_authenticate(authData->auth, login, password); + +#if USE(GNOMEKEYRING) + storePassword = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(authData->checkButton)); + if (storePassword) { + uri = soup_message_get_uri(authData->msg); + gnome_keyring_set_network_password(NULL, + login, + soup_auth_get_realm(authData->auth), + uri->host, + NULL, + uri->scheme, + soup_auth_get_scheme_name(authData->auth), + uri->port, + password, + (GnomeKeyringOperationGetIntCallback)set_password_callback, + NULL, + NULL); + } +#endif + default: + break; + } + + soup_session_unpause_message(authData->session, authData->msg); + free_authData(authData); + gtk_widget_destroy(GTK_WIDGET(dialog)); +} + +static GtkWidget * +table_add_entry (GtkWidget *table, + int row, + const char *label_text, + const char *value, + gpointer user_data) +{ + GtkWidget *entry; + GtkWidget *label; + + label = gtk_label_new(label_text); + gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); + + entry = gtk_entry_new(); + gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE); + + if (value) + gtk_entry_set_text(GTK_ENTRY(entry), value); + + gtk_table_attach(GTK_TABLE(table), label, + 0, 1, row, row + 1, + GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); + gtk_table_attach_defaults(GTK_TABLE(table), entry, + 1, 2, row, row + 1); + + return entry; +} + +static void show_auth_dialog(WebKitAuthData* authData, const char* login, const char* password) +{ + GtkWidget* toplevel; + GtkWidget *widget; + GtkDialog *dialog; + GtkWindow *window; + GtkWidget *entryContainer; + GtkWidget *hbox, *mainVBox, *vbox, *icon; + GtkWidget *table; + GtkWidget *messageLabel; + char* message; + SoupURI* uri; +#if USE(GNOMEKEYRING) + GtkWidget* remember_box; + GtkWidget* check_button; +#endif + + /* From GTK+ gtkmountoperation.c, modified and simplified. LGPL 2 license */ + + widget = gtk_dialog_new(); + window = GTK_WINDOW(widget); + dialog = GTK_DIALOG(widget); + + gtk_dialog_add_buttons(dialog, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_OK, GTK_RESPONSE_OK, + NULL); + + /* Set the dialog up with HIG properties */ + gtk_dialog_set_has_separator(dialog, FALSE); + gtk_container_set_border_width(GTK_CONTAINER (dialog), 5); + gtk_box_set_spacing(GTK_BOX(dialog->vbox), 2); /* 2 * 5 + 2 = 12 */ + gtk_container_set_border_width(GTK_CONTAINER (dialog->action_area), 5); + gtk_box_set_spacing(GTK_BOX(dialog->action_area), 6); + + gtk_window_set_resizable(window, FALSE); + gtk_window_set_title(window, ""); + gtk_window_set_icon_name(window, GTK_STOCK_DIALOG_AUTHENTICATION); + + gtk_dialog_set_default_response(dialog, GTK_RESPONSE_OK); + + /* Get the current toplevel */ + g_signal_emit(authData->manager, signals[CURRENT_TOPLEVEL], 0, authData->msg, &toplevel); + + if (toplevel) + gtk_window_set_transient_for(window, toplevel); + + /* Build contents */ + hbox = gtk_hbox_new(FALSE, 12); + gtk_container_set_border_width(GTK_CONTAINER(hbox), 5); + gtk_box_pack_start(GTK_BOX(dialog->vbox), hbox, TRUE, TRUE, 0); + + icon = gtk_image_new_from_stock(GTK_STOCK_DIALOG_AUTHENTICATION, + GTK_ICON_SIZE_DIALOG); + + gtk_misc_set_alignment(GTK_MISC(icon), 0.5, 0.0); + gtk_box_pack_start(GTK_BOX(hbox), icon, FALSE, FALSE, 0); + + mainVBox = gtk_vbox_new(FALSE, 18); + gtk_box_pack_start(GTK_BOX(hbox), mainVBox, TRUE, TRUE, 0); + + uri = soup_message_get_uri(authData->msg); + message = g_strdup_printf("A username and password are being requested by the site %s", uri->host); + messageLabel = gtk_label_new(message); + g_free(message); + gtk_misc_set_alignment(GTK_MISC(messageLabel), 0.0, 0.5); + gtk_label_set_line_wrap(GTK_LABEL(messageLabel), TRUE); + gtk_box_pack_start(GTK_BOX(mainVBox), GTK_WIDGET(messageLabel), + FALSE, FALSE, 0); + + vbox = gtk_vbox_new(FALSE, 6); + gtk_box_pack_start(GTK_BOX (mainVBox), vbox, FALSE, FALSE, 0); + + /* The table that holds the entries */ + entryContainer = gtk_alignment_new(0.0, 0.0, 1.0, 1.0); + + gtk_alignment_set_padding(GTK_ALIGNMENT(entryContainer), + 0, 0, 0, 0); + + gtk_box_pack_start(GTK_BOX(vbox), entryContainer, + FALSE, FALSE, 0); + + table = gtk_table_new(2, 2, FALSE); + gtk_table_set_col_spacings(GTK_TABLE (table), 12); + gtk_table_set_row_spacings(GTK_TABLE (table), 6); + gtk_container_add(GTK_CONTAINER(entryContainer), table); + + authData->loginEntry = table_add_entry(table, 0, "Username:", + login, NULL); + authData->passwordEntry = table_add_entry(table, 1, "Password:", + password, NULL); + + gtk_entry_set_visibility(GTK_ENTRY(authData->passwordEntry), FALSE); + +#if USE(GNOMEKEYRING) + remember_box = gtk_vbox_new (FALSE, 6); + gtk_box_pack_start (GTK_BOX (vbox), remember_box, + FALSE, FALSE, 0); + + check_button = gtk_check_button_new_with_label("Remember password"); + if (login && password) + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_button), TRUE); + gtk_label_set_line_wrap(GTK_LABEL(gtk_bin_get_child(GTK_BIN(check_button))), TRUE); + gtk_box_pack_start (GTK_BOX (remember_box), check_button, FALSE, FALSE, 0); + authData->checkButton = check_button; +#endif + + g_signal_connect(dialog, "response", G_CALLBACK(response_callback), authData); + gtk_widget_show_all(widget); +} + +#if USE(GNOMEKEYRING) +static void find_password_callback(GnomeKeyringResult result, GList* list, WebKitAuthData* authData) +{ + GList* p; + const char* login = NULL; + const char* password = NULL; + + for (p = list; p; p = p->next) { + /* FIXME: support multiple logins/passwords ? */ + GnomeKeyringNetworkPasswordData* data = (GnomeKeyringNetworkPasswordData*)p->data; + login = data->user; + password = data->password; + break; + } + + show_auth_dialog(authData, login, password); +} +#endif + +static void session_authenticate(SoupSession* session, SoupMessage* msg, SoupAuth* auth, gboolean retrying, gpointer user_data) +{ + SoupURI* uri; + WebKitAuthData* authData; + SoupSessionFeature* manager = (SoupSessionFeature*)user_data; + + soup_session_pause_message(session, msg); + /* We need to make sure the message sticks around when pausing it */ + g_object_ref(msg); + + uri = soup_message_get_uri(msg); + authData = g_slice_new(WebKitAuthData); + authData->msg = msg; + authData->auth = auth; + authData->session = session; + authData->manager = manager; + + /* + * If we have gnome-keyring let's try to find the password first in the ring. + * Otherwise just show the dialog straight away + */ +#if USE(GNOMEKEYRING) + gnome_keyring_find_network_password(NULL, + soup_auth_get_realm(auth), + uri->host, + NULL, + uri->scheme, + soup_auth_get_scheme_name(auth), + uri->port, + (GnomeKeyringOperationGetListCallback)find_password_callback, + authData, + NULL); +#else + show_auth_dialog(authData, NULL, NULL); +#endif +} + +static void attach(SoupSessionFeature *manager, SoupSession *session) +{ + g_signal_connect(session, "authenticate", G_CALLBACK(session_authenticate), manager); +} + +static void detach(SoupSessionFeature *manager, SoupSession *session) +{ + g_signal_handlers_disconnect_by_func(session, session_authenticate, manager); +} + + diff --git a/WebCore/platform/network/soup/webkit-soup-auth-dialog.h b/WebCore/platform/network/soup/webkit-soup-auth-dialog.h new file mode 100644 index 0000000..90b6367 --- /dev/null +++ b/WebCore/platform/network/soup/webkit-soup-auth-dialog.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2009 Igalia S.L., Author: Xan Lopez + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include + +#ifndef WEBKIT_SOUP_AUTH_DIALOG_H +#define WEBKIT_SOUP_AUTH_DIALOG_H 1 + +G_BEGIN_DECLS + +#define WEBKIT_TYPE_SOUP_AUTH_DIALOG (webkit_soup_auth_dialog_get_type ()) +#define WEBKIT_SOUP_AUTH_DIALOG(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), WEBKIT_TYPE_SOUP_AUTH_DIALOG, WebKitSoupAuthDialog)) +#define WEBKIT_SOUP_AUTH_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), WEBKIT_TYPE_SOUP_AUTH_DIALOG, WebKitSoupAuthDialog)) +#define WEBKIT_IS_SOUP_AUTH_DIALOG(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), WEBKIT_TYPE_SOUP_AUTH_DIALOG)) +#define WEBKIT_IS_SOUP_AUTH_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), WEBKIT_TYPE_SOUP_AUTH_DIALOG)) +#define WEBKIT_SOUP_AUTH_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), WEBKIT_TYPE_SOUP_AUTH_DIALOG, WebKitSoupAuthDialog)) + +typedef struct { + GObject parent_instance; +} WebKitSoupAuthDialog; + +typedef struct { + GObjectClass parent_class; + + GtkWidget* (*current_toplevel) (WebKitSoupAuthDialog* feature, SoupMessage* message); +} WebKitSoupAuthDialogClass; + +GType webkit_soup_auth_dialog_get_type (void); + +G_END_DECLS + +#endif /* WEBKIT_SOUP_AUTH_DIALOG_H */ diff --git a/configure.ac b/configure.ac index 9acca42..29c6065 100644 --- a/configure.ac +++ b/configure.ac @@ -348,6 +348,14 @@ AC_ARG_ENABLE(geolocation, [],[enable_geolocation="no"]) AC_MSG_RESULT([$enable_geolocation]) +# check whether to enable gnomekeyring support +AC_MSG_CHECKING([whether to enable gnomekeyring support]) +AC_ARG_ENABLE(gnomekeyring, + AC_HELP_STRING([--enable-gnomekeyring], + [enable support for gnomekeyring [default=no]]), + [],[enable_gnomekeyring="no"]) +AC_MSG_RESULT([$enable_gnomekeyring]) + # check whether to enable SVG support AC_MSG_CHECKING([whether to enable SVG support]) AC_ARG_ENABLE(svg, @@ -517,6 +525,13 @@ PKG_CHECK_MODULES([LIBSOUP], AC_SUBST([LIBSOUP_CFLAGS]) AC_SUBST([LIBSOUP_LIBS]) +if test "$enable_gnomekeyring" = "yes"; then + PKG_CHECK_MODULES([GNOMEKEYRING], + [gnome-keyring-1]) + AC_SUBST([GNOMEKEYRING_CFLAGS]) + AC_SUBST([GNOMEKEYRING_LIBS]) +fi + # check if FreeType/FontConfig are available if test "$with_font_backend" = "freetype"; then if test "$with_target" = "directfb"; then @@ -594,6 +609,9 @@ AM_CONDITIONAL([TARGET_WIN32], [test "$with_target" = "win32"]) AM_CONDITIONAL([TARGET_QUARTZ], [test "$with_target" = "quartz"]) AM_CONDITIONAL([TARGET_DIRECTFB], [test "$with_target" = "directfb"]) +# Auth backend conditionals +AM_CONDITIONAL([USE_GNOMEKEYRING], [test "$enable_gnomekeyring" = "yes"]) + # Font backend conditionals AM_CONDITIONAL([USE_FREETYPE], [test "$with_font_backend" = "freetype"]) AM_CONDITIONAL([USE_PANGO], [test "$with_font_backend" = "pango"]) @@ -649,6 +667,7 @@ Features: JIT compilation : $enable_jit Dashboard support : $enable_dashboard_support Geolocation support : $enable_geolocation + GNOME Keyring support : $enable_gnomekeyring HTML5 offline web applications support : $enable_offline_web_applications HTML5 channel messaging support : $enable_channel_messaging HTML5 client-side session and persistent storage support : $enable_dom_storage -- 1.6.1