epiphany r8417 - in branches/gnome-2-24: . embed/mozilla



Author: chpe
Date: Thu Aug 14 19:41:56 2008
New Revision: 8417
URL: http://svn.gnome.org/viewvc/epiphany?rev=8417&view=rev

Log:
Allow remembering the selected user cert.

Modified:
   branches/gnome-2-24/configure.ac
   branches/gnome-2-24/embed/mozilla/GtkNSSClientAuthDialogs.cpp

Modified: branches/gnome-2-24/configure.ac
==============================================================================
--- branches/gnome-2-24/configure.ac	(original)
+++ branches/gnome-2-24/configure.ac	Thu Aug 14 19:41:56 2008
@@ -390,6 +390,17 @@
 
 GECKO_CHECK_HEADERS([],[nsIBadCertListener.h],[have_nsibadcertlistener=yes],[have_nsibadcertlistener=no])
 
+# Check for nsIClientAuthUserDecision in nsIClientAuthDialogs.h
+
+GECKO_COMPILE_IFELSE([],
+  [GECKO_XPCOM_PROGRAM([[#include <nsIClientAuthDialogs.h>]],
+                       [[nsIClientAuthUserDecision *decision;]])],
+  [have_nsIClientAuthUserDecision=yes],[have_nsIClientAuthUserDecision=no])
+
+if test "$have_nsIClientAuthUserDecision" = "yes"; then
+  AC_DEFINE([HAVE_NSICLIENTAUTHUSERDECISION],[1],[Define if nsIClientAuthUserDecision exists])
+fi
+
 # Check for some contractIDs that we need but are provided by extensions
 # which may or may not have been built.
 

Modified: branches/gnome-2-24/embed/mozilla/GtkNSSClientAuthDialogs.cpp
==============================================================================
--- branches/gnome-2-24/embed/mozilla/GtkNSSClientAuthDialogs.cpp	(original)
+++ branches/gnome-2-24/embed/mozilla/GtkNSSClientAuthDialogs.cpp	Thu Aug 14 19:41:56 2008
@@ -267,13 +267,36 @@
 
 	gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0);
 
+#ifdef HAVE_NSICLIENTAUTHUSERDECISION
+        GtkWidget *rememberButton;
+        nsCOMPtr<nsIClientAuthUserDecision> userDecision (do_QueryInterface (ctx));
+
+        if (userDecision)
+        {
+                PRBool remember = PR_FALSE;
+                userDecision->GetRememberClientAuthCertificate (&remember);
+
+                rememberButton = gtk_check_button_new_with_mnemonic ("_Remember this choice"); /* FIXME i18n */
+                gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (rememberButton), remember != PR_FALSE);
+                gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), rememberButton, FALSE, FALSE, 0);
+                gtk_widget_show (rememberButton);
+        }
+#endif /* HAVE_NSICLIENTAUTHUSERDECISION */
+
 	/* run the dialog */
 	int res = modalDialog.Run (GTK_DIALOG (dialog));
 	if (res == GTK_RESPONSE_OK)
 	{
 		*canceled = PR_FALSE;
 		*selectedIndex = gtk_combo_box_get_active (GTK_COMBO_BOX (combo));
-	} 
+	
+#ifdef HAVE_NSICLIENTAUTHUSERDECISION
+                if (userDecision)
+                {
+                        userDecision->SetRememberClientAuthCertificate (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rememberButton)) != FALSE);
+                }
+#endif /* HAVE_NSICLIENTAUTHUSERDECISION */
+        }
 	else
 	{
 		*canceled = PR_TRUE;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]