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

Side by Side Diff: chrome/browser/ui/gtk/tab_modal_confirm_dialog_gtk.cc

Issue 11740018: Cleanup: Remove more unneeded browser_thread.h includes. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix cros Created 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ui/gtk/tab_modal_confirm_dialog_gtk.h" 5 #include "chrome/browser/ui/gtk/tab_modal_confirm_dialog_gtk.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/ui/browser_dialogs.h" 9 #include "chrome/browser/ui/browser_dialogs.h"
10 #include "chrome/browser/ui/tab_modal_confirm_dialog_delegate.h" 10 #include "chrome/browser/ui/tab_modal_confirm_dialog_delegate.h"
11 #include "content/public/browser/browser_thread.h"
12 #include "content/public/browser/notification_types.h" 11 #include "content/public/browser/notification_types.h"
13 #include "grit/generated_resources.h" 12 #include "grit/generated_resources.h"
14 #include "ui/base/gtk/gtk_hig_constants.h" 13 #include "ui/base/gtk/gtk_hig_constants.h"
15 #include "ui/base/l10n/l10n_util.h" 14 #include "ui/base/l10n/l10n_util.h"
16 #include "ui/gfx/image/image.h" 15 #include "ui/gfx/image/image.h"
17 16
18 TabModalConfirmDialog* TabModalConfirmDialog::Create( 17 TabModalConfirmDialog* TabModalConfirmDialog::Create(
19 TabModalConfirmDialogDelegate* delegate, 18 TabModalConfirmDialogDelegate* delegate,
20 content::WebContents* web_contents) { 19 content::WebContents* web_contents) {
21 return new TabModalConfirmDialogGtk(delegate, web_contents); 20 return new TabModalConfirmDialogGtk(delegate, web_contents);
22 } 21 }
23 22
24 TabModalConfirmDialogGtk::TabModalConfirmDialogGtk( 23 TabModalConfirmDialogGtk::TabModalConfirmDialogGtk(
25 TabModalConfirmDialogDelegate* delegate, 24 TabModalConfirmDialogDelegate* delegate,
26 content::WebContents* web_contents) 25 content::WebContents* web_contents)
27 : delegate_(delegate) { 26 : delegate_(delegate) {
28 dialog_ = gtk_vbox_new(FALSE, ui::kContentAreaSpacing); 27 dialog_ = gtk_vbox_new(FALSE, ui::kContentAreaSpacing);
29 GtkWidget* label = gtk_label_new( 28 GtkWidget* label = gtk_label_new(
30 UTF16ToUTF8(delegate->GetMessage()).c_str()); 29 UTF16ToUTF8(delegate->GetMessage()).c_str());
31 gfx::Image* icon = delegate->GetIcon(); 30 gfx::Image* icon = delegate->GetIcon();
32 GtkWidget* image = icon ? gtk_image_new_from_pixbuf(icon->ToGdkPixbuf()) 31 GtkWidget* image = icon ? gtk_image_new_from_pixbuf(icon->ToGdkPixbuf())
33 : gtk_image_new_from_stock(GTK_STOCK_DIALOG_QUESTION, 32 : gtk_image_new_from_stock(GTK_STOCK_DIALOG_QUESTION,
34 GTK_ICON_SIZE_DIALOG); 33 GTK_ICON_SIZE_DIALOG);
35 gtk_misc_set_alignment(GTK_MISC(image), 0.5, 0.0); 34 gtk_misc_set_alignment(GTK_MISC(image), 0.5, 0.0);
36 35
37 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); 36 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
38 gtk_label_set_selectable(GTK_LABEL(label), TRUE); 37 gtk_label_set_selectable(GTK_LABEL(label), TRUE);
39 38
40 GtkWidget *hbox = gtk_hbox_new(FALSE, ui::kControlSpacing); 39 GtkWidget* hbox = gtk_hbox_new(FALSE, ui::kControlSpacing);
41 40
42 gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE, 0); 41 gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE, 0);
43 42
44 gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 0); 43 gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 0);
45 44
46 gtk_box_pack_start(GTK_BOX(dialog_), hbox, FALSE, FALSE, 0); 45 gtk_box_pack_start(GTK_BOX(dialog_), hbox, FALSE, FALSE, 0);
47 46
48 GtkWidget* buttonBox = gtk_hbutton_box_new(); 47 GtkWidget* buttonBox = gtk_hbutton_box_new();
49 gtk_button_box_set_layout(GTK_BUTTON_BOX(buttonBox), GTK_BUTTONBOX_END); 48 gtk_button_box_set_layout(GTK_BUTTON_BOX(buttonBox), GTK_BUTTONBOX_END);
50 gtk_box_set_spacing(GTK_BOX(buttonBox), ui::kControlSpacing); 49 gtk_box_set_spacing(GTK_BOX(buttonBox), ui::kControlSpacing);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 OnCancel(NULL); 96 OnCancel(NULL);
98 } 97 }
99 98
100 void TabModalConfirmDialogGtk::OnAccept(GtkWidget* widget) { 99 void TabModalConfirmDialogGtk::OnAccept(GtkWidget* widget) {
101 delegate_->Accept(); 100 delegate_->Accept();
102 } 101 }
103 102
104 void TabModalConfirmDialogGtk::OnCancel(GtkWidget* widget) { 103 void TabModalConfirmDialogGtk::OnCancel(GtkWidget* widget) {
105 delegate_->Cancel(); 104 delegate_->Cancel();
106 } 105 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/test/integration/sessions_helper.cc ('k') | chrome/browser/ui/login/login_prompt_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698