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 #ifndef CHROME_BROWSER_REPOST_FORM_WARNING_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_REPOST_FORM_WARNING_CONTROLLER_H_ |
6 #define CHROME_BROWSER_REPOST_FORM_WARNING_CONTROLLER_H_ | 6 #define CHROME_BROWSER_REPOST_FORM_WARNING_CONTROLLER_H_ |
7 | 7 |
8 #include "chrome/browser/tab_contents/constrained_window.h" | 8 #include "chrome/browser/tab_contents/constrained_window.h" |
9 #include "chrome/common/notification_registrar.h" | 9 #include "chrome/common/notification_registrar.h" |
10 | 10 |
11 class NavigationController; | 11 class NavigationController; |
12 class TabContents; | 12 class TabContents; |
13 | 13 |
14 // This class is used to continue or cancel a pending reload when the | 14 // This class is used to continue or cancel a pending reload when the |
15 // repost form warning is shown. It is owned by the platform-dependent | 15 // repost form warning is shown. It is owned by the platform-dependent |
16 // |RepostFormWarning{Gtk,Mac,View}| classes and deletes itself after closing | 16 // |RepostFormWarning{Gtk,Mac,View}| classes. |
17 // the dialog. | |
18 class RepostFormWarningController : public NotificationObserver { | 17 class RepostFormWarningController : public NotificationObserver { |
19 public: | 18 public: |
20 explicit RepostFormWarningController(TabContents* tab_contents); | 19 explicit RepostFormWarningController(TabContents* tab_contents); |
| 20 virtual ~RepostFormWarningController(); |
21 | 21 |
22 // Show the warning dialog. | 22 // Show the warning dialog. |
23 void Show(ConstrainedWindowDelegate* window_delegate); | 23 void Show(ConstrainedWindowDelegate* window_delegate); |
24 | 24 |
25 // Cancel the reload. | 25 // Cancel the reload. |
26 void Cancel(); | 26 void Cancel(); |
27 | 27 |
28 // Continue the reload. | 28 // Continue the reload. |
29 void Continue(); | 29 void Continue(); |
30 | 30 |
31 private: | 31 private: |
32 virtual ~RepostFormWarningController(); | |
33 | |
34 // NotificationObserver implementation. | 32 // NotificationObserver implementation. |
35 // 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. |
36 void Observe(NotificationType type, | 34 void Observe(NotificationType type, |
37 const NotificationSource& source, | 35 const NotificationSource& source, |
38 const NotificationDetails& details); | 36 const NotificationDetails& details); |
39 | 37 |
40 // Close the warning dialog. | 38 // Close the warning dialog. |
41 void CloseDialog(); | 39 void CloseDialog(); |
42 | 40 |
43 NotificationRegistrar registrar_; | 41 NotificationRegistrar registrar_; |
44 | 42 |
45 // Tab contents, used to continue the reload. | 43 // Tab contents, used to continue the reload. |
46 TabContents* tab_contents_; | 44 TabContents* tab_contents_; |
47 | 45 |
48 ConstrainedWindow* window_; | 46 ConstrainedWindow* window_; |
49 | 47 |
50 DISALLOW_COPY_AND_ASSIGN(RepostFormWarningController); | 48 DISALLOW_COPY_AND_ASSIGN(RepostFormWarningController); |
51 }; | 49 }; |
52 | 50 |
53 #endif // CHROME_BROWSER_REPOST_FORM_WARNING_CONTROLLER_H_ | 51 #endif // CHROME_BROWSER_REPOST_FORM_WARNING_CONTROLLER_H_ |
OLD | NEW |