| 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 // We want the alert to be app modal so put all the browser windows into the | 115 // We want the alert to be app modal so put all the browser windows into the |
| 116 // same window group. | 116 // same window group. |
| 117 GtkWindowGroup* window_group = gtk_window_group_new(); | 117 GtkWindowGroup* window_group = gtk_window_group_new(); |
| 118 for (BrowserList::const_iterator it = BrowserList::begin(); | 118 for (BrowserList::const_iterator it = BrowserList::begin(); |
| 119 it != BrowserList::end(); ++it) { | 119 it != BrowserList::end(); ++it) { |
| 120 BrowserWindowGtk* window = static_cast<BrowserWindowGtk*>((*it)->window()); | 120 BrowserWindowGtk* window = static_cast<BrowserWindowGtk*>((*it)->window()); |
| 121 gtk_window_group_add_window(window_group, window->window()); | 121 gtk_window_group_add_window(window_group, window->window()); |
| 122 } | 122 } |
| 123 g_object_unref(window_group); | 123 g_object_unref(window_group); |
| 124 | 124 |
| 125 GtkWindow* window = tab_contents_->view()->GetTopLevelNativeWindow(); | 125 gfx::NativeWindow window = client_->GetMessageBoxRootWindow(); |
| 126 dialog_ = gtk_message_dialog_new(window, GTK_DIALOG_MODAL, | 126 dialog_ = gtk_message_dialog_new(window, GTK_DIALOG_MODAL, |
| 127 message_type, buttons, "%s", WideToUTF8(message_text_).c_str()); | 127 message_type, buttons, "%s", WideToUTF8(message_text_).c_str()); |
| 128 gtk_window_set_title(GTK_WINDOW(dialog_), WideToUTF8(title_).c_str()); | 128 gtk_window_set_title(GTK_WINDOW(dialog_), WideToUTF8(title_).c_str()); |
| 129 | 129 |
| 130 // Adjust content area as needed. Set up the prompt text entry or | 130 // Adjust content area as needed. Set up the prompt text entry or |
| 131 // suppression check box. | 131 // suppression check box. |
| 132 if (MessageBoxFlags::kIsJavascriptPrompt == dialog_flags_) { | 132 if (MessageBoxFlags::kIsJavascriptPrompt == dialog_flags_) { |
| 133 // TODO(tc): Replace with gtk_dialog_get_content_area() when using GTK 2.14+ | 133 // TODO(tc): Replace with gtk_dialog_get_content_area() when using GTK 2.14+ |
| 134 GtkWidget* contents_vbox = GTK_DIALOG(dialog_)->vbox; | 134 GtkWidget* contents_vbox = GTK_DIALOG(dialog_)->vbox; |
| 135 GtkWidget* text_box = gtk_entry_new(); | 135 GtkWidget* text_box = gtk_entry_new(); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 } | 200 } |
| 201 } | 201 } |
| 202 | 202 |
| 203 void AppModalDialog::AcceptWindow() { | 203 void AppModalDialog::AcceptWindow() { |
| 204 OnDialogResponse(GTK_DIALOG(dialog_), GTK_RESPONSE_OK, this); | 204 OnDialogResponse(GTK_DIALOG(dialog_), GTK_RESPONSE_OK, this); |
| 205 } | 205 } |
| 206 | 206 |
| 207 void AppModalDialog::CancelWindow() { | 207 void AppModalDialog::CancelWindow() { |
| 208 OnDialogResponse(GTK_DIALOG(dialog_), GTK_RESPONSE_CANCEL, this); | 208 OnDialogResponse(GTK_DIALOG(dialog_), GTK_RESPONSE_CANCEL, this); |
| 209 } | 209 } |
| OLD | NEW |