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

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

Issue 373006: Implement window.alert() and its cousins for extensions.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/app_modal_dialog.cc ('k') | chrome/browser/extensions/extension_host.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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 }
OLDNEW
« no previous file with comments | « chrome/browser/app_modal_dialog.cc ('k') | chrome/browser/extensions/extension_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698