Changeset 133317 in webkit


Ignore:
Timestamp:
Nov 2, 2012, 11:05:42 AM (13 years ago)
Author:
commit-queue@webkit.org
Message:

[GTK] Remove dependency on SoupPasswordManager
https://bugs.webkit.org/show_bug.cgi?id=100775

Patch by Martin Robinson <mrobinson@igalia.com> on 2012-11-02
Reviewed by Carlos Garcia Campos.

.:

Add a libsecret dependency to the build. This is necessary so that we can remove
a dependency on SoupPasswordManager.

  • configure.ac: Look for libsecret using the pkg-config configuration macro.

Source/WebCore:

Remember passwords using libsecret instead of SoupPasswordManager. We accomplish this using
a new class, CredentialBackingStore. CredentialBackingStore will soon be the thing that backs
CredentialStoreGtk. The name is based on the name of a similar class from the BlackBerry port.

No new tests. This does not change behavior.

  • GNUmakefile.am: Add libsecret flags to the build and the new directory to the include list.
  • GNUmakefile.list.am: Add new files to the source list.
  • platform/gtk/GRefPtrGtk.cpp: Add support for SecretValue to GRefPtrGtk.
  • platform/gtk/GtkAuthenticationDialog.cpp: Replace interaction with SoupPasswordManger with

interaction with the CredentialBackingStore. Remove all conditional SoupPasswordManager guards.

  • platform/gtk/GtkAuthenticationDialog.h: Ditto.
  • platform/network/gtk/CredentialBackingStore.cpp: Added.
  • platform/network/gtk/CredentialBackingStore.h: Added.

Source/WebKit/gtk:

Add a libsecret dependency to the build. This is necessary so that we can remove
a dependency on SoupPasswordManager.

  • GNUmakefile.am: Use libsecret libs during WebKit1 library compilation.

Source/WebKit2:

Add a libsecret dependency to the build. This is necessary so that we can remove
a dependency on SoupPasswordManager.

  • GNUmakefile.am: Add libsecret CFLAGS to the WebKit2 build.
Location:
trunk
Files:
3 added
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r133294 r133317  
     12012-11-02  Martin Robinson  <mrobinson@igalia.com>
     2
     3        [GTK] Remove dependency on SoupPasswordManager
     4        https://bugs.webkit.org/show_bug.cgi?id=100775
     5
     6        Reviewed by Carlos Garcia Campos.
     7
     8        Add a libsecret dependency to the build. This is necessary so that we can remove
     9        a dependency on SoupPasswordManager.
     10
     11        * configure.ac: Look for libsecret using the pkg-config configuration macro.
     12
    1132012-11-02  Michael Brüning  <michael.bruning@digia.com>
    214
  • trunk/Source/WebCore/ChangeLog

    r133316 r133317  
     12012-11-02  Martin Robinson  <mrobinson@igalia.com>
     2
     3        [GTK] Remove dependency on SoupPasswordManager
     4        https://bugs.webkit.org/show_bug.cgi?id=100775
     5
     6        Reviewed by Carlos Garcia Campos.
     7
     8        Remember passwords using libsecret instead of SoupPasswordManager. We accomplish this using
     9        a new class, CredentialBackingStore. CredentialBackingStore will soon be the thing that backs
     10        CredentialStoreGtk. The name is based on the name of a similar class from the BlackBerry port.
     11
     12        No new tests. This does not change behavior.
     13
     14        * GNUmakefile.am: Add libsecret flags to the build and the new directory to the include list.
     15        * GNUmakefile.list.am: Add new files to the source list.
     16        * platform/gtk/GRefPtrGtk.cpp: Add support for SecretValue to GRefPtrGtk.
     17        * platform/gtk/GtkAuthenticationDialog.cpp: Replace interaction with SoupPasswordManger with
     18        interaction with the CredentialBackingStore. Remove all conditional SoupPasswordManager guards.
     19        * platform/gtk/GtkAuthenticationDialog.h: Ditto.
     20        * platform/network/gtk/CredentialBackingStore.cpp: Added.
     21        * platform/network/gtk/CredentialBackingStore.h: Added.
     22
    1232012-11-02  Jinwoo Song  <jinwoo7.song@samsung.com>
    224
  • trunk/Source/WebCore/GNUmakefile.am

    r132600 r133317  
    7474        -I$(srcdir)/Source/WebCore/platform/mock \
    7575        -I$(srcdir)/Source/WebCore/platform/network \
     76        -I$(srcdir)/Source/WebCore/platform/network/gtk \
    7677        -I$(srcdir)/Source/WebCore/platform/sql \
    7778        -I$(srcdir)/Source/WebCore/platform/text \
     
    642643        $(GLIB_CFLAGS) \
    643644        $(GSTREAMER_CFLAGS) \
     645        $(LIBSECRET_CFLAGS) \
    644646        $(LIBSOUP_CFLAGS) \
    645647        $(LIBXML_CFLAGS) \
     
    705707        $(GTK_CFLAGS) \
    706708        $(HILDON_CFLAGS) \
     709        $(LIBSECRET_CFLAGS) \
    707710        $(LIBSOUP_CFLAGS) \
    708711        $(LIBXML_CFLAGS) \
  • trunk/Source/WebCore/GNUmakefile.list.am

    r133282 r133317  
    47494749        Source/WebCore/platform/network/SocketStreamHandleBase.h \
    47504750        Source/WebCore/platform/network/SocketStreamHandleClient.h \
     4751        Source/WebCore/platform/network/gtk/CredentialBackingStore.cpp \
     4752        Source/WebCore/platform/network/gtk/CredentialBackingStore.h \
    47514753        Source/WebCore/platform/network/soup/AuthenticationChallenge.h \
    47524754        Source/WebCore/platform/network/soup/AuthenticationChallengeSoup.cpp \
  • trunk/Source/WebCore/platform/gtk/GRefPtrGtk.cpp

    r95901 r133317  
    2121#include "GRefPtrGtk.h"
    2222
     23#define SECRET_WITH_UNSTABLE 1
     24#define SECRET_API_SUBJECT_TO_CHANGE 1
     25
    2326#include <glib.h>
    2427#include <gtk/gtk.h>
     28#include <libsecret/secret.h>
    2529
    2630namespace WTF {
     
    3741    if (ptr)
    3842        gtk_target_list_unref(ptr);
     43}
     44
     45template <> SecretValue* refGPtr(SecretValue* ptr)
     46{
     47    if (ptr)
     48        secret_value_ref(ptr);
     49    return ptr;
     50}
     51
     52template <> void derefGPtr(SecretValue* ptr)
     53{
     54    if (ptr)
     55        secret_value_unref(ptr);
    3956}
    4057
  • trunk/Source/WebCore/platform/gtk/GRefPtrGtk.h

    r95901 r133317  
    2424#include <wtf/gobject/GRefPtr.h>
    2525
     26typedef struct _SecretValue SecretValue;
     27
    2628namespace WTF {
    2729
    2830template <> GtkTargetList* refGPtr(GtkTargetList* ptr);
    2931template <> void derefGPtr(GtkTargetList* ptr);
     32
     33template <> SecretValue* refGPtr(SecretValue* ptr);
     34template <> void derefGPtr(SecretValue* ptr);
    3035
    3136#ifdef GTK_API_VERSION_2
  • trunk/Source/WebCore/platform/gtk/GtkAuthenticationDialog.cpp

    r132286 r133317  
    2121#include "GtkAuthenticationDialog.h"
    2222
     23#include "AuthenticationChallenge.h"
     24#include "CredentialBackingStore.h"
    2325#include "GtkVersioning.h"
    2426#include <glib/gi18n-lib.h>
     
    5355
    5456    return entry;
    55 }
    56 
    57 static bool sessionCanSavePasswords(SoupSession* session)
    58 {
    59 #ifdef SOUP_TYPE_PASSWORD_MANAGER
    60     return soup_session_get_feature(session, SOUP_TYPE_PASSWORD_MANAGER);
    61 #else
    62     return false;
    63 #endif
    6457}
    6558
     
    7669    , m_passwordEntry(0)
    7770    , m_rememberCheckButton(0)
    78 #ifdef SOUP_TYPE_PASSWORD_MANAGER
    7971    , m_isSavingPassword(false)
    8072    , m_savePasswordHandler(0)
    81 #endif
    8273{
    8374    GtkDialog* dialog = GTK_DIALOG(m_dialog);
     
    188179    gtk_entry_set_visibility(GTK_ENTRY(m_passwordEntry), FALSE);
    189180
    190     if (sessionCanSavePasswords(m_session)) {
    191 #ifdef GTK_API_VERSION_2
    192         GtkWidget* rememberBox = gtk_vbox_new(FALSE, 6);
    193 #else
    194         GtkWidget* rememberBox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 6);
    195 #endif
    196         gtk_box_pack_start(GTK_BOX(vBox), rememberBox, FALSE, FALSE, 0);
    197 
    198         m_rememberCheckButton = gtk_check_button_new_with_mnemonic(_("_Remember password"));
    199         gtk_label_set_line_wrap(GTK_LABEL(gtk_bin_get_child(GTK_BIN(m_rememberCheckButton))), TRUE);
    200         gtk_box_pack_start(GTK_BOX(rememberBox), m_rememberCheckButton, FALSE, FALSE, 0);
    201     }
    202 }
    203 
    204 static bool getSavedLogin(SoupAuth* auth, const char** username, const char** password)
    205 {
    206 #ifdef SOUP_TYPE_PASSWORD_MANAGER
    207     GSList* users = soup_auth_get_saved_users(auth);
    208     if (!users)
    209         return false;
    210 
    211     *username = static_cast<char*>(users->data);
    212     *password = soup_auth_get_saved_password(auth, *username);
    213     g_slist_free(users);
    214 
    215     return *username && *password;
    216 #else
    217     return false;
    218 #endif
     181#ifdef GTK_API_VERSION_2
     182    GtkWidget* rememberBox = gtk_vbox_new(FALSE, 6);
     183#else
     184    GtkWidget* rememberBox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 6);
     185#endif
     186    gtk_box_pack_start(GTK_BOX(vBox), rememberBox, FALSE, FALSE, 0);
     187
     188    m_rememberCheckButton = gtk_check_button_new_with_mnemonic(_("_Remember password"));
     189    gtk_label_set_line_wrap(GTK_LABEL(gtk_bin_get_child(GTK_BIN(m_rememberCheckButton))), TRUE);
     190    gtk_box_pack_start(GTK_BOX(rememberBox), m_rememberCheckButton, FALSE, FALSE, 0);
    219191}
    220192
    221193void GtkAuthenticationDialog::show()
    222194{
    223     const char* username = 0;
    224     const char* password = 0;
    225     bool haveSavedLogin = getSavedLogin(m_auth.get(), &username, &password);
    226195    soup_session_pause_message(m_session, m_message.get());
    227     gtk_entry_set_text(GTK_ENTRY(m_loginEntry), username ? username : "");
    228     gtk_entry_set_text(GTK_ENTRY(m_passwordEntry), password ? password : "");
    229     if (m_rememberCheckButton && haveSavedLogin)
     196
     197    // This is just a temporary kludge until GtkAuthenticationDialog works directly with AuthenticationChallenges.
     198    // See http://wkbug.com/99914
     199    AuthenticationChallenge challenge(0 /* session */, m_message.get(), m_auth.get(), false, 0);
     200    Credential savedCredential = credentialBackingStore().credentialForChallenge(challenge);
     201    if (!savedCredential.isEmpty()) {
     202        gtk_entry_set_text(GTK_ENTRY(m_loginEntry), savedCredential.user().utf8().data());
     203        gtk_entry_set_text(GTK_ENTRY(m_passwordEntry), savedCredential.password().utf8().data());
    230204        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_rememberCheckButton), TRUE);
     205    }
     206
    231207    g_signal_connect(m_dialog, "response", G_CALLBACK(authenticationDialogResponseCallback), this);
    232208    gtk_widget_show_all(m_dialog);
     
    240216    gtk_widget_destroy(m_dialog);
    241217
    242 #ifdef SOUP_TYPE_PASSWORD_MANAGER
    243218    shouldDelete = !m_isSavingPassword;
    244 #endif
    245219
    246220    // Do not delete the object if it's still saving the password,
     
    250224}
    251225
    252 #ifdef SOUP_TYPE_PASSWORD_MANAGER
    253226void GtkAuthenticationDialog::savePasswordCallback(SoupMessage* message, GtkAuthenticationDialog* dialog)
    254227{
     
    262235
    263236    // Anything but 401 and 5xx means the password was accepted.
    264     if (m_message.get()->status_code != 401 && m_message.get()->status_code < 500)
    265         soup_auth_save_password(m_auth.get(), m_username.data(), m_password.data());
     237    if (m_message.get()->status_code != 401 && m_message.get()->status_code < 500) {
     238        // This is just a temporary kludge until GtkAuthenticationDialog works directly with AuthenticationChallenges.
     239        // See http://wkbug.com/99914
     240        AuthenticationChallenge challenge(0 /* session */, m_message.get(), m_auth.get(), false, 0);
     241        Credential credentialToSave = Credential(
     242            String::fromUTF8(m_username.data()),
     243            String::fromUTF8(m_password.data()),
     244            CredentialPersistencePermanent);
     245        credentialBackingStore().storeCredentialsForChallenge(challenge, credentialToSave);
     246    }
    266247
    267248    // Disconnect the callback. If the authentication succeeded we are done,
     
    273254    delete this;
    274255}
    275 #endif
    276256
    277257void GtkAuthenticationDialog::authenticate()
     
    281261    soup_auth_authenticate(m_auth.get(), username, password);
    282262
    283 #ifdef SOUP_TYPE_PASSWORD_MANAGER
    284263    if (m_rememberCheckButton && gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(m_rememberCheckButton))) {
    285264        m_username = username;
     
    288267        m_savePasswordHandler = g_signal_connect(m_message.get(), "got-headers", G_CALLBACK(savePasswordCallback), this);
    289268    }
    290 #endif
    291269}
    292270
  • trunk/Source/WebCore/platform/gtk/GtkAuthenticationDialog.h

    r132286 r133317  
    2020#ifndef GtkAuthenticationDialog_h
    2121#define GtkAuthenticationDialog_h
    22 
    23 #define LIBSOUP_I_HAVE_READ_BUG_594377_AND_KNOW_SOUP_PASSWORD_MANAGER_MIGHT_GO_AWAY
    2422
    2523#include <wtf/gobject/GOwnPtr.h>
     
    4543    void destroy();
    4644    void authenticate();
    47 
    48 #ifdef SOUP_TYPE_PASSWORD_MANAGER
    4945    void savePassword();
    5046    static void savePasswordCallback(SoupMessage*, GtkAuthenticationDialog*);
    51 #endif
    52 
    5347    static void authenticationDialogResponseCallback(GtkWidget*, gint responseID, GtkAuthenticationDialog*);
    5448
     
    6256    GtkWidget* m_rememberCheckButton;
    6357
    64 #ifdef SOUP_TYPE_PASSWORD_MANAGER
    6558    bool m_isSavingPassword;
    6659    unsigned long m_savePasswordHandler;
    6760    CString m_username;
    6861    CString m_password;
    69 #endif
    7062};
    7163
  • trunk/Source/WebKit/gtk/ChangeLog

    r132396 r133317  
     12012-11-02  Martin Robinson  <mrobinson@igalia.com>
     2
     3        [GTK] Remove dependency on SoupPasswordManager
     4        https://bugs.webkit.org/show_bug.cgi?id=100775
     5
     6        Reviewed by Carlos Garcia Campos.
     7
     8        Add a libsecret dependency to the build. This is necessary so that we can remove
     9        a dependency on SoupPasswordManager.
     10
     11        * GNUmakefile.am: Use libsecret libs during WebKit1 library compilation.
     12
    1132012-10-24  Brady Eidson  <beidson@apple.com>
    214
  • trunk/Source/WebKit/gtk/GNUmakefile.am

    r133059 r133317  
    9696        $(GTK_LIBS) \
    9797        $(JPEG_LIBS) \
     98        $(LIBSECRET_LIBS) \
    9899        $(LIBSOUP_LIBS) \
    99100        $(LIBXML_LIBS) \
  • trunk/Source/WebKit2/ChangeLog

    r133307 r133317  
     12012-11-02  Martin Robinson  <mrobinson@igalia.com>
     2
     3        [GTK] Remove dependency on SoupPasswordManager
     4        https://bugs.webkit.org/show_bug.cgi?id=100775
     5
     6        Reviewed by Carlos Garcia Campos.
     7
     8        Add a libsecret dependency to the build. This is necessary so that we can remove
     9        a dependency on SoupPasswordManager.
     10
     11        * GNUmakefile.am: Add libsecret CFLAGS to the WebKit2 build.
     12
    1132012-11-02  Byungwoo Lee  <bw80.lee@samsung.com>
    214
  • trunk/Source/WebKit2/GNUmakefile.am

    r133059 r133317  
    176176        $(GTK_UNIX_PRINTING_LIBS) \
    177177        $(JPEG_LIBS) \
     178        $(LIBSECRET_LIBS) \
    178179        $(LIBSOUP_LIBS) \
    179180        $(LIBXML_LIBS) \
     
    459460        $(GSTREAMER_CFLAGS) \
    460461        $(GTK2_CFLAGS) \
     462        $(LIBSECRET_CFLAGS) \
    461463        $(LIBSOUP_CFLAGS) \
    462464        $(LIBXML_CFLAGS) \
  • trunk/configure.ac

    r132876 r133317  
    963963AC_SUBST([LIBSOUP_LIBS])
    964964
     965PKG_CHECK_MODULES([LIBSECRET], [libsecret-1])
     966AC_SUBST([LIBSECRET_CFLAGS])
     967AC_SUBST([LIBSECRET_LIBS])
     968
    965969# check if FreeType/FontConfig are available
    966970if test "$with_font_backend" = "freetype"; then
Note: See TracChangeset for help on using the changeset viewer.