repost_form_warning_controller.h revision 5821806d5e7f356e8fa4b058a389a808ea183019
1// Copyright (c) 2012 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 "base/compiler_specific.h"
9#include "chrome/browser/ui/tab_modal_confirm_dialog_delegate.h"
10
11namespace content {
12class NavigationController;
13}
14
15// This class is used to continue or cancel a pending reload when the
16// repost form warning is shown. It is owned by the platform-specific
17// |TabModalConfirmDialog{Gtk, Mac, Views, WebUI}| classes.
18class RepostFormWarningController : public TabModalConfirmDialogDelegate {
19 public:
20  explicit RepostFormWarningController(content::WebContents* web_contents);
21  virtual ~RepostFormWarningController();
22
23  // TabModalConfirmDialogDelegate methods:
24  virtual string16 GetTitle() OVERRIDE;
25  virtual string16 GetMessage() OVERRIDE;
26  virtual string16 GetAcceptButtonTitle() OVERRIDE;
27#if defined(TOOLKIT_GTK)
28  virtual const char* GetAcceptButtonIcon() OVERRIDE;
29  virtual const char* GetCancelButtonIcon() OVERRIDE;
30#endif  // defined(TOOLKIT_GTK)
31  virtual void OnAccepted() OVERRIDE;
32  virtual void OnCanceled() OVERRIDE;
33
34 private:
35  virtual void Observe(int type,
36                       const content::NotificationSource& source,
37                       const content::NotificationDetails& details) OVERRIDE;
38
39  // Weak pointer; this dialog is cancelled when the WebContents is closed.
40  content::NavigationController* navigation_controller_;
41
42  DISALLOW_COPY_AND_ASSIGN(RepostFormWarningController);
43};
44
45#endif  // CHROME_BROWSER_REPOST_FORM_WARNING_CONTROLLER_H_
46