Title: [137748] trunk/Source
Revision
137748
Author
commit-qu...@webkit.org
Date
2012-12-14 08:57:55 -0800 (Fri, 14 Dec 2012)

Log Message

[GTK] When in private mode WebKitGTK+ should not save HTTP authentication credentials to the persistent storage
https://bugs.webkit.org/show_bug.cgi?id=104910

Patch by Alberto Garcia <agar...@igalia.com> on 2012-12-14
Reviewed by Martin Robinson.

Source/WebCore:

Add new parameter to GtkAuthenticationDialog to select whether we
allow persistent storage of credential information or not. In the
latter case, the "Remember password" check button is not shown and
the credentials are always stored in the session.

* platform/gtk/GtkAuthenticationDialog.cpp:
(WebCore::GtkAuthenticationDialog::GtkAuthenticationDialog):
(WebCore::GtkAuthenticationDialog::createContentsInContainer):
(WebCore::GtkAuthenticationDialog::buttonClickedCallback):
* platform/gtk/GtkAuthenticationDialog.h:
(GtkAuthenticationDialog):

Source/WebKit/gtk:

* WebCoreSupport/FrameLoaderClientGtk.cpp:
(WebKit::FrameLoaderClient::dispatchDidReceiveAuthenticationChallenge):
When creating the GtkAuthenticationDialog, set the credential
storage mode using the private browsing setting from the current
page.

* webkit/webkitsoupauthdialog.cpp:
(sessionAuthenticate):
Create the GtkAuthenticationDialog with no persistent storage
allowed, as we are not handling the credential persistence here.

Source/WebKit2:

* UIProcess/API/gtk/WebKit2GtkAuthenticationDialog.cpp:
(WebKit::WebKit2GtkAuthenticationDialog::WebKit2GtkAuthenticationDialog):
* UIProcess/API/gtk/WebKit2GtkAuthenticationDialog.h:
(WebKit2GtkAuthenticationDialog):
GtkAuthenticationDialog has a new credential storage mode
parameter, so add it here too.

* UIProcess/API/gtk/WebKitWebView.cpp:
(webkitWebViewHandleAuthenticationChallenge):
When creating the GtkAuthenticationDialog, set the credential
storage mode using the private browsing setting from the current
page.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (137747 => 137748)


--- trunk/Source/WebCore/ChangeLog	2012-12-14 16:18:37 UTC (rev 137747)
+++ trunk/Source/WebCore/ChangeLog	2012-12-14 16:57:55 UTC (rev 137748)
@@ -1,3 +1,22 @@
+2012-12-14  Alberto Garcia  <agar...@igalia.com>
+
+        [GTK] When in private mode WebKitGTK+ should not save HTTP authentication credentials to the persistent storage
+        https://bugs.webkit.org/show_bug.cgi?id=104910
+
+        Reviewed by Martin Robinson.
+
+        Add new parameter to GtkAuthenticationDialog to select whether we
+        allow persistent storage of credential information or not. In the
+        latter case, the "Remember password" check button is not shown and
+        the credentials are always stored in the session.
+
+        * platform/gtk/GtkAuthenticationDialog.cpp:
+        (WebCore::GtkAuthenticationDialog::GtkAuthenticationDialog):
+        (WebCore::GtkAuthenticationDialog::createContentsInContainer):
+        (WebCore::GtkAuthenticationDialog::buttonClickedCallback):
+        * platform/gtk/GtkAuthenticationDialog.h:
+        (GtkAuthenticationDialog):
+
 2012-12-14  Andrey Kosyakov  <ca...@chromium.org>
 
         Unreviewed, rolling out r129633 and r129757.

Modified: trunk/Source/WebCore/platform/gtk/GtkAuthenticationDialog.cpp (137747 => 137748)


--- trunk/Source/WebCore/platform/gtk/GtkAuthenticationDialog.cpp	2012-12-14 16:18:37 UTC (rev 137747)
+++ trunk/Source/WebCore/platform/gtk/GtkAuthenticationDialog.cpp	2012-12-14 16:57:55 UTC (rev 137748)
@@ -32,21 +32,23 @@
 static const int gLayoutRowSpacing = 6;
 static const int gButtonSpacing = 5;
 
-GtkAuthenticationDialog::GtkAuthenticationDialog(const AuthenticationChallenge& challenge)
+GtkAuthenticationDialog::GtkAuthenticationDialog(const AuthenticationChallenge& challenge, CredentialStorageMode mode)
     : m_dialog(0)
     , m_loginEntry(0)
     , m_passwordEntry(0)
     , m_rememberCheckButton(0)
     , m_challenge(challenge)
+    , m_credentialStorageMode(mode)
 {
 }
 
-GtkAuthenticationDialog::GtkAuthenticationDialog(GtkWindow* parentWindow, const AuthenticationChallenge& challenge)
+GtkAuthenticationDialog::GtkAuthenticationDialog(GtkWindow* parentWindow, const AuthenticationChallenge& challenge, CredentialStorageMode mode)
     : m_dialog(gtk_dialog_new())
     , m_loginEntry(0)
     , m_passwordEntry(0)
     , m_rememberCheckButton(0)
     , m_challenge(challenge)
+    , m_credentialStorageMode(mode)
 {
     GtkWidget* contentArea = gtk_dialog_get_content_area(GTK_DIALOG(m_dialog));
     gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(m_dialog)), 5);
@@ -172,6 +174,7 @@
 
     m_rememberCheckButton = gtk_check_button_new_with_mnemonic(_("_Remember password"));
     gtk_label_set_line_wrap(GTK_LABEL(gtk_bin_get_child(GTK_BIN(m_rememberCheckButton))), TRUE);
+    gtk_widget_set_no_show_all(m_rememberCheckButton, m_credentialStorageMode == DisallowPersistentStorage);
 
 
     // We are adding the button box here manually instead of using the ready-made GtkDialog buttons.
@@ -248,8 +251,14 @@
     if (button == dialog->m_okayButton) {
         const char *username = gtk_entry_get_text(GTK_ENTRY(dialog->m_loginEntry));
         const char *password = gtk_entry_get_text(GTK_ENTRY(dialog->m_passwordEntry));
-        CredentialPersistence persistence = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->m_rememberCheckButton)) ?
-            CredentialPersistencePermanent : CredentialPersistenceForSession;
+        bool rememberPassword = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->m_rememberCheckButton));
+        CredentialPersistence persistence;
+
+        if (rememberPassword && dialog->m_credentialStorageMode == AllowPersistentStorage)
+            persistence = CredentialPersistencePermanent;
+        else
+            persistence = CredentialPersistenceForSession;
+
         credential = Credential(String::fromUTF8(username), String::fromUTF8(password), persistence);
     }
 

Modified: trunk/Source/WebCore/platform/gtk/GtkAuthenticationDialog.h (137747 => 137748)


--- trunk/Source/WebCore/platform/gtk/GtkAuthenticationDialog.h	2012-12-14 16:18:37 UTC (rev 137747)
+++ trunk/Source/WebCore/platform/gtk/GtkAuthenticationDialog.h	2012-12-14 16:57:55 UTC (rev 137748)
@@ -34,8 +34,13 @@
     WTF_MAKE_FAST_ALLOCATED;
 
 public:
-    GtkAuthenticationDialog(const AuthenticationChallenge&);
-    GtkAuthenticationDialog(GtkWindow*, const AuthenticationChallenge&);
+    enum CredentialStorageMode {
+        AllowPersistentStorage, // The user is asked whether to store credential information.
+        DisallowPersistentStorage // Credential information is only kept in the session.
+    };
+
+    GtkAuthenticationDialog(const AuthenticationChallenge&, CredentialStorageMode);
+    GtkAuthenticationDialog(GtkWindow*, const AuthenticationChallenge&, CredentialStorageMode);
     virtual ~GtkAuthenticationDialog() { }
     void show();
     void destroy();
@@ -53,6 +58,7 @@
 private:
     static void buttonClickedCallback(GtkWidget*, GtkAuthenticationDialog*);
     AuthenticationChallenge m_challenge;
+    CredentialStorageMode m_credentialStorageMode;
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebKit/gtk/ChangeLog (137747 => 137748)


--- trunk/Source/WebKit/gtk/ChangeLog	2012-12-14 16:18:37 UTC (rev 137747)
+++ trunk/Source/WebKit/gtk/ChangeLog	2012-12-14 16:57:55 UTC (rev 137748)
@@ -1,3 +1,21 @@
+2012-12-14  Alberto Garcia  <agar...@igalia.com>
+
+        [GTK] When in private mode WebKitGTK+ should not save HTTP authentication credentials to the persistent storage
+        https://bugs.webkit.org/show_bug.cgi?id=104910
+
+        Reviewed by Martin Robinson.
+
+        * WebCoreSupport/FrameLoaderClientGtk.cpp:
+        (WebKit::FrameLoaderClient::dispatchDidReceiveAuthenticationChallenge):
+        When creating the GtkAuthenticationDialog, set the credential
+        storage mode using the private browsing setting from the current
+        page.
+
+        * webkit/webkitsoupauthdialog.cpp:
+        (sessionAuthenticate):
+        Create the GtkAuthenticationDialog with no persistent storage
+        allowed, as we are not handling the credential persistence here.
+
 2012-12-12  Mark Lam  <mark....@apple.com>
 
         Encapsulate externally used webdatabase APIs in DatabaseManager.

Modified: trunk/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp (137747 => 137748)


--- trunk/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp	2012-12-14 16:18:37 UTC (rev 137747)
+++ trunk/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp	2012-12-14 16:57:55 UTC (rev 137748)
@@ -204,9 +204,17 @@
         return;
     }
 
-    GtkWidget* toplevel = gtk_widget_get_toplevel(GTK_WIDGET(webkit_web_frame_get_web_view(m_frame)));
+    WebKitWebView* view = webkit_web_frame_get_web_view(m_frame);
+    GtkAuthenticationDialog::CredentialStorageMode credentialStorageMode;
+
+    if (core(view)->settings()->privateBrowsingEnabled())
+        credentialStorageMode = GtkAuthenticationDialog::DisallowPersistentStorage;
+    else
+        credentialStorageMode = GtkAuthenticationDialog::AllowPersistentStorage;
+
+    GtkWidget* toplevel = gtk_widget_get_toplevel(GTK_WIDGET(view));
     GtkWindow* toplevelWindow = widgetIsOnscreenToplevelWindow(toplevel) ? GTK_WINDOW(toplevel) : 0;
-    GtkAuthenticationDialog* dialog = new GtkAuthenticationDialog(toplevelWindow, challenge);
+    GtkAuthenticationDialog* dialog = new GtkAuthenticationDialog(toplevelWindow, challenge, credentialStorageMode);
     dialog->show();
 }
 

Modified: trunk/Source/WebKit/gtk/webkit/webkitsoupauthdialog.cpp (137747 => 137748)


--- trunk/Source/WebKit/gtk/webkit/webkitsoupauthdialog.cpp	2012-12-14 16:18:37 UTC (rev 137747)
+++ trunk/Source/WebKit/gtk/webkit/webkitsoupauthdialog.cpp	2012-12-14 16:57:55 UTC (rev 137748)
@@ -143,7 +143,7 @@
     // impossible with gcc, due to WebKitSoupAuthDialogAuthenticationClient's two superclasses.
     client->derefWebKitSoupAuthDialogAuthenticationClient();
 
-    GtkAuthenticationDialog* authDialog = new GtkAuthenticationDialog(toplevel, challenge);
+    GtkAuthenticationDialog* authDialog = new GtkAuthenticationDialog(toplevel, challenge, GtkAuthenticationDialog::DisallowPersistentStorage);
     authDialog->show();
 }
 

Modified: trunk/Source/WebKit2/ChangeLog (137747 => 137748)


--- trunk/Source/WebKit2/ChangeLog	2012-12-14 16:18:37 UTC (rev 137747)
+++ trunk/Source/WebKit2/ChangeLog	2012-12-14 16:57:55 UTC (rev 137748)
@@ -1,3 +1,23 @@
+2012-12-14  Alberto Garcia  <agar...@igalia.com>
+
+        [GTK] When in private mode WebKitGTK+ should not save HTTP authentication credentials to the persistent storage
+        https://bugs.webkit.org/show_bug.cgi?id=104910
+
+        Reviewed by Martin Robinson.
+
+        * UIProcess/API/gtk/WebKit2GtkAuthenticationDialog.cpp:
+        (WebKit::WebKit2GtkAuthenticationDialog::WebKit2GtkAuthenticationDialog):
+        * UIProcess/API/gtk/WebKit2GtkAuthenticationDialog.h:
+        (WebKit2GtkAuthenticationDialog):
+        GtkAuthenticationDialog has a new credential storage mode
+        parameter, so add it here too.
+
+        * UIProcess/API/gtk/WebKitWebView.cpp:
+        (webkitWebViewHandleAuthenticationChallenge):
+        When creating the GtkAuthenticationDialog, set the credential
+        storage mode using the private browsing setting from the current
+        page.
+
 2012-12-14  Mikhail Pozdnyakov  <mikhail.pozdnya...@intel.com>
 
         [EFL][WK2] Fix EFL build after r137718

Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKit2GtkAuthenticationDialog.cpp (137747 => 137748)


--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKit2GtkAuthenticationDialog.cpp	2012-12-14 16:18:37 UTC (rev 137747)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKit2GtkAuthenticationDialog.cpp	2012-12-14 16:57:55 UTC (rev 137748)
@@ -38,8 +38,8 @@
     return FALSE;
 }
 
-WebKit2GtkAuthenticationDialog::WebKit2GtkAuthenticationDialog(AuthenticationChallengeProxy* authenticationChallenge)
-    : GtkAuthenticationDialog(authenticationChallenge->core())
+WebKit2GtkAuthenticationDialog::WebKit2GtkAuthenticationDialog(AuthenticationChallengeProxy* authenticationChallenge, CredentialStorageMode mode)
+    : GtkAuthenticationDialog(authenticationChallenge->core(), mode)
     , m_authenticationChallenge(authenticationChallenge)
     , m_styleContext(adoptGRef(gtk_style_context_new()))
 {

Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKit2GtkAuthenticationDialog.h (137747 => 137748)


--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKit2GtkAuthenticationDialog.h	2012-12-14 16:18:37 UTC (rev 137747)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKit2GtkAuthenticationDialog.h	2012-12-14 16:57:55 UTC (rev 137748)
@@ -31,7 +31,7 @@
 
 class WebKit2GtkAuthenticationDialog : public WebCore::GtkAuthenticationDialog {
 public:
-    WebKit2GtkAuthenticationDialog(AuthenticationChallengeProxy*);
+    WebKit2GtkAuthenticationDialog(AuthenticationChallengeProxy*, CredentialStorageMode);
     virtual ~WebKit2GtkAuthenticationDialog() { }
     GtkWidget* widget() { return m_dialog; }
 

Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp (137747 => 137748)


--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp	2012-12-14 16:18:37 UTC (rev 137747)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp	2012-12-14 16:57:55 UTC (rev 137748)
@@ -1653,7 +1653,15 @@
 
 void webkitWebViewHandleAuthenticationChallenge(WebKitWebView* webView, AuthenticationChallengeProxy* authenticationChallenge)
 {
-    WebKit2GtkAuthenticationDialog* dialog = new WebKit2GtkAuthenticationDialog(authenticationChallenge);
+    WebKit2GtkAuthenticationDialog* dialog;
+    GtkAuthenticationDialog::CredentialStorageMode credentialStorageMode;
+
+    if (webkit_settings_get_enable_private_browsing(webView->priv->settings.get()))
+        credentialStorageMode = GtkAuthenticationDialog::DisallowPersistentStorage;
+    else
+        credentialStorageMode = GtkAuthenticationDialog::AllowPersistentStorage;
+
+    dialog = new WebKit2GtkAuthenticationDialog(authenticationChallenge, credentialStorageMode);
     webkitWebViewBaseAddAuthenticationDialog(WEBKIT_WEB_VIEW_BASE(webView), dialog);
     dialog->show();
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to