[email protected] | ebbbb9f | 2011-03-09 13:16:14 | [diff] [blame] | 1 | // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
[email protected] | 965bb09 | 2010-04-09 11:59:02 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. | ||||
4 | |||||
5 | #ifndef CHROME_BROWSER_REPOST_FORM_WARNING_CONTROLLER_H_ | ||||
6 | #define CHROME_BROWSER_REPOST_FORM_WARNING_CONTROLLER_H_ | ||||
[email protected] | 32b76ef | 2010-07-26 23:08:24 | [diff] [blame] | 7 | #pragma once |
[email protected] | 965bb09 | 2010-04-09 11:59:02 | [diff] [blame] | 8 | |
[email protected] | 49fd7e2 | 2011-11-21 16:52:21 | [diff] [blame^] | 9 | #include "base/compiler_specific.h" |
[email protected] | 6c2381d | 2011-10-19 02:52:53 | [diff] [blame] | 10 | #include "content/public/browser/notification_observer.h" |
11 | #include "content/public/browser/notification_registrar.h" | ||||
[email protected] | 965bb09 | 2010-04-09 11:59:02 | [diff] [blame] | 12 | |
[email protected] | 5f9de588 | 2011-09-30 23:36:28 | [diff] [blame] | 13 | class ConstrainedWindow; |
[email protected] | 965bb09 | 2010-04-09 11:59:02 | [diff] [blame] | 14 | class TabContents; |
15 | |||||
16 | // This class is used to continue or cancel a pending reload when the | ||||
17 | // repost form warning is shown. It is owned by the platform-dependent | ||||
[email protected] | b535bf1e | 2010-04-14 16:19:40 | [diff] [blame] | 18 | // |RepostFormWarning{Gtk,Mac,View}| classes. |
[email protected] | 6c2381d | 2011-10-19 02:52:53 | [diff] [blame] | 19 | class RepostFormWarningController : public content::NotificationObserver { |
[email protected] | 965bb09 | 2010-04-09 11:59:02 | [diff] [blame] | 20 | public: |
21 | explicit RepostFormWarningController(TabContents* tab_contents); | ||||
[email protected] | b535bf1e | 2010-04-14 16:19:40 | [diff] [blame] | 22 | virtual ~RepostFormWarningController(); |
[email protected] | 965bb09 | 2010-04-09 11:59:02 | [diff] [blame] | 23 | |
[email protected] | 965bb09 | 2010-04-09 11:59:02 | [diff] [blame] | 24 | // Cancel the reload. |
25 | void Cancel(); | ||||
26 | |||||
27 | // Continue the reload. | ||||
28 | void Continue(); | ||||
29 | |||||
[email protected] | 9d4984e | 2011-08-24 19:16:02 | [diff] [blame] | 30 | void set_window(ConstrainedWindow* window) { window_ = window; } |
31 | |||||
[email protected] | 965bb09 | 2010-04-09 11:59:02 | [diff] [blame] | 32 | private: |
[email protected] | 6c2381d | 2011-10-19 02:52:53 | [diff] [blame] | 33 | // content::NotificationObserver implementation. |
[email protected] | 965bb09 | 2010-04-09 11:59:02 | [diff] [blame] | 34 | // Watch for a new load or a closed tab and dismiss the dialog if they occur. |
[email protected] | 43211582 | 2011-07-10 15:52:27 | [diff] [blame] | 35 | virtual void Observe(int type, |
[email protected] | 6c2381d | 2011-10-19 02:52:53 | [diff] [blame] | 36 | const content::NotificationSource& source, |
[email protected] | 49fd7e2 | 2011-11-21 16:52:21 | [diff] [blame^] | 37 | const content::NotificationDetails& details) OVERRIDE; |
[email protected] | 965bb09 | 2010-04-09 11:59:02 | [diff] [blame] | 38 | |
39 | // Close the warning dialog. | ||||
40 | void CloseDialog(); | ||||
41 | |||||
[email protected] | 6c2381d | 2011-10-19 02:52:53 | [diff] [blame] | 42 | content::NotificationRegistrar registrar_; |
[email protected] | 965bb09 | 2010-04-09 11:59:02 | [diff] [blame] | 43 | |
44 | // Tab contents, used to continue the reload. | ||||
45 | TabContents* tab_contents_; | ||||
46 | |||||
47 | ConstrainedWindow* window_; | ||||
48 | |||||
49 | DISALLOW_COPY_AND_ASSIGN(RepostFormWarningController); | ||||
50 | }; | ||||
51 | |||||
52 | #endif // CHROME_BROWSER_REPOST_FORM_WARNING_CONTROLLER_H_ |