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/tab_contents/tab_contents_wrapper.h" |
9 #include "content/browser/browser_thread.h" | 10 #include "content/browser/browser_thread.h" |
10 #include "content/browser/tab_contents/navigation_controller.h" | 11 #include "content/browser/tab_contents/navigation_controller.h" |
11 #include "content/browser/tab_contents/tab_contents.h" | 12 #include "content/browser/tab_contents/tab_contents.h" |
12 #include "content/common/content_notification_types.h" | 13 #include "content/common/content_notification_types.h" |
13 #include "grit/generated_resources.h" | 14 #include "grit/generated_resources.h" |
14 #include "ui/base/gtk/gtk_hig_constants.h" | 15 #include "ui/base/gtk/gtk_hig_constants.h" |
15 #include "ui/base/l10n/l10n_util.h" | 16 #include "ui/base/l10n/l10n_util.h" |
16 | 17 |
17 RepostFormWarningGtk::RepostFormWarningGtk(GtkWindow* parent, | 18 RepostFormWarningGtk::RepostFormWarningGtk(GtkWindow* parent, |
18 TabContents* tab_contents) | 19 TabContents* tab_contents) |
(...skipping 28 matching lines...) Expand all Loading... |
47 g_signal_connect(cancel_, "clicked", G_CALLBACK(OnCancelThunk), this); | 48 g_signal_connect(cancel_, "clicked", G_CALLBACK(OnCancelThunk), this); |
48 gtk_box_pack_end(GTK_BOX(buttonBox), cancel_, FALSE, TRUE, 0); | 49 gtk_box_pack_end(GTK_BOX(buttonBox), cancel_, FALSE, TRUE, 0); |
49 | 50 |
50 ok_ = gtk_button_new_from_stock(GTK_STOCK_REFRESH); | 51 ok_ = gtk_button_new_from_stock(GTK_STOCK_REFRESH); |
51 gtk_button_set_label( | 52 gtk_button_set_label( |
52 GTK_BUTTON(ok_), | 53 GTK_BUTTON(ok_), |
53 l10n_util::GetStringUTF8(IDS_HTTP_POST_WARNING_RESEND).c_str()); | 54 l10n_util::GetStringUTF8(IDS_HTTP_POST_WARNING_RESEND).c_str()); |
54 g_signal_connect(ok_, "clicked", G_CALLBACK(OnRefreshThunk), this); | 55 g_signal_connect(ok_, "clicked", G_CALLBACK(OnRefreshThunk), this); |
55 gtk_box_pack_end(GTK_BOX(buttonBox), ok_, FALSE, TRUE, 0); | 56 gtk_box_pack_end(GTK_BOX(buttonBox), ok_, FALSE, TRUE, 0); |
56 | 57 |
57 controller_->set_window(new ConstrainedWindowGtk(tab_contents, this)); | 58 TabContentsWrapper* wrapper = |
| 59 TabContentsWrapper::GetCurrentWrapperForContents(tab_contents); |
| 60 controller_->set_window(new ConstrainedWindowGtk(wrapper, this)); |
58 } | 61 } |
59 | 62 |
60 GtkWidget* RepostFormWarningGtk::GetWidgetRoot() { | 63 GtkWidget* RepostFormWarningGtk::GetWidgetRoot() { |
61 return dialog_; | 64 return dialog_; |
62 } | 65 } |
63 | 66 |
64 GtkWidget* RepostFormWarningGtk::GetFocusWidget() { | 67 GtkWidget* RepostFormWarningGtk::GetFocusWidget() { |
65 return cancel_; | 68 return cancel_; |
66 } | 69 } |
67 | 70 |
68 void RepostFormWarningGtk::DeleteDelegate() { | 71 void RepostFormWarningGtk::DeleteDelegate() { |
69 delete this; | 72 delete this; |
70 } | 73 } |
71 | 74 |
72 RepostFormWarningGtk::~RepostFormWarningGtk() { | 75 RepostFormWarningGtk::~RepostFormWarningGtk() { |
73 gtk_widget_destroy(dialog_); | 76 gtk_widget_destroy(dialog_); |
74 } | 77 } |
75 | 78 |
76 void RepostFormWarningGtk::OnRefresh(GtkWidget* widget) { | 79 void RepostFormWarningGtk::OnRefresh(GtkWidget* widget) { |
77 controller_->Continue(); | 80 controller_->Continue(); |
78 } | 81 } |
79 | 82 |
80 void RepostFormWarningGtk::OnCancel(GtkWidget* widget) { | 83 void RepostFormWarningGtk::OnCancel(GtkWidget* widget) { |
81 controller_->Cancel(); | 84 controller_->Cancel(); |
82 } | 85 } |
OLD | NEW |