| OLD | NEW |
| 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 for (BrowserList::const_iterator it = BrowserList::begin(); | 120 for (BrowserList::const_iterator it = BrowserList::begin(); |
| 121 it != BrowserList::end(); ++it) { | 121 it != BrowserList::end(); ++it) { |
| 122 gtk_window_group_add_window(window_group, | 122 gtk_window_group_add_window(window_group, |
| 123 (*it)->window()->GetNativeHandle()); | 123 (*it)->window()->GetNativeHandle()); |
| 124 } | 124 } |
| 125 g_object_unref(window_group); | 125 g_object_unref(window_group); |
| 126 | 126 |
| 127 gfx::NativeWindow window = client_->GetMessageBoxRootWindow(); | 127 gfx::NativeWindow window = client_->GetMessageBoxRootWindow(); |
| 128 dialog_ = gtk_message_dialog_new(window, GTK_DIALOG_MODAL, | 128 dialog_ = gtk_message_dialog_new(window, GTK_DIALOG_MODAL, |
| 129 message_type, buttons, "%s", WideToUTF8(message_text_).c_str()); | 129 message_type, buttons, "%s", WideToUTF8(message_text_).c_str()); |
| 130 gtk_util::ApplyMessageDialogQuirks(dialog_); |
| 130 gtk_window_set_title(GTK_WINDOW(dialog_), WideToUTF8(title_).c_str()); | 131 gtk_window_set_title(GTK_WINDOW(dialog_), WideToUTF8(title_).c_str()); |
| 131 | 132 |
| 132 // Adjust content area as needed. Set up the prompt text entry or | 133 // Adjust content area as needed. Set up the prompt text entry or |
| 133 // suppression check box. | 134 // suppression check box. |
| 134 if (MessageBoxFlags::kIsJavascriptPrompt == dialog_flags_) { | 135 if (MessageBoxFlags::kIsJavascriptPrompt == dialog_flags_) { |
| 135 // TODO(tc): Replace with gtk_dialog_get_content_area() when using GTK 2.14+ | 136 // TODO(tc): Replace with gtk_dialog_get_content_area() when using GTK 2.14+ |
| 136 GtkWidget* contents_vbox = GTK_DIALOG(dialog_)->vbox; | 137 GtkWidget* contents_vbox = GTK_DIALOG(dialog_)->vbox; |
| 137 GtkWidget* text_box = gtk_entry_new(); | 138 GtkWidget* text_box = gtk_entry_new(); |
| 138 gtk_entry_set_text(GTK_ENTRY(text_box), | 139 gtk_entry_set_text(GTK_ENTRY(text_box), |
| 139 WideToUTF8(default_prompt_text_).c_str()); | 140 WideToUTF8(default_prompt_text_).c_str()); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 } | 213 } |
| 213 } | 214 } |
| 214 | 215 |
| 215 void AppModalDialog::AcceptWindow() { | 216 void AppModalDialog::AcceptWindow() { |
| 216 OnDialogResponse(GTK_DIALOG(dialog_), GTK_RESPONSE_OK, this); | 217 OnDialogResponse(GTK_DIALOG(dialog_), GTK_RESPONSE_OK, this); |
| 217 } | 218 } |
| 218 | 219 |
| 219 void AppModalDialog::CancelWindow() { | 220 void AppModalDialog::CancelWindow() { |
| 220 OnDialogResponse(GTK_DIALOG(dialog_), GTK_RESPONSE_CANCEL, this); | 221 OnDialogResponse(GTK_DIALOG(dialog_), GTK_RESPONSE_CANCEL, this); |
| 221 } | 222 } |
| OLD | NEW |