Changeset 41270 in webkit


Ignore:
Timestamp:
Feb 26, 2009 2:45:13 PM (15 years ago)
Author:
kov@webkit.org
Message:

2009-02-26 Xan Lopez <xan@gnome.org>

Reviewed by Holger Freyther.

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.
Location:
trunk
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r41251 r41270  
     12009-02-26  Xan Lopez  <xan@gnome.org>
     2
     3        Reviewed by Holger Freyther.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=16947
     6        [GTK] Missing HTTP Auth challenge
     7
     8        Add HTTP authentication dialog with optional GNOME Keyring
     9        storage.
     10
     11        * GNUmakefile.am:
     12        * configure.ac:
     13
    1142009-02-26  Xan Lopez  <xan@gnome.org>
    215
  • trunk/GNUmakefile.am

    r41251 r41270  
    182182        $(COVERAGE_CFLAGS) \
    183183        $(HILDON_CFLAGS) \
    184         $(GEOCLUE_CFLAGS)
     184        $(GEOCLUE_CFLAGS) \
     185        $(GNOMEKEYRING_CFLAGS)
    185186
    186187libWebCore_la_CPPFLAGS = \
     
    211212        $(PNG_LIBS) \
    212213        $(GEOCLUE_LIBS) \
     214        $(GNOMEKEYRING_LIBS) \
    213215        -lpthread
    214216
  • trunk/WebCore/ChangeLog

    r41269 r41270  
     12009-02-26  Xan Lopez  <xan@gnome.org>
     2
     3        Reviewed by Holger Freyther.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=16947
     6        [GTK] Missing HTTP Auth challenge
     7
     8        Add HTTP authentication dialog with optional GNOME Keyring
     9        storage.
     10
     11        * GNUmakefile.am:
     12        * platform/network/ResourceHandleInternal.h:
     13        (WebCore::ResourceHandleInternal::ResourceHandleInternal):
     14        * platform/network/soup/ResourceHandleSoup.cpp:
     15        (WebCore::currentToplevelCallback):
     16        (WebCore::ResourceHandle::startHttp):
     17        (WebCore::ResourceHandle::start):
     18        * platform/network/soup/webkit-soup-auth-dialog.c: Added.
     19        (webkit_soup_auth_dialog_class_init):
     20        (webkit_soup_auth_dialog_init):
     21        (webkit_soup_auth_dialog_session_feature_init):
     22        (free_authData):
     23        (set_password_callback):
     24        (response_callback):
     25        (show_auth_dialog):
     26        (find_password_callback):
     27        (session_authenticate):
     28        (attach):
     29        * platform/network/soup/webkit-soup-auth-dialog.h: Added.
     30
    1312009-02-25  Ojan Vafai  <ojan@chromium.org> and Eric Seidel <eric@webkit.org>
    232
  • trunk/WebCore/GNUmakefile.am

    r41266 r41270  
    18181818        WebCore/platform/network/soup/ResourceHandleSoup.cpp \
    18191819        WebCore/platform/network/soup/ResourceRequest.h \
    1820         WebCore/platform/network/soup/ResourceResponse.h
     1820        WebCore/platform/network/soup/ResourceResponse.h \
     1821        WebCore/platform/network/soup/webkit-soup-auth-dialog.c \
     1822        WebCore/platform/network/soup/webkit-soup-auth-dialog.h
     1823
     1824if USE_GNOMEKEYRING
     1825webcore_cppflags += \
     1826        -DWTF_USE_GNOMEKEYRING=1
     1827endif
    18211828
    18221829# ---
  • trunk/WebCore/platform/network/ResourceHandleInternal.h

    r39690 r41270  
    4848#if USE(SOUP)
    4949#include <libsoup/soup.h>
     50class Frame;
    5051#endif
    5152
     
    118119            , m_total(0)
    119120            , m_idleHandler(0)
     121            , m_frame(0)
    120122#endif
    121123#if PLATFORM(QT)
     
    188190        gsize m_bufsize, m_total;
    189191        guint m_idleHandler;
     192        Frame* m_frame;
    190193#endif
    191194#if PLATFORM(QT)
  • trunk/WebCore/platform/network/soup/ResourceHandleSoup.cpp

    r41226 r41270  
    2929#include "Base64.h"
    3030#include "CookieJarSoup.h"
     31#include "ChromeClient.h"
    3132#include "CString.h"
    3233#include "DocLoader.h"
     
    3536#include "MIMETypeRegistry.h"
    3637#include "NotImplemented.h"
     38#include "Page.h"
    3739#include "ResourceError.h"
    3840#include "ResourceHandleClient.h"
     
    4042#include "ResourceResponse.h"
    4143#include "TextEncoding.h"
     44#include "webkit-soup-auth-dialog.h"
    4245
    4346#include <errno.h>
    4447#include <fcntl.h>
    4548#include <gio/gio.h>
     49#include <gtk/gtk.h>
    4650#include <libsoup/soup.h>
    4751#include <libsoup/soup-message.h>
     
    371375}
    372376
     377static GtkWidget* currentToplevelCallback(WebKitSoupAuthDialog* feature, SoupMessage* message, gpointer userData)
     378{
     379    gpointer messageData = g_object_get_data(G_OBJECT(message), "resourceHandle");
     380    if (!messageData)
     381        return NULL;
     382
     383    ResourceHandle* handle = static_cast<ResourceHandle*>(messageData);
     384    if (!handle)
     385        return NULL;
     386
     387    ResourceHandleInternal* d = handle->getInternal();
     388    if (!d)
     389        return NULL;
     390
     391    Frame* frame = d->m_frame;
     392    if (!frame)
     393        return NULL;
     394
     395    GtkWidget* toplevel =  gtk_widget_get_toplevel(GTK_WIDGET(frame->page()->chrome()->platformWindow()));
     396    if (GTK_WIDGET_TOPLEVEL(toplevel))
     397        return toplevel;
     398    else
     399        return NULL;
     400}
     401
    373402static void ensureSessionIsInitialized(SoupSession* session)
    374403{
     
    382411        setDefaultCookieJar(jar);
    383412
     413    SoupSessionFeature* authDialog = static_cast<SoupSessionFeature*>(g_object_new(WEBKIT_TYPE_SOUP_AUTH_DIALOG, NULL));
     414    g_signal_connect(authDialog, "current-toplevel", G_CALLBACK(currentToplevelCallback), NULL);
     415    soup_session_add_feature(session, authDialog);
     416    g_object_unref(authDialog);
     417
    384418    const char* webkit_debug = g_getenv("WEBKIT_DEBUG");
    385419    if (!soup_session_get_feature(session, SOUP_TYPE_LOGGER)
     
    401435    msg = soup_message_new(request().httpMethod().utf8().data(), urlString.utf8().data());
    402436    g_signal_connect(msg, "restarted", G_CALLBACK(restartedCallback), this);
    403 
    404437    g_signal_connect(msg, "got-headers", G_CALLBACK(gotHeadersCallback), this);
    405438    g_signal_connect(msg, "got-chunk", G_CALLBACK(gotChunkCallback), this);
     439
     440    g_object_set_data(G_OBJECT(msg), "resourceHandle", reinterpret_cast<void*>(this));
    406441
    407442    HTTPHeaderMap customHeaders = d->m_request.httpHeaderFields();
     
    519554    String protocol = url.protocol();
    520555
     556    // Used to set the authentication dialog toplevel; may be NULL
     557    d->m_frame = frame;
     558
    521559    if (equalIgnoringCase(protocol, "data"))
    522560        return startData(urlString);
  • trunk/configure.ac

    r41172 r41270  
    349349AC_MSG_RESULT([$enable_geolocation])
    350350
     351# check whether to enable gnomekeyring support
     352AC_MSG_CHECKING([whether to enable gnomekeyring support])
     353AC_ARG_ENABLE(gnomekeyring,
     354              AC_HELP_STRING([--enable-gnomekeyring],
     355                             [enable support for gnomekeyring [default=no]]),
     356              [],[enable_gnomekeyring="no"])
     357AC_MSG_RESULT([$enable_gnomekeyring])
     358
    351359# check whether to enable SVG support
    352360AC_MSG_CHECKING([whether to enable SVG support])
     
    518526AC_SUBST([LIBSOUP_LIBS])
    519527
     528if test "$enable_gnomekeyring" = "yes"; then
     529   PKG_CHECK_MODULES([GNOMEKEYRING],
     530                     [gnome-keyring-1])
     531   AC_SUBST([GNOMEKEYRING_CFLAGS])
     532   AC_SUBST([GNOMEKEYRING_LIBS])
     533fi
     534
    520535# check if FreeType/FontConfig are available
    521536if test "$with_font_backend" = "freetype"; then
     
    594609AM_CONDITIONAL([TARGET_QUARTZ], [test "$with_target" = "quartz"])
    595610AM_CONDITIONAL([TARGET_DIRECTFB], [test "$with_target" = "directfb"])
     611
     612# Auth backend conditionals
     613AM_CONDITIONAL([USE_GNOMEKEYRING], [test "$enable_gnomekeyring" = "yes"])
    596614
    597615# Font backend conditionals
     
    650668 Dashboard support                                        : $enable_dashboard_support
    651669 Geolocation support                                      : $enable_geolocation
     670 GNOME Keyring support                                    : $enable_gnomekeyring
    652671 HTML5 offline web applications support                   : $enable_offline_web_applications
    653672 HTML5 channel messaging support                          : $enable_channel_messaging
Note: See TracChangeset for help on using the changeset viewer.