<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[173510] trunk/Source</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/173510">173510</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2014-09-11 01:59:45 -0700 (Thu, 11 Sep 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>[GTK] Merge WebKitAuthenticationWidget into WebKitAuthenticationDialog
https://bugs.webkit.org/show_bug.cgi?id=136700

Reviewed by Sergio Villar Senin.

Source/WebCore:

Remove WebKitAuthenticationWidget. The only reason why we had this
widget separated in WebCore was to share it between WebKit1 and
WebKit2, but now it's only used by WebKitAuthenticationDialog in WebKit2.

* PlatformGTK.cmake: Remove files from compilation.
* platform/gtk/WebKitAuthenticationWidget.cpp: Removed.
* platform/gtk/WebKitAuthenticationWidget.h: Removed.

Source/WebCore/platform/gtk/po:

* POTFILES.in: Remove WebKitAuthenticationWidget.cpp and add WebKitAuthenticationDialog.cpp.

Source/WebKit2:

Copy WebKitAuthenticationWidget implementation inside
WebKitAuthenticationDialog using a normal GtkBox instead.

* UIProcess/API/gtk/WebKitAuthenticationDialog.cpp:
(okButtonClicked):
(cancelButtonClicked):
(packTwoColumnLayoutInBox):
(createLabel):
(createEntry):
(webkitAuthenticationDialogInitialize): Remove the
CredentialStorageMode parameter since it's now a member.
(webkitAuthenticationDialogNew): Initialize the
CredentialStorageMode member too.
* UIProcess/API/gtk/WebKitAuthenticationDialog.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorePlatformGTKcmake">trunk/Source/WebCore/PlatformGTK.cmake</a></li>
<li><a href="#trunkSourceWebCoreplatformgtkpoChangeLog">trunk/Source/WebCore/platform/gtk/po/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformgtkpoPOTFILESin">trunk/Source/WebCore/platform/gtk/po/POTFILES.in</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitAuthenticationDialogcpp">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitAuthenticationDialog.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitAuthenticationDialogh">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitAuthenticationDialog.h</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreplatformgtkWebKitAuthenticationWidgetcpp">trunk/Source/WebCore/platform/gtk/WebKitAuthenticationWidget.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgtkWebKitAuthenticationWidgeth">trunk/Source/WebCore/platform/gtk/WebKitAuthenticationWidget.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (173509 => 173510)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-09-11 08:52:22 UTC (rev 173509)
+++ trunk/Source/WebCore/ChangeLog        2014-09-11 08:59:45 UTC (rev 173510)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2014-09-11  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
+
+        [GTK] Merge WebKitAuthenticationWidget into WebKitAuthenticationDialog
+        https://bugs.webkit.org/show_bug.cgi?id=136700
+
+        Reviewed by Sergio Villar Senin.
+
+        Remove WebKitAuthenticationWidget. The only reason why we had this
+        widget separated in WebCore was to share it between WebKit1 and
+        WebKit2, but now it's only used by WebKitAuthenticationDialog in WebKit2.
+
+        * PlatformGTK.cmake: Remove files from compilation.
+        * platform/gtk/WebKitAuthenticationWidget.cpp: Removed.
+        * platform/gtk/WebKitAuthenticationWidget.h: Removed.
+
</ins><span class="cx"> 2014-09-10  Gyuyoung Kim  &lt;gyuyoung.kim@samsung.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Use ASSERT instead of ASSERT_WITH_SECURITY_IMPLICATION
</span></span></pre></div>
<a id="trunkSourceWebCorePlatformGTKcmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/PlatformGTK.cmake (173509 => 173510)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/PlatformGTK.cmake        2014-09-11 08:52:22 UTC (rev 173509)
+++ trunk/Source/WebCore/PlatformGTK.cmake        2014-09-11 08:59:45 UTC (rev 173510)
</span><span class="lines">@@ -244,7 +244,6 @@
</span><span class="cx">     platform/gtk/SoundGtk.cpp
</span><span class="cx">     platform/gtk/TemporaryLinkStubs.cpp
</span><span class="cx">     platform/gtk/UserAgentGtk.cpp
</span><del>-    platform/gtk/WebKitAuthenticationWidget.cpp
</del><span class="cx">     platform/gtk/WidgetBackingStoreGtkX11.cpp
</span><span class="cx">     platform/gtk/WidgetGtk.cpp
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgtkWebKitAuthenticationWidgetcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/platform/gtk/WebKitAuthenticationWidget.cpp (173509 => 173510)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/gtk/WebKitAuthenticationWidget.cpp        2014-09-11 08:52:22 UTC (rev 173509)
+++ trunk/Source/WebCore/platform/gtk/WebKitAuthenticationWidget.cpp        2014-09-11 08:59:45 UTC (rev 173510)
</span><span class="lines">@@ -1,241 +0,0 @@
</span><del>-/*
- * 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 &quot;config.h&quot;
-#include &quot;WebKitAuthenticationWidget.h&quot;
-
-#include &quot;CredentialBackingStore.h&quot;
-#include &quot;GtkVersioning.h&quot;
-#include &lt;glib/gi18n-lib.h&gt;
-#include &lt;wtf/gobject/GUniquePtr.h&gt;
-#include &lt;wtf/text/CString.h&gt;
-
-using namespace WebCore;
-
-struct _WebKitAuthenticationWidgetPrivate {
-    AuthenticationChallenge challenge;
-    CredentialStorageMode credentialStorageMode;
-
-    GtkWidget* loginEntry;
-    GtkWidget* passwordEntry;
-    GtkWidget* rememberCheckButton;
-};
-
-G_DEFINE_TYPE(WebKitAuthenticationWidget, webkit_authentication_widget, GTK_TYPE_BOX)
-
-static const int gLayoutColumnSpacing = 12;
-static const int gLayoutRowSpacing = 6;
-static const int gButtonSpacing = 5;
-
-#ifdef GTK_API_VERSION_2
-static void packTwoColumnLayoutInBox(GtkWidget* box, ...)
-{
-    va_list argumentList;
-    va_start(argumentList, box);
-
-    GtkWidget* table = gtk_table_new(1, 2, FALSE);
-    gtk_table_set_col_spacings(GTK_TABLE(table), gLayoutColumnSpacing);
-    gtk_table_set_row_spacings(GTK_TABLE(table), gLayoutRowSpacing);
-
-    GtkWidget* firstColumnWidget = va_arg(argumentList, GtkWidget*);
-    int rowNumber = 0;
-    while (firstColumnWidget) {
-        if (rowNumber)
-            gtk_table_resize(GTK_TABLE(table), rowNumber + 1, 2);
-
-        GtkWidget* secondColumnWidget = va_arg(argumentList, GtkWidget*);
-        GtkAttachOptions attachOptions = static_cast&lt;GtkAttachOptions&gt;(GTK_EXPAND | GTK_FILL);
-        gtk_table_attach(
-            GTK_TABLE(table), firstColumnWidget,
-            0, secondColumnWidget ? 1 : 2,
-            rowNumber, rowNumber + 1,
-            attachOptions, attachOptions,
-            0, 0);
-        gtk_widget_show(firstColumnWidget);
-
-        if (secondColumnWidget) {
-            gtk_table_attach_defaults(GTK_TABLE(table), secondColumnWidget, 1, 2, rowNumber, rowNumber + 1);
-            gtk_widget_show(secondColumnWidget);
-        }
-
-        firstColumnWidget = va_arg(argumentList, GtkWidget*);
-        rowNumber++;
-    }
-
-    va_end(argumentList);
-
-    gtk_box_pack_start(GTK_BOX(box), table, FALSE, FALSE, 0);
-    gtk_widget_show(table);
-}
-#else
-static void packTwoColumnLayoutInBox(GtkWidget* box, ...)
-{
-    va_list argumentList;
-    va_start(argumentList, box);
-
-    GtkWidget* grid = gtk_grid_new();
-    gtk_grid_set_column_spacing(GTK_GRID(grid), gLayoutRowSpacing);
-    gtk_grid_set_row_spacing(GTK_GRID(grid), gLayoutRowSpacing);
-    gtk_grid_set_column_homogeneous(GTK_GRID(grid), TRUE);
-
-    GtkWidget* firstColumnWidget = va_arg(argumentList, GtkWidget*);
-    int rowNumber = 0;
-    while (firstColumnWidget) {
-        GtkWidget* secondColumnWidget = va_arg(argumentList, GtkWidget*);
-        int firstWidgetWidth = secondColumnWidget ? 1 : 2;
-
-        gtk_grid_attach(GTK_GRID(grid), firstColumnWidget, 0, rowNumber, firstWidgetWidth, 1);
-        gtk_widget_set_hexpand(firstColumnWidget, TRUE);
-        gtk_widget_set_vexpand(firstColumnWidget, TRUE);
-        gtk_widget_show(firstColumnWidget);
-
-        if (secondColumnWidget) {
-            gtk_grid_attach(GTK_GRID(grid), secondColumnWidget, 1, rowNumber, 1, 1);
-            gtk_widget_set_hexpand(secondColumnWidget, TRUE);
-            gtk_widget_set_vexpand(secondColumnWidget, TRUE);
-            gtk_widget_show(secondColumnWidget);
-        }
-
-        firstColumnWidget = va_arg(argumentList, GtkWidget*);
-        rowNumber++;
-    }
-
-    va_end(argumentList);
-
-    gtk_box_pack_start(GTK_BOX(box), grid, FALSE, FALSE, 0);
-    gtk_widget_show(grid);
-}
-#endif
-
-static GtkWidget* createLabel(const char* labelString, int horizontalPadding = 0)
-{
-    GtkWidget* label = gtk_label_new(labelString);
-    gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
-    if (horizontalPadding)
-        gtk_misc_set_padding(GTK_MISC(label), 0, horizontalPadding);
-    return label;
-}
-
-static GtkWidget* createEntry(GtkWidget** member)
-{
-    *member = gtk_entry_new();
-    gtk_entry_set_activates_default(GTK_ENTRY(*member), TRUE);
-    return *member;
-}
-
-static void webkitAuthenticationWidgetInitialize(WebKitAuthenticationWidget* authWidget)
-{
-    gtk_orientable_set_orientation(GTK_ORIENTABLE(authWidget), GTK_ORIENTATION_HORIZONTAL);
-    gtk_box_set_spacing(GTK_BOX(authWidget), gLayoutColumnSpacing);
-    gtk_container_set_border_width(GTK_CONTAINER(authWidget), gButtonSpacing);
-
-    GtkWidget* icon = gtk_image_new_from_stock(GTK_STOCK_DIALOG_AUTHENTICATION, GTK_ICON_SIZE_DIALOG);
-    gtk_misc_set_alignment(GTK_MISC(icon), 0.5, 0.0);
-    gtk_box_pack_start(GTK_BOX(authWidget), icon, FALSE, FALSE, 0);
-    gtk_widget_show(icon);
-
-    WebKitAuthenticationWidgetPrivate* priv = authWidget-&gt;priv;
-    GUniquePtr&lt;char&gt; prompt(g_strdup_printf(
-        _(&quot;The site %s:%i requests a username and password&quot;),
-        priv-&gt;challenge.protectionSpace().host().utf8().data(),
-        priv-&gt;challenge.protectionSpace().port()));
-
-    priv-&gt;rememberCheckButton = gtk_check_button_new_with_mnemonic(_(&quot;_Remember password&quot;));
-    gtk_label_set_line_wrap(GTK_LABEL(gtk_bin_get_child(GTK_BIN(priv-&gt;rememberCheckButton))), TRUE);
-
-    String realm = authWidget-&gt;priv-&gt;challenge.protectionSpace().realm();
-    if (!realm.isEmpty()) {
-        packTwoColumnLayoutInBox(
-            GTK_WIDGET(authWidget),
-            createLabel(prompt.get(), gLayoutRowSpacing), NULL,
-            createLabel(_(&quot;Server message:&quot;)), createLabel(realm.utf8().data()),
-            createLabel(_(&quot;Username:&quot;)), createEntry(&amp;priv-&gt;loginEntry),
-            createLabel(_(&quot;Password:&quot;)), createEntry(&amp;priv-&gt;passwordEntry),
-            priv-&gt;rememberCheckButton, NULL,
-            NULL);
-
-    } else {
-        packTwoColumnLayoutInBox(
-            GTK_WIDGET(authWidget),
-            createLabel(prompt.get(), gLayoutRowSpacing), NULL,
-            createLabel(_(&quot;Username:&quot;)), createEntry(&amp;priv-&gt;loginEntry),
-            createLabel(_(&quot;Password:&quot;)), createEntry(&amp;priv-&gt;passwordEntry),
-            priv-&gt;rememberCheckButton, NULL, NULL,
-            NULL);
-    }
-    gtk_entry_set_visibility(GTK_ENTRY(priv-&gt;passwordEntry), FALSE);
-    gtk_widget_set_visible(priv-&gt;rememberCheckButton, priv-&gt;credentialStorageMode != DisallowPersistentStorage);
-
-    const Credential&amp; credentialFromPersistentStorage = priv-&gt;challenge.proposedCredential();
-    if (!credentialFromPersistentStorage.isEmpty()) {
-        gtk_entry_set_text(GTK_ENTRY(priv-&gt;loginEntry), credentialFromPersistentStorage.user().utf8().data());
-        gtk_entry_set_text(GTK_ENTRY(priv-&gt;passwordEntry), credentialFromPersistentStorage.password().utf8().data());
-        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv-&gt;rememberCheckButton), TRUE);
-    }
-
-    gtk_widget_grab_focus(priv-&gt;loginEntry);
-}
-
-static void webkitAuthenticationWidgetFinalize(GObject* object)
-{
-    WEBKIT_AUTHENTICATION_WIDGET(object)-&gt;priv-&gt;~WebKitAuthenticationWidgetPrivate();
-    G_OBJECT_CLASS(webkit_authentication_widget_parent_class)-&gt;finalize(object);
-}
-
-static void webkit_authentication_widget_init(WebKitAuthenticationWidget* authWidget)
-{
-    WebKitAuthenticationWidgetPrivate* priv = G_TYPE_INSTANCE_GET_PRIVATE(authWidget, WEBKIT_TYPE_AUTHENTICATION_WIDGET, WebKitAuthenticationWidgetPrivate);
-    new (priv) WebKitAuthenticationWidgetPrivate();
-    authWidget-&gt;priv = priv;
-}
-
-static void webkit_authentication_widget_class_init(WebKitAuthenticationWidgetClass* klass)
-{
-    GObjectClass* objectClass = G_OBJECT_CLASS(klass);
-    objectClass-&gt;finalize = webkitAuthenticationWidgetFinalize;
-    g_type_class_add_private(objectClass, sizeof(WebKitAuthenticationWidgetPrivate));
-}
-
-GtkWidget* webkitAuthenticationWidgetNew(const AuthenticationChallenge&amp; challenge, CredentialStorageMode mode)
-{
-    WebKitAuthenticationWidget* authWidget = WEBKIT_AUTHENTICATION_WIDGET(g_object_new(WEBKIT_TYPE_AUTHENTICATION_WIDGET, NULL));
-    authWidget-&gt;priv-&gt;challenge = challenge;
-    authWidget-&gt;priv-&gt;credentialStorageMode = mode;
-    webkitAuthenticationWidgetInitialize(authWidget);
-    return GTK_WIDGET(authWidget);
-}
-
-Credential webkitAuthenticationWidgetCreateCredential(WebKitAuthenticationWidget* authWidget)
-{
-    const char* username = gtk_entry_get_text(GTK_ENTRY(authWidget-&gt;priv-&gt;loginEntry));
-    const char* password = gtk_entry_get_text(GTK_ENTRY(authWidget-&gt;priv-&gt;passwordEntry));
-    bool rememberPassword = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(authWidget-&gt;priv-&gt;rememberCheckButton));
-
-    CredentialPersistence persistence;
-    if (rememberPassword &amp;&amp; authWidget-&gt;priv-&gt;credentialStorageMode == AllowPersistentStorage)
-        persistence = CredentialPersistencePermanent;
-    else
-        persistence = CredentialPersistenceForSession;
-    return Credential(String::fromUTF8(username), String::fromUTF8(password), persistence);
-}
-
-AuthenticationChallenge&amp; webkitAuthenticationWidgetGetChallenge(WebKitAuthenticationWidget* authWidget)
-{
-    return authWidget-&gt;priv-&gt;challenge;
-}
</del></span></pre></div>
<a id="trunkSourceWebCoreplatformgtkWebKitAuthenticationWidgeth"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/platform/gtk/WebKitAuthenticationWidget.h (173509 => 173510)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/gtk/WebKitAuthenticationWidget.h        2014-09-11 08:52:22 UTC (rev 173509)
+++ trunk/Source/WebCore/platform/gtk/WebKitAuthenticationWidget.h        2014-09-11 08:59:45 UTC (rev 173510)
</span><span class="lines">@@ -1,61 +0,0 @@
</span><del>-/*
- * 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.
- */
-
-#ifndef WebKitAuthenticationWidget_h
-#define WebKitAuthenticationWidget_h
-
-#include &quot;AuthenticationChallenge.h&quot;
-#include &lt;gtk/gtk.h&gt;
-
-enum CredentialStorageMode {
-    AllowPersistentStorage, // The user is asked whether to store credential information.
-    DisallowPersistentStorage // Credential information is only kept in the session.
-};
-
-G_BEGIN_DECLS
-
-#define WEBKIT_TYPE_AUTHENTICATION_WIDGET            (webkit_authentication_widget_get_type())
-#define WEBKIT_AUTHENTICATION_WIDGET(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_AUTHENTICATION_WIDGET, WebKitAuthenticationWidget))
-#define WEBKIT_IS_AUTHENTICATION_WIDGET(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_AUTHENTICATION_WIDGET))
-#define WEBKIT_AUTHENTICATION_WIDGET_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass),  WEBKIT_TYPE_AUTHENTICATION_WIDGET, WebKitAuthenticationWidgetClass))
-#define WEBKIT_IS_AUTHENTICATION_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),  WEBKIT_TYPE_AUTHENTICATION_WIDGET))
-#define WEBKIT_AUTHENTICATION_WIDGET_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj),  WEBKIT_TYPE_AUTHENTICATION_WIDGET, WebKitAuthenticationWidgetClass))
-
-typedef struct _WebKitAuthenticationWidget        WebKitAuthenticationWidget;
-typedef struct _WebKitAuthenticationWidgetClass   WebKitAuthenticationWidgetClass;
-typedef struct _WebKitAuthenticationWidgetPrivate WebKitAuthenticationWidgetPrivate;
-
-struct _WebKitAuthenticationWidget {
-    GtkBox parent;
-
-    WebKitAuthenticationWidgetPrivate* priv;
-};
-
-struct _WebKitAuthenticationWidgetClass {
-    GtkBoxClass parentClass;
-};
-
-GType webkit_authentication_widget_get_type();
-GtkWidget* webkitAuthenticationWidgetNew(const WebCore::AuthenticationChallenge&amp;, CredentialStorageMode);
-WebCore::Credential webkitAuthenticationWidgetCreateCredential(WebKitAuthenticationWidget*);
-WebCore::AuthenticationChallenge&amp; webkitAuthenticationWidgetGetChallenge(WebKitAuthenticationWidget*);
-
-G_END_DECLS
-
-#endif // WebKitAuthenticationWidget_h
</del></span></pre></div>
<a id="trunkSourceWebCoreplatformgtkpoChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/gtk/po/ChangeLog (173509 => 173510)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/gtk/po/ChangeLog        2014-09-11 08:52:22 UTC (rev 173509)
+++ trunk/Source/WebCore/platform/gtk/po/ChangeLog        2014-09-11 08:59:45 UTC (rev 173510)
</span><span class="lines">@@ -1,3 +1,12 @@
</span><ins>+2014-09-11  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
+
+        [GTK] Merge WebKitAuthenticationWidget into WebKitAuthenticationDialog
+        https://bugs.webkit.org/show_bug.cgi?id=136700
+
+        Reviewed by Sergio Villar Senin.
+
+        * POTFILES.in: Remove WebKitAuthenticationWidget.cpp and add WebKitAuthenticationDialog.cpp.
+
</ins><span class="cx"> 2014-09-02  Christian Stadelmann  &lt;gnome-de@genodeftest.de&gt;
</span><span class="cx"> 
</span><span class="cx">         [GTK] Updated German translation
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgtkpoPOTFILESin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/gtk/po/POTFILES.in (173509 => 173510)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/gtk/po/POTFILES.in        2014-09-11 08:52:22 UTC (rev 173509)
+++ trunk/Source/WebCore/platform/gtk/po/POTFILES.in        2014-09-11 08:59:45 UTC (rev 173510)
</span><span class="lines">@@ -1,8 +1,8 @@
</span><span class="cx"> # List of source files which contain translatable strings.
</span><span class="cx"> ErrorsGtk.cpp
</span><span class="cx"> LocalizedStringsGtk.cpp
</span><del>-WebKitAuthenticationWidget.cpp
</del><span class="cx"> ../../../WebKit2/Shared/Downloads/soup/DownloadSoup.cpp
</span><ins>+../../../WebKit2/UIProcess/API/gtk/WebKitAuthenticationDialog.cpp
</ins><span class="cx"> ../../../WebKit2/UIProcess/API/gtk/WebKitDownload.cpp
</span><span class="cx"> ../../../WebKit2/UIProcess/API/gtk/WebKitFaviconDatabase.cpp
</span><span class="cx"> ../../../WebKit2/UIProcess/API/gtk/WebKitFileChooserRequest.cpp
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (173509 => 173510)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-09-11 08:52:22 UTC (rev 173509)
+++ trunk/Source/WebKit2/ChangeLog        2014-09-11 08:59:45 UTC (rev 173510)
</span><span class="lines">@@ -1,3 +1,25 @@
</span><ins>+2014-09-11  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
+
+        [GTK] Merge WebKitAuthenticationWidget into WebKitAuthenticationDialog
+        https://bugs.webkit.org/show_bug.cgi?id=136700
+
+        Reviewed by Sergio Villar Senin.
+
+        Copy WebKitAuthenticationWidget implementation inside
+        WebKitAuthenticationDialog using a normal GtkBox instead.
+
+        * UIProcess/API/gtk/WebKitAuthenticationDialog.cpp:
+        (okButtonClicked):
+        (cancelButtonClicked):
+        (packTwoColumnLayoutInBox):
+        (createLabel):
+        (createEntry):
+        (webkitAuthenticationDialogInitialize): Remove the
+        CredentialStorageMode parameter since it's now a member.
+        (webkitAuthenticationDialogNew): Initialize the
+        CredentialStorageMode member too.
+        * UIProcess/API/gtk/WebKitAuthenticationDialog.h:
+
</ins><span class="cx"> 2014-09-10  Antti Koivisto  &lt;antti@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         NetworkResourceLoader cleanups
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitAuthenticationDialogcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitAuthenticationDialog.cpp (173509 => 173510)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitAuthenticationDialog.cpp        2014-09-11 08:52:22 UTC (rev 173509)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitAuthenticationDialog.cpp        2014-09-11 08:59:45 UTC (rev 173510)
</span><span class="lines">@@ -25,12 +25,17 @@
</span><span class="cx"> #include &quot;WebKitCredentialPrivate.h&quot;
</span><span class="cx"> #include &quot;WebKitPrivate.h&quot;
</span><span class="cx"> #include &quot;WebKitWebView.h&quot;
</span><ins>+#include &lt;glib/gi18n-lib.h&gt;
+#include &lt;wtf/text/CString.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> using namespace WebKit;
</span><span class="cx"> 
</span><span class="cx"> struct _WebKitAuthenticationDialogPrivate {
</span><span class="cx">     GRefPtr&lt;WebKitAuthenticationRequest&gt; request;
</span><del>-    GtkWidget* authWidget;
</del><ins>+    CredentialStorageMode credentialStorageMode;
+    GtkWidget* loginEntry;
+    GtkWidget* passwordEntry;
+    GtkWidget* rememberCheckButton;
</ins><span class="cx">     GtkWidget* defaultButton;
</span><span class="cx">     unsigned long authenticationCancelledID;
</span><span class="cx">     GRefPtr&lt;GtkStyleContext&gt; styleContext;
</span><span class="lines">@@ -41,7 +46,15 @@
</span><span class="cx"> static void okButtonClicked(GtkButton*, WebKitAuthenticationDialog* authDialog)
</span><span class="cx"> {
</span><span class="cx">     WebKitAuthenticationDialogPrivate* priv = authDialog-&gt;priv;
</span><del>-    WebKitCredential* credential = webkitCredentialCreate(webkitAuthenticationWidgetCreateCredential(WEBKIT_AUTHENTICATION_WIDGET(priv-&gt;authWidget)));
</del><ins>+    const char* username = gtk_entry_get_text(GTK_ENTRY(priv-&gt;loginEntry));
+    const char* password = gtk_entry_get_text(GTK_ENTRY(priv-&gt;passwordEntry));
+    bool rememberPassword = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv-&gt;rememberCheckButton));
+
+    WebCore::CredentialPersistence persistence = rememberPassword &amp;&amp; priv-&gt;credentialStorageMode == AllowPersistentStorage ?
+        WebCore::CredentialPersistencePermanent : WebCore::CredentialPersistenceForSession;
+
+    // FIXME: Use a stack allocated WebKitCredential.
+    WebKitCredential* credential = webkitCredentialCreate(WebCore::Credential(String::fromUTF8(username), String::fromUTF8(password), persistence));
</ins><span class="cx">     webkit_authentication_request_authenticate(priv-&gt;request.get(), credential);
</span><span class="cx">     webkit_credential_free(credential);
</span><span class="cx">     gtk_widget_destroy(GTK_WIDGET(authDialog));
</span><span class="lines">@@ -49,7 +62,7 @@
</span><span class="cx"> 
</span><span class="cx"> static void cancelButtonClicked(GtkButton*, WebKitAuthenticationDialog* authDialog)
</span><span class="cx"> {
</span><del>-    webkit_authentication_request_authenticate(authDialog-&gt;priv-&gt;request.get(), 0);
</del><ins>+    webkit_authentication_request_authenticate(authDialog-&gt;priv-&gt;request.get(), nullptr);
</ins><span class="cx">     gtk_widget_destroy(GTK_WIDGET(authDialog));
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -58,8 +71,62 @@
</span><span class="cx">     gtk_widget_destroy(GTK_WIDGET(authDialog));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static void webkitAuthenticationDialogInitialize(WebKitAuthenticationDialog* authDialog, CredentialStorageMode credentialStorageMode)
</del><ins>+static void packTwoColumnLayoutInBox(GtkWidget* box, ...)
</ins><span class="cx"> {
</span><ins>+    va_list argumentList;
+    va_start(argumentList, box);
+
+    GtkWidget* grid = gtk_grid_new();
+    gtk_grid_set_column_spacing(GTK_GRID(grid), 6);
+    gtk_grid_set_row_spacing(GTK_GRID(grid), 6);
+    gtk_grid_set_column_homogeneous(GTK_GRID(grid), TRUE);
+
+    GtkWidget* firstColumnWidget = va_arg(argumentList, GtkWidget*);
+    int rowNumber = 0;
+    while (firstColumnWidget) {
+        GtkWidget* secondColumnWidget = va_arg(argumentList, GtkWidget*);
+        int firstWidgetWidth = secondColumnWidget ? 1 : 2;
+
+        gtk_grid_attach(GTK_GRID(grid), firstColumnWidget, 0, rowNumber, firstWidgetWidth, 1);
+        gtk_widget_set_hexpand(firstColumnWidget, TRUE);
+        gtk_widget_set_vexpand(firstColumnWidget, TRUE);
+        gtk_widget_show(firstColumnWidget);
+
+        if (secondColumnWidget) {
+            gtk_grid_attach(GTK_GRID(grid), secondColumnWidget, 1, rowNumber, 1, 1);
+            gtk_widget_set_hexpand(secondColumnWidget, TRUE);
+            gtk_widget_set_vexpand(secondColumnWidget, TRUE);
+            gtk_widget_show(secondColumnWidget);
+        }
+
+        firstColumnWidget = va_arg(argumentList, GtkWidget*);
+        rowNumber++;
+    }
+
+    va_end(argumentList);
+
+    gtk_box_pack_start(GTK_BOX(box), grid, FALSE, FALSE, 0);
+    gtk_widget_show(grid);
+}
+
+static GtkWidget* createLabel(const char* labelString, int horizontalPadding = 0)
+{
+    GtkWidget* label = gtk_label_new(labelString);
+    gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
+    if (horizontalPadding)
+        gtk_misc_set_padding(GTK_MISC(label), 0, horizontalPadding);
+    return label;
+}
+
+static GtkWidget* createEntry(GtkWidget** member)
+{
+    *member = gtk_entry_new();
+    gtk_entry_set_activates_default(GTK_ENTRY(*member), TRUE);
+    return *member;
+}
+
+static void webkitAuthenticationDialogInitialize(WebKitAuthenticationDialog* authDialog)
+{
</ins><span class="cx">     GtkWidget* frame = gtk_frame_new(0);
</span><span class="cx">     gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN);
</span><span class="cx"> 
</span><span class="lines">@@ -76,17 +143,63 @@
</span><span class="cx">     gtk_box_pack_end(GTK_BOX(buttonBox), button, FALSE, TRUE, 0);
</span><span class="cx">     gtk_widget_show(button);
</span><span class="cx"> 
</span><ins>+    WebKitAuthenticationDialogPrivate* priv = authDialog-&gt;priv;
</ins><span class="cx">     button = gtk_button_new_from_stock(GTK_STOCK_OK);
</span><del>-    authDialog-&gt;priv-&gt;defaultButton = button;
</del><ins>+    priv-&gt;defaultButton = button;
</ins><span class="cx">     g_signal_connect(button, &quot;clicked&quot;, G_CALLBACK(okButtonClicked), authDialog);
</span><span class="cx">     gtk_widget_set_can_default(button, TRUE);
</span><span class="cx">     gtk_box_pack_end(GTK_BOX(buttonBox), button, FALSE, TRUE, 0);
</span><span class="cx">     gtk_widget_show(button);
</span><span class="cx"> 
</span><del>-    authDialog-&gt;priv-&gt;authWidget = webkitAuthenticationWidgetNew(webkitAuthenticationRequestGetAuthenticationChallenge(authDialog-&gt;priv-&gt;request.get())-&gt;core(), credentialStorageMode);
-    gtk_box_pack_start(GTK_BOX(vBox), authDialog-&gt;priv-&gt;authWidget, TRUE, TRUE, 0);
-    gtk_widget_show(authDialog-&gt;priv-&gt;authWidget);
</del><ins>+    GtkWidget* authBox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 12);
+    gtk_container_set_border_width(GTK_CONTAINER(authBox), 5);
</ins><span class="cx"> 
</span><ins>+    GtkWidget* icon = gtk_image_new_from_stock(GTK_STOCK_DIALOG_AUTHENTICATION, GTK_ICON_SIZE_DIALOG);
+    gtk_misc_set_alignment(GTK_MISC(icon), 0.5, 0.0);
+    gtk_box_pack_start(GTK_BOX(authBox), icon, FALSE, FALSE, 0);
+    gtk_widget_show(icon);
+
+    const WebCore::AuthenticationChallenge&amp; challenge = webkitAuthenticationRequestGetAuthenticationChallenge(priv-&gt;request.get())-&gt;core();
+    GUniquePtr&lt;char&gt; prompt(g_strdup_printf(_(&quot;The site %s:%i requests a username and password&quot;),
+        challenge.protectionSpace().host().utf8().data(), challenge.protectionSpace().port()));
+    priv-&gt;rememberCheckButton = gtk_check_button_new_with_mnemonic(_(&quot;_Remember password&quot;));
+    gtk_label_set_line_wrap(GTK_LABEL(gtk_bin_get_child(GTK_BIN(priv-&gt;rememberCheckButton))), TRUE);
+
+    String realm = challenge.protectionSpace().realm();
+    if (!realm.isEmpty()) {
+        packTwoColumnLayoutInBox(
+            authBox,
+            createLabel(prompt.get(), 6), nullptr,
+            createLabel(_(&quot;Server message:&quot;)), createLabel(realm.utf8().data()),
+            createLabel(_(&quot;Username:&quot;)), createEntry(&amp;priv-&gt;loginEntry),
+            createLabel(_(&quot;Password:&quot;)), createEntry(&amp;priv-&gt;passwordEntry),
+            priv-&gt;rememberCheckButton, nullptr,
+            nullptr);
+
+    } else {
+        packTwoColumnLayoutInBox(
+            authBox,
+            createLabel(prompt.get(), 6), nullptr,
+            createLabel(_(&quot;Username:&quot;)), createEntry(&amp;priv-&gt;loginEntry),
+            createLabel(_(&quot;Password:&quot;)), createEntry(&amp;priv-&gt;passwordEntry),
+            priv-&gt;rememberCheckButton, nullptr, nullptr,
+            nullptr);
+    }
+    gtk_entry_set_visibility(GTK_ENTRY(priv-&gt;passwordEntry), FALSE);
+    gtk_widget_set_visible(priv-&gt;rememberCheckButton, priv-&gt;credentialStorageMode != DisallowPersistentStorage);
+
+    const WebCore::Credential&amp; credentialFromPersistentStorage = challenge.proposedCredential();
+    if (!credentialFromPersistentStorage.isEmpty()) {
+        gtk_entry_set_text(GTK_ENTRY(priv-&gt;loginEntry), credentialFromPersistentStorage.user().utf8().data());
+        gtk_entry_set_text(GTK_ENTRY(priv-&gt;passwordEntry), credentialFromPersistentStorage.password().utf8().data());
+        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv-&gt;rememberCheckButton), TRUE);
+    }
+
+    gtk_widget_grab_focus(priv-&gt;loginEntry);
+
+    gtk_box_pack_start(GTK_BOX(vBox), authBox, TRUE, TRUE, 0);
+    gtk_widget_show(authBox);
+
</ins><span class="cx">     gtk_box_pack_end(GTK_BOX(vBox), buttonBox, FALSE, TRUE, 0);
</span><span class="cx">     gtk_widget_show(buttonBox);
</span><span class="cx"> 
</span><span class="lines">@@ -159,6 +272,7 @@
</span><span class="cx"> {
</span><span class="cx">     WebKitAuthenticationDialog* authDialog = WEBKIT_AUTHENTICATION_DIALOG(g_object_new(WEBKIT_TYPE_AUTHENTICATION_DIALOG, NULL));
</span><span class="cx">     authDialog-&gt;priv-&gt;request = request;
</span><del>-    webkitAuthenticationDialogInitialize(authDialog, mode);
</del><ins>+    authDialog-&gt;priv-&gt;credentialStorageMode = mode;
+    webkitAuthenticationDialogInitialize(authDialog);
</ins><span class="cx">     return GTK_WIDGET(authDialog);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitAuthenticationDialogh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitAuthenticationDialog.h (173509 => 173510)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitAuthenticationDialog.h        2014-09-11 08:52:22 UTC (rev 173509)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitAuthenticationDialog.h        2014-09-11 08:59:45 UTC (rev 173510)
</span><span class="lines">@@ -21,10 +21,13 @@
</span><span class="cx"> #define WebKitAuthenticationDialog_h
</span><span class="cx"> 
</span><span class="cx"> #include &quot;WebKitAuthenticationRequest.h&quot;
</span><del>-#include &quot;WebKitAuthenticationWidget.h&quot;
-#include &quot;WebKitWebView.h&quot;
</del><span class="cx"> #include &lt;gtk/gtk.h&gt;
</span><span class="cx"> 
</span><ins>+enum CredentialStorageMode {
+    AllowPersistentStorage, // The user is asked whether to store credential information.
+    DisallowPersistentStorage // Credential information is only kept in the session.
+};
+
</ins><span class="cx"> G_BEGIN_DECLS
</span><span class="cx"> 
</span><span class="cx"> #define WEBKIT_TYPE_AUTHENTICATION_DIALOG            (webkit_authentication_dialog_get_type())
</span></span></pre>
</div>
</div>

</body>
</html>