OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/repost_form_warning_gtk.h" | 5 #include "chrome/browser/ui/gtk/repost_form_warning_gtk.h" |
6 | 6 |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "chrome/browser/repost_form_warning_controller.h" | 8 #include "chrome/browser/repost_form_warning_controller.h" |
9 #include "chrome/browser/ui/gtk/gtk_util.h" | |
10 #include "content/browser/browser_thread.h" | 9 #include "content/browser/browser_thread.h" |
11 #include "content/browser/tab_contents/navigation_controller.h" | 10 #include "content/browser/tab_contents/navigation_controller.h" |
12 #include "content/browser/tab_contents/tab_contents.h" | 11 #include "content/browser/tab_contents/tab_contents.h" |
13 #include "content/common/content_notification_types.h" | 12 #include "content/common/content_notification_types.h" |
14 #include "grit/generated_resources.h" | 13 #include "grit/generated_resources.h" |
| 14 #include "ui/base/gtk/gtk_hig_constants.h" |
15 #include "ui/base/l10n/l10n_util.h" | 15 #include "ui/base/l10n/l10n_util.h" |
16 | 16 |
17 RepostFormWarningGtk::RepostFormWarningGtk(GtkWindow* parent, | 17 RepostFormWarningGtk::RepostFormWarningGtk(GtkWindow* parent, |
18 TabContents* tab_contents) | 18 TabContents* tab_contents) |
19 : controller_(new RepostFormWarningController(tab_contents)) { | 19 : controller_(new RepostFormWarningController(tab_contents)) { |
20 dialog_ = gtk_vbox_new(FALSE, gtk_util::kContentAreaBorder); | 20 dialog_ = gtk_vbox_new(FALSE, ui::kContentAreaBorder); |
21 gtk_box_set_spacing(GTK_BOX(dialog_), gtk_util::kContentAreaSpacing); | 21 gtk_box_set_spacing(GTK_BOX(dialog_), ui::kContentAreaSpacing); |
22 GtkWidget* label = gtk_label_new( | 22 GtkWidget* label = gtk_label_new( |
23 l10n_util::GetStringUTF8(IDS_HTTP_POST_WARNING).c_str()); | 23 l10n_util::GetStringUTF8(IDS_HTTP_POST_WARNING).c_str()); |
24 GtkWidget* image = gtk_image_new_from_stock(GTK_STOCK_DIALOG_QUESTION, | 24 GtkWidget* image = gtk_image_new_from_stock(GTK_STOCK_DIALOG_QUESTION, |
25 GTK_ICON_SIZE_DIALOG); | 25 GTK_ICON_SIZE_DIALOG); |
26 gtk_misc_set_alignment(GTK_MISC(image), 0.5, 0.0); | 26 gtk_misc_set_alignment(GTK_MISC(image), 0.5, 0.0); |
27 | 27 |
28 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | 28 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); |
29 gtk_label_set_selectable(GTK_LABEL(label), TRUE); | 29 gtk_label_set_selectable(GTK_LABEL(label), TRUE); |
30 | 30 |
31 GtkWidget *hbox = gtk_hbox_new(FALSE, gtk_util::kControlSpacing); | 31 GtkWidget *hbox = gtk_hbox_new(FALSE, ui::kControlSpacing); |
32 | 32 |
33 gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE, 0); | 33 gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE, 0); |
34 | 34 |
35 gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 0); | 35 gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 0); |
36 | 36 |
37 gtk_box_pack_start(GTK_BOX(dialog_), hbox, FALSE, FALSE, 0); | 37 gtk_box_pack_start(GTK_BOX(dialog_), hbox, FALSE, FALSE, 0); |
38 | 38 |
39 GtkWidget* buttonBox = gtk_hbutton_box_new(); | 39 GtkWidget* buttonBox = gtk_hbutton_box_new(); |
40 gtk_button_box_set_layout(GTK_BUTTON_BOX(buttonBox), GTK_BUTTONBOX_END); | 40 gtk_button_box_set_layout(GTK_BUTTON_BOX(buttonBox), GTK_BUTTONBOX_END); |
41 gtk_box_set_spacing(GTK_BOX(buttonBox), gtk_util::kControlSpacing); | 41 gtk_box_set_spacing(GTK_BOX(buttonBox), ui::kControlSpacing); |
42 gtk_box_pack_end(GTK_BOX(dialog_), buttonBox, FALSE, TRUE, 0); | 42 gtk_box_pack_end(GTK_BOX(dialog_), buttonBox, FALSE, TRUE, 0); |
43 | 43 |
44 cancel_ = gtk_button_new_from_stock(GTK_STOCK_CANCEL); | 44 cancel_ = gtk_button_new_from_stock(GTK_STOCK_CANCEL); |
45 gtk_button_set_label(GTK_BUTTON(cancel_), | 45 gtk_button_set_label(GTK_BUTTON(cancel_), |
46 l10n_util::GetStringUTF8(IDS_CANCEL).c_str()); | 46 l10n_util::GetStringUTF8(IDS_CANCEL).c_str()); |
47 g_signal_connect(cancel_, "clicked", G_CALLBACK(OnCancelThunk), this); | 47 g_signal_connect(cancel_, "clicked", G_CALLBACK(OnCancelThunk), this); |
48 gtk_box_pack_end(GTK_BOX(buttonBox), cancel_, FALSE, TRUE, 0); | 48 gtk_box_pack_end(GTK_BOX(buttonBox), cancel_, FALSE, TRUE, 0); |
49 | 49 |
50 ok_ = gtk_button_new_from_stock(GTK_STOCK_REFRESH); | 50 ok_ = gtk_button_new_from_stock(GTK_STOCK_REFRESH); |
51 gtk_button_set_label( | 51 gtk_button_set_label( |
(...skipping 21 matching lines...) Expand all Loading... |
73 gtk_widget_destroy(dialog_); | 73 gtk_widget_destroy(dialog_); |
74 } | 74 } |
75 | 75 |
76 void RepostFormWarningGtk::OnRefresh(GtkWidget* widget) { | 76 void RepostFormWarningGtk::OnRefresh(GtkWidget* widget) { |
77 controller_->Continue(); | 77 controller_->Continue(); |
78 } | 78 } |
79 | 79 |
80 void RepostFormWarningGtk::OnCancel(GtkWidget* widget) { | 80 void RepostFormWarningGtk::OnCancel(GtkWidget* widget) { |
81 controller_->Cancel(); | 81 controller_->Cancel(); |
82 } | 82 } |
OLD | NEW |