Changeset 173510 in webkit
- Timestamp:
- Sep 11, 2014 1:59:45 AM (10 years ago)
- Location:
- trunk/Source
- Files:
-
- 2 deleted
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r173507 r173510 1 2014-09-11 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK] Merge WebKitAuthenticationWidget into WebKitAuthenticationDialog 4 https://bugs.webkit.org/show_bug.cgi?id=136700 5 6 Reviewed by Sergio Villar Senin. 7 8 Remove WebKitAuthenticationWidget. The only reason why we had this 9 widget separated in WebCore was to share it between WebKit1 and 10 WebKit2, but now it's only used by WebKitAuthenticationDialog in WebKit2. 11 12 * PlatformGTK.cmake: Remove files from compilation. 13 * platform/gtk/WebKitAuthenticationWidget.cpp: Removed. 14 * platform/gtk/WebKitAuthenticationWidget.h: Removed. 15 1 16 2014-09-10 Gyuyoung Kim <gyuyoung.kim@samsung.com> 2 17 -
trunk/Source/WebCore/PlatformGTK.cmake
r173401 r173510 245 245 platform/gtk/TemporaryLinkStubs.cpp 246 246 platform/gtk/UserAgentGtk.cpp 247 platform/gtk/WebKitAuthenticationWidget.cpp248 247 platform/gtk/WidgetBackingStoreGtkX11.cpp 249 248 platform/gtk/WidgetGtk.cpp -
trunk/Source/WebCore/platform/gtk/po/ChangeLog
r173193 r173510 1 2014-09-11 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK] Merge WebKitAuthenticationWidget into WebKitAuthenticationDialog 4 https://bugs.webkit.org/show_bug.cgi?id=136700 5 6 Reviewed by Sergio Villar Senin. 7 8 * POTFILES.in: Remove WebKitAuthenticationWidget.cpp and add WebKitAuthenticationDialog.cpp. 9 1 10 2014-09-02 Christian Stadelmann <gnome-de@genodeftest.de> 2 11 -
trunk/Source/WebCore/platform/gtk/po/POTFILES.in
r166979 r173510 2 2 ErrorsGtk.cpp 3 3 LocalizedStringsGtk.cpp 4 WebKitAuthenticationWidget.cpp5 4 ../../../WebKit2/Shared/Downloads/soup/DownloadSoup.cpp 5 ../../../WebKit2/UIProcess/API/gtk/WebKitAuthenticationDialog.cpp 6 6 ../../../WebKit2/UIProcess/API/gtk/WebKitDownload.cpp 7 7 ../../../WebKit2/UIProcess/API/gtk/WebKitFaviconDatabase.cpp -
trunk/Source/WebKit2/ChangeLog
r173468 r173510 1 2014-09-11 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK] Merge WebKitAuthenticationWidget into WebKitAuthenticationDialog 4 https://bugs.webkit.org/show_bug.cgi?id=136700 5 6 Reviewed by Sergio Villar Senin. 7 8 Copy WebKitAuthenticationWidget implementation inside 9 WebKitAuthenticationDialog using a normal GtkBox instead. 10 11 * UIProcess/API/gtk/WebKitAuthenticationDialog.cpp: 12 (okButtonClicked): 13 (cancelButtonClicked): 14 (packTwoColumnLayoutInBox): 15 (createLabel): 16 (createEntry): 17 (webkitAuthenticationDialogInitialize): Remove the 18 CredentialStorageMode parameter since it's now a member. 19 (webkitAuthenticationDialogNew): Initialize the 20 CredentialStorageMode member too. 21 * UIProcess/API/gtk/WebKitAuthenticationDialog.h: 22 1 23 2014-09-10 Antti Koivisto <antti@apple.com> 2 24 -
trunk/Source/WebKit2/UIProcess/API/gtk/WebKitAuthenticationDialog.cpp
r155347 r173510 26 26 #include "WebKitPrivate.h" 27 27 #include "WebKitWebView.h" 28 #include <glib/gi18n-lib.h> 29 #include <wtf/text/CString.h> 28 30 29 31 using namespace WebKit; … … 31 33 struct _WebKitAuthenticationDialogPrivate { 32 34 GRefPtr<WebKitAuthenticationRequest> request; 33 GtkWidget* authWidget; 35 CredentialStorageMode credentialStorageMode; 36 GtkWidget* loginEntry; 37 GtkWidget* passwordEntry; 38 GtkWidget* rememberCheckButton; 34 39 GtkWidget* defaultButton; 35 40 unsigned long authenticationCancelledID; … … 42 47 { 43 48 WebKitAuthenticationDialogPrivate* priv = authDialog->priv; 44 WebKitCredential* credential = webkitCredentialCreate(webkitAuthenticationWidgetCreateCredential(WEBKIT_AUTHENTICATION_WIDGET(priv->authWidget))); 49 const char* username = gtk_entry_get_text(GTK_ENTRY(priv->loginEntry)); 50 const char* password = gtk_entry_get_text(GTK_ENTRY(priv->passwordEntry)); 51 bool rememberPassword = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->rememberCheckButton)); 52 53 WebCore::CredentialPersistence persistence = rememberPassword && priv->credentialStorageMode == AllowPersistentStorage ? 54 WebCore::CredentialPersistencePermanent : WebCore::CredentialPersistenceForSession; 55 56 // FIXME: Use a stack allocated WebKitCredential. 57 WebKitCredential* credential = webkitCredentialCreate(WebCore::Credential(String::fromUTF8(username), String::fromUTF8(password), persistence)); 45 58 webkit_authentication_request_authenticate(priv->request.get(), credential); 46 59 webkit_credential_free(credential); … … 50 63 static void cancelButtonClicked(GtkButton*, WebKitAuthenticationDialog* authDialog) 51 64 { 52 webkit_authentication_request_authenticate(authDialog->priv->request.get(), 0);65 webkit_authentication_request_authenticate(authDialog->priv->request.get(), nullptr); 53 66 gtk_widget_destroy(GTK_WIDGET(authDialog)); 54 67 } … … 59 72 } 60 73 61 static void webkitAuthenticationDialogInitialize(WebKitAuthenticationDialog* authDialog, CredentialStorageMode credentialStorageMode) 74 static void packTwoColumnLayoutInBox(GtkWidget* box, ...) 75 { 76 va_list argumentList; 77 va_start(argumentList, box); 78 79 GtkWidget* grid = gtk_grid_new(); 80 gtk_grid_set_column_spacing(GTK_GRID(grid), 6); 81 gtk_grid_set_row_spacing(GTK_GRID(grid), 6); 82 gtk_grid_set_column_homogeneous(GTK_GRID(grid), TRUE); 83 84 GtkWidget* firstColumnWidget = va_arg(argumentList, GtkWidget*); 85 int rowNumber = 0; 86 while (firstColumnWidget) { 87 GtkWidget* secondColumnWidget = va_arg(argumentList, GtkWidget*); 88 int firstWidgetWidth = secondColumnWidget ? 1 : 2; 89 90 gtk_grid_attach(GTK_GRID(grid), firstColumnWidget, 0, rowNumber, firstWidgetWidth, 1); 91 gtk_widget_set_hexpand(firstColumnWidget, TRUE); 92 gtk_widget_set_vexpand(firstColumnWidget, TRUE); 93 gtk_widget_show(firstColumnWidget); 94 95 if (secondColumnWidget) { 96 gtk_grid_attach(GTK_GRID(grid), secondColumnWidget, 1, rowNumber, 1, 1); 97 gtk_widget_set_hexpand(secondColumnWidget, TRUE); 98 gtk_widget_set_vexpand(secondColumnWidget, TRUE); 99 gtk_widget_show(secondColumnWidget); 100 } 101 102 firstColumnWidget = va_arg(argumentList, GtkWidget*); 103 rowNumber++; 104 } 105 106 va_end(argumentList); 107 108 gtk_box_pack_start(GTK_BOX(box), grid, FALSE, FALSE, 0); 109 gtk_widget_show(grid); 110 } 111 112 static GtkWidget* createLabel(const char* labelString, int horizontalPadding = 0) 113 { 114 GtkWidget* label = gtk_label_new(labelString); 115 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); 116 if (horizontalPadding) 117 gtk_misc_set_padding(GTK_MISC(label), 0, horizontalPadding); 118 return label; 119 } 120 121 static GtkWidget* createEntry(GtkWidget** member) 122 { 123 *member = gtk_entry_new(); 124 gtk_entry_set_activates_default(GTK_ENTRY(*member), TRUE); 125 return *member; 126 } 127 128 static void webkitAuthenticationDialogInitialize(WebKitAuthenticationDialog* authDialog) 62 129 { 63 130 GtkWidget* frame = gtk_frame_new(0); … … 77 144 gtk_widget_show(button); 78 145 146 WebKitAuthenticationDialogPrivate* priv = authDialog->priv; 79 147 button = gtk_button_new_from_stock(GTK_STOCK_OK); 80 authDialog->priv->defaultButton = button;148 priv->defaultButton = button; 81 149 g_signal_connect(button, "clicked", G_CALLBACK(okButtonClicked), authDialog); 82 150 gtk_widget_set_can_default(button, TRUE); … … 84 152 gtk_widget_show(button); 85 153 86 authDialog->priv->authWidget = webkitAuthenticationWidgetNew(webkitAuthenticationRequestGetAuthenticationChallenge(authDialog->priv->request.get())->core(), credentialStorageMode); 87 gtk_box_pack_start(GTK_BOX(vBox), authDialog->priv->authWidget, TRUE, TRUE, 0); 88 gtk_widget_show(authDialog->priv->authWidget); 154 GtkWidget* authBox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 12); 155 gtk_container_set_border_width(GTK_CONTAINER(authBox), 5); 156 157 GtkWidget* icon = gtk_image_new_from_stock(GTK_STOCK_DIALOG_AUTHENTICATION, GTK_ICON_SIZE_DIALOG); 158 gtk_misc_set_alignment(GTK_MISC(icon), 0.5, 0.0); 159 gtk_box_pack_start(GTK_BOX(authBox), icon, FALSE, FALSE, 0); 160 gtk_widget_show(icon); 161 162 const WebCore::AuthenticationChallenge& challenge = webkitAuthenticationRequestGetAuthenticationChallenge(priv->request.get())->core(); 163 GUniquePtr<char> prompt(g_strdup_printf(_("The site %s:%i requests a username and password"), 164 challenge.protectionSpace().host().utf8().data(), challenge.protectionSpace().port())); 165 priv->rememberCheckButton = gtk_check_button_new_with_mnemonic(_("_Remember password")); 166 gtk_label_set_line_wrap(GTK_LABEL(gtk_bin_get_child(GTK_BIN(priv->rememberCheckButton))), TRUE); 167 168 String realm = challenge.protectionSpace().realm(); 169 if (!realm.isEmpty()) { 170 packTwoColumnLayoutInBox( 171 authBox, 172 createLabel(prompt.get(), 6), nullptr, 173 createLabel(_("Server message:")), createLabel(realm.utf8().data()), 174 createLabel(_("Username:")), createEntry(&priv->loginEntry), 175 createLabel(_("Password:")), createEntry(&priv->passwordEntry), 176 priv->rememberCheckButton, nullptr, 177 nullptr); 178 179 } else { 180 packTwoColumnLayoutInBox( 181 authBox, 182 createLabel(prompt.get(), 6), nullptr, 183 createLabel(_("Username:")), createEntry(&priv->loginEntry), 184 createLabel(_("Password:")), createEntry(&priv->passwordEntry), 185 priv->rememberCheckButton, nullptr, nullptr, 186 nullptr); 187 } 188 gtk_entry_set_visibility(GTK_ENTRY(priv->passwordEntry), FALSE); 189 gtk_widget_set_visible(priv->rememberCheckButton, priv->credentialStorageMode != DisallowPersistentStorage); 190 191 const WebCore::Credential& credentialFromPersistentStorage = challenge.proposedCredential(); 192 if (!credentialFromPersistentStorage.isEmpty()) { 193 gtk_entry_set_text(GTK_ENTRY(priv->loginEntry), credentialFromPersistentStorage.user().utf8().data()); 194 gtk_entry_set_text(GTK_ENTRY(priv->passwordEntry), credentialFromPersistentStorage.password().utf8().data()); 195 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->rememberCheckButton), TRUE); 196 } 197 198 gtk_widget_grab_focus(priv->loginEntry); 199 200 gtk_box_pack_start(GTK_BOX(vBox), authBox, TRUE, TRUE, 0); 201 gtk_widget_show(authBox); 89 202 90 203 gtk_box_pack_end(GTK_BOX(vBox), buttonBox, FALSE, TRUE, 0); … … 160 273 WebKitAuthenticationDialog* authDialog = WEBKIT_AUTHENTICATION_DIALOG(g_object_new(WEBKIT_TYPE_AUTHENTICATION_DIALOG, NULL)); 161 274 authDialog->priv->request = request; 162 webkitAuthenticationDialogInitialize(authDialog, mode); 275 authDialog->priv->credentialStorageMode = mode; 276 webkitAuthenticationDialogInitialize(authDialog); 163 277 return GTK_WIDGET(authDialog); 164 278 } -
trunk/Source/WebKit2/UIProcess/API/gtk/WebKitAuthenticationDialog.h
r155347 r173510 22 22 23 23 #include "WebKitAuthenticationRequest.h" 24 #include "WebKitAuthenticationWidget.h"25 #include "WebKitWebView.h"26 24 #include <gtk/gtk.h> 25 26 enum CredentialStorageMode { 27 AllowPersistentStorage, // The user is asked whether to store credential information. 28 DisallowPersistentStorage // Credential information is only kept in the session. 29 }; 27 30 28 31 G_BEGIN_DECLS
Note: See TracChangeset
for help on using the changeset viewer.