Diff
Modified: trunk/Source/WebCore/ChangeLog (134973 => 134974)
--- trunk/Source/WebCore/ChangeLog 2012-11-16 19:02:04 UTC (rev 134973)
+++ trunk/Source/WebCore/ChangeLog 2012-11-16 19:06:44 UTC (rev 134974)
@@ -1,3 +1,25 @@
+2012-11-16 Martin Robinson <mrobin...@igalia.com>
+
+ [GTK] [WebKit2] Move GtkAuthenticationDialog to the UIProcess
+ https://bugs.webkit.org/show_bug.cgi?id=101843
+
+ Reviewed by Gustavo Noronha Silva.
+
+ Make GtkAuthenticationDialog more general, so that it can be subclassed in
+ WebKit2. We cannot use the WebCore authentication-related classes directly there.
+
+ No new tests. This patch does not change behavior.
+
+ * platform/gtk/GtkAuthenticationDialog.cpp:
+ (WebCore::GtkAuthenticationDialog::GtkAuthenticationDialog): Remove an unused include and reorder
+ some field initializers.
+ (WebCore::GtkAuthenticationDialog::authenticate): Now handle both the okay and cancel case here. This
+ makes it simpler to subclass.
+ (WebCore::GtkAuthenticationDialog::authenticationDialogResponseCallback): Handle fetching the username
+ and password here, so that it can be shared with subclasses.
+ * platform/gtk/GtkAuthenticationDialog.h: Make some methods virtual and protected so they can be
+ subclasses.
+
2012-11-16 Mark Pilgrim <pilg...@chromium.org>
[Chromium] Remove cookie-related functions from PlatformSupport
Modified: trunk/Source/WebCore/platform/gtk/GtkAuthenticationDialog.cpp (134973 => 134974)
--- trunk/Source/WebCore/platform/gtk/GtkAuthenticationDialog.cpp 2012-11-16 19:02:04 UTC (rev 134973)
+++ trunk/Source/WebCore/platform/gtk/GtkAuthenticationDialog.cpp 2012-11-16 19:06:44 UTC (rev 134974)
@@ -24,7 +24,6 @@
#include "GtkVersioning.h"
#include <glib/gi18n-lib.h>
#include <gtk/gtk.h>
-#include <libsoup/soup.h>
#include <wtf/gobject/GOwnPtr.h>
namespace WebCore {
@@ -61,11 +60,11 @@
}
GtkAuthenticationDialog::GtkAuthenticationDialog(GtkWindow* parentWindow, const AuthenticationChallenge& challenge)
- : m_challenge(challenge)
- , m_dialog(gtk_dialog_new())
+ : m_dialog(gtk_dialog_new())
, m_loginEntry(0)
, m_passwordEntry(0)
, m_rememberCheckButton(0)
+ , m_challenge(challenge)
{
GtkDialog* dialog = GTK_DIALOG(m_dialog);
gtk_dialog_add_buttons(dialog, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL);
@@ -205,22 +204,26 @@
delete this;
}
-void GtkAuthenticationDialog::authenticate()
+void GtkAuthenticationDialog::authenticate(const Credential& credential)
{
- const char *username = gtk_entry_get_text(GTK_ENTRY(m_loginEntry));
- const char *password = gtk_entry_get_text(GTK_ENTRY(m_passwordEntry));
- CredentialPersistence persistence = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(m_rememberCheckButton)) ?
- CredentialPersistencePermanent : CredentialPersistenceForSession;
- m_challenge.authenticationClient()->receivedCredential(m_challenge,
- Credential(String::fromUTF8(username), String::fromUTF8(password), persistence));
+ if (credential.isEmpty())
+ m_challenge.authenticationClient()->receivedRequestToContinueWithoutCredential(m_challenge);
+ else
+ m_challenge.authenticationClient()->receivedCredential(m_challenge, credential);
}
void GtkAuthenticationDialog::authenticationDialogResponseCallback(GtkWidget*, gint responseID, GtkAuthenticationDialog* dialog)
{
- if (responseID == GTK_RESPONSE_OK)
- dialog->authenticate();
+ Credential credential;
+ if (responseID == GTK_RESPONSE_OK) {
+ 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;
+ credential = Credential(String::fromUTF8(username), String::fromUTF8(password), persistence);
+ }
- dialog->m_challenge.authenticationClient()->receivedRequestToContinueWithoutCredential(dialog->m_challenge);
+ dialog->authenticate(credential);
dialog->destroy();
}
Modified: trunk/Source/WebCore/platform/gtk/GtkAuthenticationDialog.h (134973 => 134974)
--- trunk/Source/WebCore/platform/gtk/GtkAuthenticationDialog.h 2012-11-16 19:02:04 UTC (rev 134973)
+++ trunk/Source/WebCore/platform/gtk/GtkAuthenticationDialog.h 2012-11-16 19:06:44 UTC (rev 134974)
@@ -35,20 +35,20 @@
public:
GtkAuthenticationDialog(GtkWindow*, const AuthenticationChallenge&);
- ~GtkAuthenticationDialog();
-
+ virtual ~GtkAuthenticationDialog();
void show();
+protected:
+ virtual void authenticate(const Credential&);
+ GtkWidget* m_dialog;
+ GtkWidget* m_loginEntry;
+ GtkWidget* m_passwordEntry;
+ GtkWidget* m_rememberCheckButton;
+
private:
void destroy();
- void authenticate();
static void authenticationDialogResponseCallback(GtkWidget*, gint responseID, GtkAuthenticationDialog*);
-
AuthenticationChallenge m_challenge;
- GtkWidget* m_dialog;
- GtkWidget* m_loginEntry;
- GtkWidget* m_passwordEntry;
- GtkWidget* m_rememberCheckButton;
};
} // namespace WebCore
Modified: trunk/Source/WebKit2/ChangeLog (134973 => 134974)
--- trunk/Source/WebKit2/ChangeLog 2012-11-16 19:02:04 UTC (rev 134973)
+++ trunk/Source/WebKit2/ChangeLog 2012-11-16 19:06:44 UTC (rev 134974)
@@ -1,3 +1,31 @@
+2012-11-16 Martin Robinson <mrobin...@igalia.com>
+
+ Move authentication dialog to the UIProcess
+
+ [GTK] [WebKit2] Move GtkAuthenticationDialog to the UIProcess
+ https://bugs.webkit.org/show_bug.cgi?id=101843
+
+ Reviewed by Gustavo Noronha Silva.
+
+ Move the use of GtkAuthenticationDialog to the UIProcess along with the rest of
+ the GTK+ widgets. This will allow us to to embed the dialog into the WebView
+ in the future and to test authentication with the WebKit2 C API.
+
+ * GNUmakefile.list.am: Add the new class to the source list and remove the
+ GTK+-only WebFrameLoader implementation file.
+ * UIProcess/API/gtk/WebKit2GtkAuthenticationDialog.cpp: Added. A subclass of GtkAuthenticationDialog
+ which uses the WebKit2 classes to do the UIProcess-side authentication.
+ * UIProcess/API/gtk/WebKit2GtkAuthenticationDialog.h: Added.
+ * UIProcess/API/gtk/WebKitLoaderClient.cpp: Add a callback for didReceiveAuthenticationChallengeInFrame.
+ (didReceiveAuthenticationChallengeInFrame): Added.
+ (attachLoaderClientToView): Use the new callback.
+ * UIProcess/Authentication/AuthenticationChallengeProxy.h:
+ (WebKit::AuthenticationChallengeProxy::core): Add this getter for the WebCore class.
+ * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+ (WebKit::WebFrameLoaderClient::dispatchDidReceiveAuthenticationChallenge): Share the implementation
+ again.
+ * WebProcess/WebCoreSupport/gtk/WebFrameLoaderClientGtk.cpp: Removed.
+
2012-11-15 Alexey Proskuryakov <a...@apple.com>
Private Browsing is a per-page setting that sets a global value
Modified: trunk/Source/WebKit2/GNUmakefile.list.am (134973 => 134974)
--- trunk/Source/WebKit2/GNUmakefile.list.am 2012-11-16 19:02:04 UTC (rev 134973)
+++ trunk/Source/WebKit2/GNUmakefile.list.am 2012-11-16 19:06:44 UTC (rev 134974)
@@ -630,6 +630,8 @@
Source/WebKit2/UIProcess/API/cpp/WKRetainPtr.h \
Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h \
Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp \
+ Source/WebKit2/UIProcess/API/gtk/WebKit2GtkAuthenticationDialog.cpp \
+ Source/WebKit2/UIProcess/API/gtk/WebKit2GtkAuthenticationDialog.h \
Source/WebKit2/UIProcess/API/gtk/WebKitBackForwardList.h \
Source/WebKit2/UIProcess/API/gtk/WebKitBackForwardList.cpp \
Source/WebKit2/UIProcess/API/gtk/WebKitBackForwardListItem.h \
@@ -1113,7 +1115,6 @@
Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp \
Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp \
Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebErrorsGtk.cpp \
- Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebFrameLoaderClientGtk.cpp \
Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebPopupMenuGtk.cpp \
Source/WebKit2/WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp \
Source/WebKit2/WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.h \
Added: trunk/Source/WebKit2/UIProcess/API/gtk/WebKit2GtkAuthenticationDialog.cpp (0 => 134974)
--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKit2GtkAuthenticationDialog.cpp (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKit2GtkAuthenticationDialog.cpp 2012-11-16 19:06:44 UTC (rev 134974)
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2012 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "WebKit2GtkAuthenticationDialog.h"
+
+#include "AuthenticationChallengeProxy.h"
+#include "AuthenticationDecisionListener.h"
+#include "WebCredential.h"
+
+namespace WebKit {
+
+WebKit2GtkAuthenticationDialog::WebKit2GtkAuthenticationDialog(AuthenticationChallengeProxy* authenticationChallenge)
+ : GtkAuthenticationDialog(0, authenticationChallenge->core())
+ , m_authenticationChallenge(authenticationChallenge)
+{
+ // We aren't passing a toplevel to the GtkAuthenticationDialog constructor,
+ // because eventually this widget will be embedded into the WebView itself.
+}
+
+void WebKit2GtkAuthenticationDialog::authenticate(const WebCore::Credential& credential)
+{
+ RefPtr<WebCredential> webCredential = WebCredential::create(credential);
+ m_authenticationChallenge->listener()->useCredential(webCredential.get());
+}
+
+} // namespace WebKit
Property changes on: trunk/Source/WebKit2/UIProcess/API/gtk/WebKit2GtkAuthenticationDialog.cpp
___________________________________________________________________
Added: svn:eol-style
Added: trunk/Source/WebKit2/UIProcess/API/gtk/WebKit2GtkAuthenticationDialog.h (0 => 134974)
--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKit2GtkAuthenticationDialog.h (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKit2GtkAuthenticationDialog.h 2012-11-16 19:06:44 UTC (rev 134974)
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2012 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "AuthenticationChallengeProxy.h"
+#include "WKRetainPtr.h"
+#include <WebCore/Credential.h>
+#include <WebCore/GtkAuthenticationDialog.h>
+
+namespace WebKit {
+
+class WebKit2GtkAuthenticationDialog : public WebCore::GtkAuthenticationDialog {
+public:
+ WebKit2GtkAuthenticationDialog(AuthenticationChallengeProxy*);
+
+protected:
+ virtual void authenticate(const WebCore::Credential&);
+
+private:
+ RefPtr<AuthenticationChallengeProxy> m_authenticationChallenge;
+};
+
+} // namespace WebKit
Property changes on: trunk/Source/WebKit2/UIProcess/API/gtk/WebKit2GtkAuthenticationDialog.h
___________________________________________________________________
Added: svn:eol-style
Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.cpp (134973 => 134974)
--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.cpp 2012-11-16 19:02:04 UTC (rev 134973)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.cpp 2012-11-16 19:06:44 UTC (rev 134974)
@@ -21,6 +21,7 @@
#include "config.h"
#include "WebKitLoaderClient.h"
+#include "WebKit2GtkAuthenticationDialog.h"
#include "WebKitBackForwardListPrivate.h"
#include "WebKitURIResponsePrivate.h"
#include "WebKitWebViewBasePrivate.h"
@@ -115,6 +116,12 @@
webkitBackForwardListChanged(webkit_web_view_get_back_forward_list(WEBKIT_WEB_VIEW(clientInfo)), toImpl(addedItem), toImpl(removedItems));
}
+static void didReceiveAuthenticationChallengeInFrame(WKPageRef page, WKFrameRef frame, WKAuthenticationChallengeRef authenticationChallenge, const void *clientInfo)
+{
+ WebKit2GtkAuthenticationDialog* dialog = new WebKit2GtkAuthenticationDialog(toImpl(authenticationChallenge));
+ dialog->show();
+}
+
void attachLoaderClientToView(WebKitWebView* webView)
{
WKPageLoaderClient wkLoaderClient = {
@@ -135,7 +142,7 @@
0, // didDisplayInsecureContentForFrame
0, // didRunInsecureContentForFrame
0, // canAuthenticateAgainstProtectionSpaceInFrame
- 0, // didReceiveAuthenticationChallengeInFrame
+ didReceiveAuthenticationChallengeInFrame,
didChangeProgress, // didStartProgress
didChangeProgress,
didChangeProgress, // didFinishProgress
Modified: trunk/Source/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.h (134973 => 134974)
--- trunk/Source/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.h 2012-11-16 19:02:04 UTC (rev 134973)
+++ trunk/Source/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.h 2012-11-16 19:06:44 UTC (rev 134974)
@@ -61,6 +61,7 @@
WebCredential* proposedCredential() const;
WebProtectionSpace* protectionSpace() const;
int previousFailureCount() const { return m_coreAuthenticationChallenge.previousFailureCount(); }
+ const WebCore::AuthenticationChallenge& core() { return m_coreAuthenticationChallenge; }
private:
AuthenticationChallengeProxy(const WebCore::AuthenticationChallenge&, uint64_t challengeID, WebProcessProxy*);
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (134973 => 134974)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp 2012-11-16 19:02:04 UTC (rev 134973)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp 2012-11-16 19:06:44 UTC (rev 134974)
@@ -202,7 +202,6 @@
return webPage->injectedBundleResourceLoadClient().shouldUseCredentialStorage(webPage, m_frame, identifier);
}
-#if !PLATFORM(GTK)
void WebFrameLoaderClient::dispatchDidReceiveAuthenticationChallenge(DocumentLoader*, unsigned long, const AuthenticationChallenge& challenge)
{
// FIXME: Authentication is a per-resource concept, but we don't do per-resource handling in the UIProcess at the API level quite yet.
@@ -214,7 +213,6 @@
AuthenticationManager::shared().didReceiveAuthenticationChallenge(m_frame, challenge);
}
-#endif
void WebFrameLoaderClient::dispatchDidCancelAuthenticationChallenge(DocumentLoader*, unsigned long /*identifier*/, const AuthenticationChallenge&)
{
Deleted: trunk/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebFrameLoaderClientGtk.cpp (134973 => 134974)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebFrameLoaderClientGtk.cpp 2012-11-16 19:02:04 UTC (rev 134973)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebFrameLoaderClientGtk.cpp 2012-11-16 19:06:44 UTC (rev 134974)
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2012, Igalia S.L.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY IGALIA S.L. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-#include "config.h"
-#include "WebFrameLoaderClient.h"
-
-#include <WebCore/AuthenticationChallenge.h>
-#include <WebCore/GtkAuthenticationDialog.h>
-#include <WebCore/ResourceHandle.h>
-
-namespace WebKit {
-
-using WebCore::GtkAuthenticationDialog;
-using WebCore::AuthenticationChallenge;
-
-void WebFrameLoaderClient::dispatchDidReceiveAuthenticationChallenge(WebCore::DocumentLoader*, unsigned long, const AuthenticationChallenge& challenge)
-{
- GtkAuthenticationDialog* dialog = new GtkAuthenticationDialog(0, challenge);
- dialog->show();
-}
-
-} // namespace WebKit