| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #ifndef CHROME_BROWSER_GTK_REPOST_FORM_WARNING_GTK_H_ | 5 #ifndef CHROME_BROWSER_GTK_REPOST_FORM_WARNING_GTK_H_ |
| 6 #define CHROME_BROWSER_GTK_REPOST_FORM_WARNING_GTK_H_ | 6 #define CHROME_BROWSER_GTK_REPOST_FORM_WARNING_GTK_H_ |
| 7 | 7 |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 | 9 |
| 10 #include "chrome/common/notification_registrar.h" | 10 #include "chrome/common/notification_registrar.h" |
| 11 #include "chrome/browser/gtk/constrained_window_gtk.h" |
| 12 #include "app/gtk_signal.h" |
| 11 | 13 |
| 12 class NavigationController; | 14 class NavigationController; |
| 15 class TabContents; |
| 13 | 16 |
| 14 // Displays a dialog that warns the user that they are about to resubmit a form. | 17 // Displays a dialog that warns the user that they are about to resubmit a form. |
| 15 // To display the dialog, allocate this object on the heap. It will open the | 18 // To display the dialog, allocate this object on the heap. It will open the |
| 16 // dialog from its constructor and then delete itself when the user dismisses | 19 // dialog from its constructor and then delete itself when the user dismisses |
| 17 // the dialog. | 20 // the dialog. |
| 18 class RepostFormWarningGtk : public NotificationObserver { | 21 class RepostFormWarningGtk : public NotificationObserver, |
| 22 ConstrainedWindowGtkDelegate { |
| 19 public: | 23 public: |
| 20 RepostFormWarningGtk(GtkWindow* parent, | 24 RepostFormWarningGtk(GtkWindow* parent, TabContents* tab_contents); |
| 21 NavigationController* navigation_controller); | |
| 22 virtual ~RepostFormWarningGtk(); | 25 virtual ~RepostFormWarningGtk(); |
| 23 | 26 |
| 27 virtual GtkWidget* GetWidgetRoot(); |
| 28 |
| 29 virtual void DeleteDelegate(); |
| 30 |
| 24 private: | 31 private: |
| 25 // NotificationObserver implementation. | 32 // NotificationObserver implementation. |
| 26 // Watch for a new load or a closed tab and dismiss the dialog if they occur. | 33 // Watch for a new load or a closed tab and dismiss the dialog if they occur. |
| 27 virtual void Observe(NotificationType type, | 34 virtual void Observe(NotificationType type, |
| 28 const NotificationSource& source, | 35 const NotificationSource& source, |
| 29 const NotificationDetails& details); | 36 const NotificationDetails& details); |
| 30 | 37 |
| 31 // Tell Gtk to destroy the dialog window. This will only be done once, even | 38 // Tell Gtk to destroy the dialog window. This will only be done once, even |
| 32 // if Destroy is called multiple times (eg, from both OnResponse and Observe.) | 39 // if Destroy is called multiple times. |
| 33 void Destroy(); | 40 void Destroy(); |
| 34 | 41 |
| 35 static void OnResponse(GtkWidget* widget, | 42 CHROMEGTK_CALLBACK_0(RepostFormWarningGtk, void, OnRefresh); |
| 36 int response, | 43 CHROMEGTK_CALLBACK_0(RepostFormWarningGtk, void, OnCancel); |
| 37 RepostFormWarningGtk* dialog); | 44 CHROMEGTK_CALLBACK_1(RepostFormWarningGtk, |
| 38 static void OnWindowDestroy(GtkWidget* widget, RepostFormWarningGtk* dialog); | 45 void, |
| 46 OnHierarchyChanged, |
| 47 GtkWidget*); |
| 39 | 48 |
| 40 NotificationRegistrar registrar_; | 49 NotificationRegistrar registrar_; |
| 41 | 50 |
| 42 // Navigation controller, used to continue the reload. | 51 // Navigation controller, used to continue the reload. |
| 43 NavigationController* navigation_controller_; | 52 NavigationController* navigation_controller_; |
| 44 | 53 |
| 45 GtkWidget* dialog_; | 54 GtkWidget* dialog_; |
| 55 GtkWidget* ok_; |
| 56 GtkWidget* cancel_; |
| 57 |
| 58 ConstrainedWindow* window_; |
| 46 | 59 |
| 47 DISALLOW_COPY_AND_ASSIGN(RepostFormWarningGtk); | 60 DISALLOW_COPY_AND_ASSIGN(RepostFormWarningGtk); |
| 48 }; | 61 }; |
| 49 | 62 |
| 50 #endif // CHROME_BROWSER_GTK_REPOST_FORM_WARNING_GTK_H_ | 63 #endif // CHROME_BROWSER_GTK_REPOST_FORM_WARNING_GTK_H_ |
| OLD | NEW |