Changeset 133317 in webkit
- Timestamp:
- Nov 2, 2012, 11:05:42 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ChangeLog
r133294 r133317 1 2012-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 1 13 2012-11-02 Michael Brüning <michael.bruning@digia.com> 2 14 -
trunk/Source/WebCore/ChangeLog
r133316 r133317 1 2012-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 1 23 2012-11-02 Jinwoo Song <jinwoo7.song@samsung.com> 2 24 -
trunk/Source/WebCore/GNUmakefile.am
r132600 r133317 74 74 -I$(srcdir)/Source/WebCore/platform/mock \ 75 75 -I$(srcdir)/Source/WebCore/platform/network \ 76 -I$(srcdir)/Source/WebCore/platform/network/gtk \ 76 77 -I$(srcdir)/Source/WebCore/platform/sql \ 77 78 -I$(srcdir)/Source/WebCore/platform/text \ … … 642 643 $(GLIB_CFLAGS) \ 643 644 $(GSTREAMER_CFLAGS) \ 645 $(LIBSECRET_CFLAGS) \ 644 646 $(LIBSOUP_CFLAGS) \ 645 647 $(LIBXML_CFLAGS) \ … … 705 707 $(GTK_CFLAGS) \ 706 708 $(HILDON_CFLAGS) \ 709 $(LIBSECRET_CFLAGS) \ 707 710 $(LIBSOUP_CFLAGS) \ 708 711 $(LIBXML_CFLAGS) \ -
trunk/Source/WebCore/GNUmakefile.list.am
r133282 r133317 4749 4749 Source/WebCore/platform/network/SocketStreamHandleBase.h \ 4750 4750 Source/WebCore/platform/network/SocketStreamHandleClient.h \ 4751 Source/WebCore/platform/network/gtk/CredentialBackingStore.cpp \ 4752 Source/WebCore/platform/network/gtk/CredentialBackingStore.h \ 4751 4753 Source/WebCore/platform/network/soup/AuthenticationChallenge.h \ 4752 4754 Source/WebCore/platform/network/soup/AuthenticationChallengeSoup.cpp \ -
trunk/Source/WebCore/platform/gtk/GRefPtrGtk.cpp
r95901 r133317 21 21 #include "GRefPtrGtk.h" 22 22 23 #define SECRET_WITH_UNSTABLE 1 24 #define SECRET_API_SUBJECT_TO_CHANGE 1 25 23 26 #include <glib.h> 24 27 #include <gtk/gtk.h> 28 #include <libsecret/secret.h> 25 29 26 30 namespace WTF { … … 37 41 if (ptr) 38 42 gtk_target_list_unref(ptr); 43 } 44 45 template <> SecretValue* refGPtr(SecretValue* ptr) 46 { 47 if (ptr) 48 secret_value_ref(ptr); 49 return ptr; 50 } 51 52 template <> void derefGPtr(SecretValue* ptr) 53 { 54 if (ptr) 55 secret_value_unref(ptr); 39 56 } 40 57 -
trunk/Source/WebCore/platform/gtk/GRefPtrGtk.h
r95901 r133317 24 24 #include <wtf/gobject/GRefPtr.h> 25 25 26 typedef struct _SecretValue SecretValue; 27 26 28 namespace WTF { 27 29 28 30 template <> GtkTargetList* refGPtr(GtkTargetList* ptr); 29 31 template <> void derefGPtr(GtkTargetList* ptr); 32 33 template <> SecretValue* refGPtr(SecretValue* ptr); 34 template <> void derefGPtr(SecretValue* ptr); 30 35 31 36 #ifdef GTK_API_VERSION_2 -
trunk/Source/WebCore/platform/gtk/GtkAuthenticationDialog.cpp
r132286 r133317 21 21 #include "GtkAuthenticationDialog.h" 22 22 23 #include "AuthenticationChallenge.h" 24 #include "CredentialBackingStore.h" 23 25 #include "GtkVersioning.h" 24 26 #include <glib/gi18n-lib.h> … … 53 55 54 56 return entry; 55 }56 57 static bool sessionCanSavePasswords(SoupSession* session)58 {59 #ifdef SOUP_TYPE_PASSWORD_MANAGER60 return soup_session_get_feature(session, SOUP_TYPE_PASSWORD_MANAGER);61 #else62 return false;63 #endif64 57 } 65 58 … … 76 69 , m_passwordEntry(0) 77 70 , m_rememberCheckButton(0) 78 #ifdef SOUP_TYPE_PASSWORD_MANAGER79 71 , m_isSavingPassword(false) 80 72 , m_savePasswordHandler(0) 81 #endif82 73 { 83 74 GtkDialog* dialog = GTK_DIALOG(m_dialog); … … 188 179 gtk_entry_set_visibility(GTK_ENTRY(m_passwordEntry), FALSE); 189 180 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); 219 191 } 220 192 221 193 void GtkAuthenticationDialog::show() 222 194 { 223 const char* username = 0;224 const char* password = 0;225 bool haveSavedLogin = getSavedLogin(m_auth.get(), &username, &password);226 195 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()); 230 204 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_rememberCheckButton), TRUE); 205 } 206 231 207 g_signal_connect(m_dialog, "response", G_CALLBACK(authenticationDialogResponseCallback), this); 232 208 gtk_widget_show_all(m_dialog); … … 240 216 gtk_widget_destroy(m_dialog); 241 217 242 #ifdef SOUP_TYPE_PASSWORD_MANAGER243 218 shouldDelete = !m_isSavingPassword; 244 #endif245 219 246 220 // Do not delete the object if it's still saving the password, … … 250 224 } 251 225 252 #ifdef SOUP_TYPE_PASSWORD_MANAGER253 226 void GtkAuthenticationDialog::savePasswordCallback(SoupMessage* message, GtkAuthenticationDialog* dialog) 254 227 { … … 262 235 263 236 // 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 } 266 247 267 248 // Disconnect the callback. If the authentication succeeded we are done, … … 273 254 delete this; 274 255 } 275 #endif276 256 277 257 void GtkAuthenticationDialog::authenticate() … … 281 261 soup_auth_authenticate(m_auth.get(), username, password); 282 262 283 #ifdef SOUP_TYPE_PASSWORD_MANAGER284 263 if (m_rememberCheckButton && gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(m_rememberCheckButton))) { 285 264 m_username = username; … … 288 267 m_savePasswordHandler = g_signal_connect(m_message.get(), "got-headers", G_CALLBACK(savePasswordCallback), this); 289 268 } 290 #endif291 269 } 292 270 -
trunk/Source/WebCore/platform/gtk/GtkAuthenticationDialog.h
r132286 r133317 20 20 #ifndef GtkAuthenticationDialog_h 21 21 #define GtkAuthenticationDialog_h 22 23 #define LIBSOUP_I_HAVE_READ_BUG_594377_AND_KNOW_SOUP_PASSWORD_MANAGER_MIGHT_GO_AWAY24 22 25 23 #include <wtf/gobject/GOwnPtr.h> … … 45 43 void destroy(); 46 44 void authenticate(); 47 48 #ifdef SOUP_TYPE_PASSWORD_MANAGER49 45 void savePassword(); 50 46 static void savePasswordCallback(SoupMessage*, GtkAuthenticationDialog*); 51 #endif52 53 47 static void authenticationDialogResponseCallback(GtkWidget*, gint responseID, GtkAuthenticationDialog*); 54 48 … … 62 56 GtkWidget* m_rememberCheckButton; 63 57 64 #ifdef SOUP_TYPE_PASSWORD_MANAGER65 58 bool m_isSavingPassword; 66 59 unsigned long m_savePasswordHandler; 67 60 CString m_username; 68 61 CString m_password; 69 #endif70 62 }; 71 63 -
trunk/Source/WebKit/gtk/ChangeLog
r132396 r133317 1 2012-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 1 13 2012-10-24 Brady Eidson <beidson@apple.com> 2 14 -
trunk/Source/WebKit/gtk/GNUmakefile.am
r133059 r133317 96 96 $(GTK_LIBS) \ 97 97 $(JPEG_LIBS) \ 98 $(LIBSECRET_LIBS) \ 98 99 $(LIBSOUP_LIBS) \ 99 100 $(LIBXML_LIBS) \ -
trunk/Source/WebKit2/ChangeLog
r133307 r133317 1 2012-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 1 13 2012-11-02 Byungwoo Lee <bw80.lee@samsung.com> 2 14 -
trunk/Source/WebKit2/GNUmakefile.am
r133059 r133317 176 176 $(GTK_UNIX_PRINTING_LIBS) \ 177 177 $(JPEG_LIBS) \ 178 $(LIBSECRET_LIBS) \ 178 179 $(LIBSOUP_LIBS) \ 179 180 $(LIBXML_LIBS) \ … … 459 460 $(GSTREAMER_CFLAGS) \ 460 461 $(GTK2_CFLAGS) \ 462 $(LIBSECRET_CFLAGS) \ 461 463 $(LIBSOUP_CFLAGS) \ 462 464 $(LIBXML_CFLAGS) \ -
trunk/configure.ac
r132876 r133317 963 963 AC_SUBST([LIBSOUP_LIBS]) 964 964 965 PKG_CHECK_MODULES([LIBSECRET], [libsecret-1]) 966 AC_SUBST([LIBSECRET_CFLAGS]) 967 AC_SUBST([LIBSECRET_LIBS]) 968 965 969 # check if FreeType/FontConfig are available 966 970 if test "$with_font_backend" = "freetype"; then
Note:
See TracChangeset
for help on using the changeset viewer.