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.
5 #ifndef CHROME_BROWSER_UI_VIEWS_TAB_MODAL_CONFIRM_DIALOG_VIEWS_H_
6 #define CHROME_BROWSER_UI_VIEWS_TAB_MODAL_CONFIRM_DIALOG_VIEWS_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "chrome/browser/ui/tab_modal_confirm_dialog.h"
11 #include "ui/gfx/native_widget_types.h"
12 #include "ui/views/controls/link_listener.h"
13 #include "ui/views/window/dialog_delegate.h"
24 // Displays a tab-modal dialog, i.e. a dialog that will block the current page
25 // but still allow the user to switch to a different page.
26 // To display the dialog, allocate this object on the heap. It will open the
27 // dialog from its constructor and then delete itself when the user dismisses
29 class TabModalConfirmDialogViews
: public TabModalConfirmDialog
,
30 public views::DialogDelegate
,
31 public views::LinkListener
{
33 TabModalConfirmDialogViews(TabModalConfirmDialogDelegate
* delegate
,
34 content::WebContents
* web_contents
);
36 // views::DialogDelegate:
37 base::string16
GetWindowTitle() const override
;
38 base::string16
GetDialogButtonLabel(ui::DialogButton button
) const override
;
39 bool Cancel() override
;
40 bool Accept() override
;
41 bool Close() override
;
43 // views::WidgetDelegate:
44 views::View
* GetContentsView() override
;
45 views::Widget
* GetWidget() override
;
46 const views::Widget
* GetWidget() const override
;
47 void DeleteDelegate() override
;
48 ui::ModalType
GetModalType() const override
;
51 ~TabModalConfirmDialogViews() override
;
53 // TabModalConfirmDialog:
54 void AcceptTabModalDialog() override
;
55 void CancelTabModalDialog() override
;
57 // TabModalConfirmDialogCloseDelegate:
58 void CloseDialog() override
;
60 // views::LinkListener:
61 void LinkClicked(views::Link
* source
, int event_flags
) override
;
63 scoped_ptr
<TabModalConfirmDialogDelegate
> delegate_
;
65 // The message box view whose commands we handle.
66 views::MessageBoxView
* message_box_view_
;
68 DISALLOW_COPY_AND_ASSIGN(TabModalConfirmDialogViews
);
71 #endif // CHROME_BROWSER_UI_VIEWS_TAB_MODAL_CONFIRM_DIALOG_VIEWS_H_