• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2011 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_UI_VIEWS_REPOST_FORM_WARNING_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_REPOST_FORM_WARNING_VIEW_H_
7 #pragma once
8 
9 #include "content/browser/tab_contents/constrained_window.h"
10 #include "ui/gfx/native_widget_types.h"
11 #include "views/window/dialog_delegate.h"
12 
13 class ConstrainedWindow;
14 class NavigationController;
15 class RepostFormWarningController;
16 class TabContents;
17 
18 namespace views {
19 class MessageBoxView;
20 class Window;
21 }
22 
23 // Displays a dialog that warns the user that they are about to resubmit
24 // a form.
25 // To display the dialog, allocate this object on the heap. It will open the
26 // dialog from its constructor and then delete itself when the user dismisses
27 // the dialog.
28 class RepostFormWarningView : public ConstrainedDialogDelegate {
29  public:
30   // Use BrowserWindow::ShowRepostFormWarningDialog to use.
31   RepostFormWarningView(gfx::NativeWindow parent_window,
32                         TabContents* tab_contents);
33 
34   // views::DialogDelegate Methods:
35   virtual std::wstring GetWindowTitle() const;
36   virtual std::wstring GetDialogButtonLabel(
37       MessageBoxFlags::DialogButton button) const;
38   virtual void DeleteDelegate();
39 
40   virtual bool Cancel();
41   virtual bool Accept();
42 
43   // views::WindowDelegate Methods:
44   virtual views::View* GetContentsView();
45 
46  private:
47   virtual ~RepostFormWarningView();
48 
49   // The message box view whose commands we handle.
50   views::MessageBoxView* message_box_view_;
51 
52   scoped_ptr<RepostFormWarningController> controller_;
53 
54   DISALLOW_COPY_AND_ASSIGN(RepostFormWarningView);
55 };
56 
57 #endif  // CHROME_BROWSER_UI_VIEWS_REPOST_FORM_WARNING_VIEW_H_
58