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

Side by Side Diff: chrome/browser/app_modal_dialog_gtk.cc

Issue 114058: Pressing "enter" while the JS prompt text entry has focus should (Closed)
Patch Set: gtk_entry_set_activates_default Created 11 years, 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/app_modal_dialog.h" 5 #include "chrome/browser/app_modal_dialog.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 8
9 #include "app/l10n_util.h" 9 #include "app/l10n_util.h"
10 #include "app/message_box_flags.h" 10 #include "app/message_box_flags.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 97
98 default: 98 default:
99 NOTREACHED(); 99 NOTREACHED();
100 } 100 }
101 101
102 GtkWindow* window = tab_contents_->view()->GetTopLevelNativeWindow(); 102 GtkWindow* window = tab_contents_->view()->GetTopLevelNativeWindow();
103 dialog_ = gtk_message_dialog_new(window, GTK_DIALOG_MODAL, 103 dialog_ = gtk_message_dialog_new(window, GTK_DIALOG_MODAL,
104 message_type, buttons, "%s", WideToUTF8(message_text_).c_str()); 104 message_type, buttons, "%s", WideToUTF8(message_text_).c_str());
105 gtk_window_set_title(GTK_WINDOW(dialog_), WideToUTF8(title_).c_str()); 105 gtk_window_set_title(GTK_WINDOW(dialog_), WideToUTF8(title_).c_str());
106 106
107 // Adjust content area as needed. 107 // Adjust content area as needed. Set up the prompt text entry or
108 // suppression check box.
108 if (MessageBoxFlags::kIsJavascriptPrompt == dialog_flags_) { 109 if (MessageBoxFlags::kIsJavascriptPrompt == dialog_flags_) {
109 // TODO(tc): Replace with gtk_dialog_get_content_area() when using GTK 2.14+ 110 // TODO(tc): Replace with gtk_dialog_get_content_area() when using GTK 2.14+
110 GtkWidget* contents_vbox = GTK_DIALOG(dialog_)->vbox; 111 GtkWidget* contents_vbox = GTK_DIALOG(dialog_)->vbox;
111 GtkWidget* text_box = gtk_entry_new(); 112 GtkWidget* text_box = gtk_entry_new();
112 gtk_entry_set_text(GTK_ENTRY(text_box), 113 gtk_entry_set_text(GTK_ENTRY(text_box),
113 WideToUTF8(default_prompt_text_).c_str()); 114 WideToUTF8(default_prompt_text_).c_str());
114 gtk_box_pack_start(GTK_BOX(contents_vbox), text_box, TRUE, TRUE, 0); 115 gtk_box_pack_start(GTK_BOX(contents_vbox), text_box, TRUE, TRUE, 0);
115 g_object_set_data(G_OBJECT(dialog_), kPromptTextId, text_box); 116 g_object_set_data(G_OBJECT(dialog_), kPromptTextId, text_box);
117 gtk_entry_set_activates_default(GTK_ENTRY(text_box), TRUE);
116 } 118 }
117 119
118 if (display_suppress_checkbox_) { 120 if (display_suppress_checkbox_) {
119 GtkWidget* contents_vbox = GTK_DIALOG(dialog_)->vbox; 121 GtkWidget* contents_vbox = GTK_DIALOG(dialog_)->vbox;
120 GtkWidget* check_box = gtk_check_button_new_with_label( 122 GtkWidget* check_box = gtk_check_button_new_with_label(
121 l10n_util::GetStringUTF8( 123 l10n_util::GetStringUTF8(
122 IDS_JAVASCRIPT_MESSAGEBOX_SUPPRESS_OPTION).c_str()); 124 IDS_JAVASCRIPT_MESSAGEBOX_SUPPRESS_OPTION).c_str());
123 gtk_box_pack_start(GTK_BOX(contents_vbox), check_box, TRUE, TRUE, 0); 125 gtk_box_pack_start(GTK_BOX(contents_vbox), check_box, TRUE, TRUE, 0);
124 g_object_set_data(G_OBJECT(dialog_), kSuppressCheckboxId, check_box); 126 g_object_set_data(G_OBJECT(dialog_), kSuppressCheckboxId, check_box);
125 } 127 }
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 } 177 }
176 } 178 }
177 179
178 void AppModalDialog::AcceptWindow() { 180 void AppModalDialog::AcceptWindow() {
179 OnDialogResponse(GTK_DIALOG(dialog_), GTK_RESPONSE_OK, this); 181 OnDialogResponse(GTK_DIALOG(dialog_), GTK_RESPONSE_OK, this);
180 } 182 }
181 183
182 void AppModalDialog::CancelWindow() { 184 void AppModalDialog::CancelWindow() {
183 OnDialogResponse(GTK_DIALOG(dialog_), GTK_RESPONSE_CANCEL, this); 185 OnDialogResponse(GTK_DIALOG(dialog_), GTK_RESPONSE_CANCEL, this);
184 } 186 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698