blob: 2b2c0a81042b0b7414b58b06d6d0e0010aac0955 [file] [log] [blame]
[email protected]965bb092010-04-09 11:59:021// 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
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_
7
8#include "chrome/browser/tab_contents/constrained_window.h"
9#include "chrome/common/notification_registrar.h"
10
11class NavigationController;
12class TabContents;
13
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
16// |RepostFormWarning{Gtk,Mac,View}| classes and deletes itself after closing
17// the dialog.
18class RepostFormWarningController : public NotificationObserver {
19 public:
20 explicit RepostFormWarningController(TabContents* tab_contents);
21
22 // Show the warning dialog.
23 void Show(ConstrainedWindowDelegate* window_delegate);
24
25 // Cancel the reload.
26 void Cancel();
27
28 // Continue the reload.
29 void Continue();
30
31 private:
32 virtual ~RepostFormWarningController();
33
34 // NotificationObserver implementation.
35 // Watch for a new load or a closed tab and dismiss the dialog if they occur.
36 void Observe(NotificationType type,
37 const NotificationSource& source,
38 const NotificationDetails& details);
39
40 // Close the warning dialog.
41 void CloseDialog();
42
43 NotificationRegistrar registrar_;
44
45 // Tab contents, used to continue the reload.
46 TabContents* tab_contents_;
47
48 ConstrainedWindow* window_;
49
50 DISALLOW_COPY_AND_ASSIGN(RepostFormWarningController);
51};
52
53#endif // CHROME_BROWSER_REPOST_FORM_WARNING_CONTROLLER_H_