OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 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/gtk/repost_form_warning_gtk.h" | 5 #include "chrome/browser/gtk/repost_form_warning_gtk.h" |
6 | 6 |
7 #include "app/gtk_util.h" | 7 #include "app/gtk_util.h" |
8 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "chrome/browser/gtk/gtk_util.h" | 10 #include "chrome/browser/gtk/gtk_util.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 G_CALLBACK(OnHierarchyChangedThunk), this); | 58 G_CALLBACK(OnHierarchyChangedThunk), this); |
59 | 59 |
60 controller_->Show(this); | 60 controller_->Show(this); |
61 } | 61 } |
62 | 62 |
63 GtkWidget* RepostFormWarningGtk::GetWidgetRoot() { | 63 GtkWidget* RepostFormWarningGtk::GetWidgetRoot() { |
64 return dialog_; | 64 return dialog_; |
65 } | 65 } |
66 | 66 |
67 void RepostFormWarningGtk::DeleteDelegate() { | 67 void RepostFormWarningGtk::DeleteDelegate() { |
68 Dismiss(); | |
69 delete this; | 68 delete this; |
70 } | 69 } |
71 | 70 |
72 RepostFormWarningGtk::~RepostFormWarningGtk() { | 71 RepostFormWarningGtk::~RepostFormWarningGtk() { |
73 } | 72 gtk_widget_destroy(dialog_); |
74 | |
75 void RepostFormWarningGtk::Dismiss() { | |
76 if (dialog_) { | |
77 gtk_widget_destroy(dialog_); | |
78 dialog_ = NULL; | |
79 } | |
80 } | 73 } |
81 | 74 |
82 void RepostFormWarningGtk::OnRefresh(GtkWidget* widget) { | 75 void RepostFormWarningGtk::OnRefresh(GtkWidget* widget) { |
83 controller_->Continue(); | 76 controller_->Continue(); |
84 } | 77 } |
85 | 78 |
86 void RepostFormWarningGtk::OnCancel(GtkWidget* widget) { | 79 void RepostFormWarningGtk::OnCancel(GtkWidget* widget) { |
87 controller_->Cancel(); | 80 controller_->Cancel(); |
88 } | 81 } |
89 | 82 |
90 void RepostFormWarningGtk::OnHierarchyChanged(GtkWidget* root, | 83 void RepostFormWarningGtk::OnHierarchyChanged(GtkWidget* root, |
91 GtkWidget* previous_toplevel) { | 84 GtkWidget* previous_toplevel) { |
92 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); | 85 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); |
93 if (!GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel(cancel_))) { | 86 if (!GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel(cancel_))) { |
94 return; | 87 return; |
95 } | 88 } |
96 gtk_widget_grab_focus(cancel_); | 89 gtk_widget_grab_focus(cancel_); |
97 } | 90 } |
98 | 91 |
OLD | NEW |