| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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_UI_VIEWS_REPOST_FORM_WARNING_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_TAB_MODAL_DIALOG_VIEW_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_REPOST_FORM_WARNING_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_TAB_MODAL_DIALOG_VIEW_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "ui/gfx/native_widget_types.h" | 9 #include "ui/gfx/native_widget_types.h" |
| 10 #include "ui/views/window/dialog_delegate.h" | 10 #include "ui/views/window/dialog_delegate.h" |
| 11 | 11 |
| 12 class RepostFormWarningController; | 12 class TabModalDialogDelegate; |
| 13 class TabContents; | 13 class TabContents; |
| 14 | 14 |
| 15 namespace views { | 15 namespace views { |
| 16 class MessageBoxView; | 16 class MessageBoxView; |
| 17 } | 17 } |
| 18 | 18 |
| 19 // Displays a dialog that warns the user that they are about to resubmit | 19 // Displays a tab-modal dialog, i.e. a dialog that will block the current page |
| 20 // a form. | 20 // but still allow the user to switch to a different page. |
| 21 // To display the dialog, allocate this object on the heap. It will open the | 21 // To display the dialog, allocate this object on the heap. It will open the |
| 22 // dialog from its constructor and then delete itself when the user dismisses | 22 // dialog from its constructor and then delete itself when the user dismisses |
| 23 // the dialog. | 23 // the dialog. |
| 24 class RepostFormWarningView : public views::DialogDelegate { | 24 class TabModalDialogDelegateView : public views::DialogDelegate { |
| 25 public: | 25 public: |
| 26 // Use BrowserWindow::ShowRepostFormWarningDialog to use. | 26 TabModalDialogDelegateView(TabModalDialogDelegate* delegate, |
| 27 RepostFormWarningView(gfx::NativeWindow parent_window, | 27 gfx::NativeWindow parent_window, |
| 28 TabContents* tab_contents); | 28 TabContents* tab_contents); |
| 29 | 29 |
| 30 // views::DialogDelegate: | 30 // views::DialogDelegate: |
| 31 virtual string16 GetWindowTitle() const OVERRIDE; | 31 virtual string16 GetWindowTitle() const OVERRIDE; |
| 32 virtual string16 GetDialogButtonLabel(ui::DialogButton button) const OVERRIDE; | 32 virtual string16 GetDialogButtonLabel(ui::DialogButton button) const OVERRIDE; |
| 33 virtual void DeleteDelegate() OVERRIDE; | |
| 34 virtual bool Cancel() OVERRIDE; | 33 virtual bool Cancel() OVERRIDE; |
| 35 virtual bool Accept() OVERRIDE; | 34 virtual bool Accept() OVERRIDE; |
| 36 | 35 |
| 37 // views::WidgetDelegate: | 36 // views::WidgetDelegate: |
| 38 virtual views::View* GetContentsView() OVERRIDE; | 37 virtual views::View* GetContentsView() OVERRIDE; |
| 39 virtual views::Widget* GetWidget() OVERRIDE; | 38 virtual views::Widget* GetWidget() OVERRIDE; |
| 40 virtual const views::Widget* GetWidget() const OVERRIDE; | 39 virtual const views::Widget* GetWidget() const OVERRIDE; |
| 40 virtual void DeleteDelegate() OVERRIDE; |
| 41 | 41 |
| 42 private: | 42 private: |
| 43 virtual ~RepostFormWarningView(); | 43 virtual ~TabModalDialogDelegateView(); |
| 44 | 44 |
| 45 scoped_ptr<RepostFormWarningController> controller_; | 45 scoped_ptr<TabModalDialogDelegate> delegate_; |
| 46 | 46 |
| 47 // The message box view whose commands we handle. | 47 // The message box view whose commands we handle. |
| 48 views::MessageBoxView* message_box_view_; | 48 views::MessageBoxView* message_box_view_; |
| 49 | 49 |
| 50 DISALLOW_COPY_AND_ASSIGN(RepostFormWarningView); | 50 DISALLOW_COPY_AND_ASSIGN(TabModalDialogDelegateView); |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 #endif // CHROME_BROWSER_UI_VIEWS_REPOST_FORM_WARNING_VIEW_H_ | 53 #endif // CHROME_BROWSER_UI_VIEWS_TAB_MODAL_DIALOG_VIEW_H_ |
| OLD | NEW |