Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1518)

Unified Diff: chrome/browser/login_prompt_gtk.cc

Issue 541056: Tab-modal dialog improvements:... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/gtk/tabs/tab_strip_gtk.cc ('k') | chrome/browser/login_prompt_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/login_prompt_gtk.cc
===================================================================
--- chrome/browser/login_prompt_gtk.cc (revision 36364)
+++ chrome/browser/login_prompt_gtk.cc (working copy)
@@ -106,17 +106,20 @@
GtkWidget* hbox = gtk_hbox_new(FALSE, 12);
gtk_box_pack_start(GTK_BOX(root_.get()), hbox, FALSE, FALSE, 0);
- GtkWidget* ok = gtk_button_new_from_stock(GTK_STOCK_OK);
+ ok_ = gtk_button_new_from_stock(GTK_STOCK_OK);
gtk_button_set_label(
- GTK_BUTTON(ok),
+ GTK_BUTTON(ok_),
l10n_util::GetStringUTF8(IDS_LOGIN_DIALOG_OK_BUTTON_LABEL).c_str());
- g_signal_connect(ok, "clicked", G_CALLBACK(OnOKClicked), this);
- gtk_box_pack_end(GTK_BOX(hbox), ok, FALSE, FALSE, 0);
+ g_signal_connect(ok_, "clicked", G_CALLBACK(OnOKClicked), this);
+ gtk_box_pack_end(GTK_BOX(hbox), ok_, FALSE, FALSE, 0);
GtkWidget* cancel = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
g_signal_connect(cancel, "clicked", G_CALLBACK(OnCancelClicked), this);
gtk_box_pack_end(GTK_BOX(hbox), cancel, FALSE, FALSE, 0);
+ g_signal_connect(root_.get(), "hierarchy-changed",
+ G_CALLBACK(OnPromptShown), this);
+
SetModel(manager);
// Scary thread safety note: This can potentially be called *after* SetAuth
@@ -128,8 +131,8 @@
// Now that we have attached ourself to the window, we can make our OK
// button the default action and mess with the focus.
- GTK_WIDGET_SET_FLAGS(ok, GTK_CAN_DEFAULT);
- gtk_widget_grab_default(ok);
+ GTK_WIDGET_SET_FLAGS(ok_, GTK_CAN_DEFAULT);
+ gtk_widget_grab_default(ok_);
gtk_widget_grab_focus(username_entry_);
SendNotifications();
@@ -305,6 +308,20 @@
handler->CancelAuth();
}
+ static void OnPromptShown(GtkButton* root,
+ GtkWidget* previous_toplevel,
+ LoginHandlerGtk* handler) {
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
+ if (!GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel(handler->ok_)))
+ return;
+
+ // Now that we have attached ourself to the window, we can make our OK
+ // button the default action and mess with the focus.
+ GTK_WIDGET_SET_FLAGS(handler->ok_, GTK_CAN_DEFAULT);
+ gtk_widget_grab_default(handler->ok_);
+ gtk_widget_grab_focus(handler->username_entry_);
+}
+
// True if we've handled auth (SetAuth or CancelAuth has been called).
bool handled_auth_;
Lock handled_auth_lock_;
@@ -339,6 +356,7 @@
// GtkEntry widgets that the user types into.
GtkWidget* username_entry_;
GtkWidget* password_entry_;
+ GtkWidget* ok_;
// If not null, points to a model we need to notify of our own destruction
// so it doesn't try and access this when its too late.
« no previous file with comments | « chrome/browser/gtk/tabs/tab_strip_gtk.cc ('k') | chrome/browser/login_prompt_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698