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

Side by Side Diff: chrome/browser/gtk/repost_form_warning_gtk.cc

Issue 6251001: Move chrome/browser/gtk/ to chrome/browser/ui/gtk/... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 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
« no previous file with comments | « chrome/browser/gtk/repost_form_warning_gtk.h ('k') | chrome/browser/gtk/rounded_window.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/gtk/repost_form_warning_gtk.h"
6
7 #include "app/l10n_util.h"
8 #include "base/message_loop.h"
9 #include "chrome/browser/browser_thread.h"
10 #include "chrome/browser/gtk/gtk_util.h"
11 #include "chrome/browser/repost_form_warning_controller.h"
12 #include "chrome/browser/tab_contents/navigation_controller.h"
13 #include "chrome/browser/tab_contents/tab_contents.h"
14 #include "chrome/common/notification_type.h"
15 #include "grit/generated_resources.h"
16
17 RepostFormWarningGtk::RepostFormWarningGtk(GtkWindow* parent,
18 TabContents* tab_contents)
19 : controller_(new RepostFormWarningController(tab_contents)) {
20 dialog_ = gtk_vbox_new(FALSE, gtk_util::kContentAreaBorder);
21 gtk_box_set_spacing(GTK_BOX(dialog_), gtk_util::kContentAreaSpacing);
22 GtkWidget* label = gtk_label_new(
23 l10n_util::GetStringUTF8(IDS_HTTP_POST_WARNING).c_str());
24 GtkWidget* image = gtk_image_new_from_stock(GTK_STOCK_DIALOG_QUESTION,
25 GTK_ICON_SIZE_DIALOG);
26 gtk_misc_set_alignment(GTK_MISC(image), 0.5, 0.0);
27
28 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
29 gtk_label_set_selectable(GTK_LABEL(label), TRUE);
30
31 GtkWidget *hbox = gtk_hbox_new(FALSE, gtk_util::kControlSpacing);
32
33 gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE, 0);
34
35 gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 0);
36
37 gtk_box_pack_start(GTK_BOX(dialog_), hbox, FALSE, FALSE, 0);
38
39 GtkWidget* buttonBox = gtk_hbutton_box_new();
40 gtk_button_box_set_layout(GTK_BUTTON_BOX(buttonBox), GTK_BUTTONBOX_END);
41 gtk_box_set_spacing(GTK_BOX(buttonBox), gtk_util::kControlSpacing);
42 gtk_box_pack_end(GTK_BOX(dialog_), buttonBox, FALSE, TRUE, 0);
43
44 cancel_ = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
45 gtk_button_set_label(GTK_BUTTON(cancel_),
46 l10n_util::GetStringUTF8(IDS_CANCEL).c_str());
47 g_signal_connect(cancel_, "clicked", G_CALLBACK(OnCancelThunk), this);
48 gtk_box_pack_end(GTK_BOX(buttonBox), cancel_, FALSE, TRUE, 0);
49
50 ok_ = gtk_button_new_from_stock(GTK_STOCK_REFRESH);
51 gtk_button_set_label(
52 GTK_BUTTON(ok_),
53 l10n_util::GetStringUTF8(IDS_HTTP_POST_WARNING_RESEND).c_str());
54 g_signal_connect(ok_, "clicked", G_CALLBACK(OnRefreshThunk), this);
55 gtk_box_pack_end(GTK_BOX(buttonBox), ok_, FALSE, TRUE, 0);
56
57 g_signal_connect(cancel_, "hierarchy-changed",
58 G_CALLBACK(OnHierarchyChangedThunk), this);
59
60 controller_->Show(this);
61 }
62
63 GtkWidget* RepostFormWarningGtk::GetWidgetRoot() {
64 return dialog_;
65 }
66
67 void RepostFormWarningGtk::DeleteDelegate() {
68 delete this;
69 }
70
71 RepostFormWarningGtk::~RepostFormWarningGtk() {
72 gtk_widget_destroy(dialog_);
73 }
74
75 void RepostFormWarningGtk::OnRefresh(GtkWidget* widget) {
76 controller_->Continue();
77 }
78
79 void RepostFormWarningGtk::OnCancel(GtkWidget* widget) {
80 controller_->Cancel();
81 }
82
83 void RepostFormWarningGtk::OnHierarchyChanged(GtkWidget* root,
84 GtkWidget* previous_toplevel) {
85 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
86 if (!GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel(cancel_))) {
87 return;
88 }
89 gtk_widget_grab_focus(cancel_);
90 }
OLDNEW
« no previous file with comments | « chrome/browser/gtk/repost_form_warning_gtk.h ('k') | chrome/browser/gtk/rounded_window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698