[Metrics] Make MetricsStateManager take a callback param to check if UMA is enabled.
[chromium-blink-merge.git] / chrome / browser / ui / views / tab_modal_confirm_dialog_views.h
blob9847e5c3ccd20979054c297b33dcd3565eef3824
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"
15 namespace content {
16 class WebContents;
19 namespace views {
20 class MessageBoxView;
21 class Widget;
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
28 // the dialog.
29 class TabModalConfirmDialogViews : public TabModalConfirmDialog,
30 public views::DialogDelegate,
31 public views::LinkListener {
32 public:
33 TabModalConfirmDialogViews(TabModalConfirmDialogDelegate* delegate,
34 content::WebContents* web_contents);
36 // views::DialogDelegate:
37 virtual base::string16 GetWindowTitle() const OVERRIDE;
38 virtual base::string16 GetDialogButtonLabel(
39 ui::DialogButton button) const OVERRIDE;
40 virtual bool Cancel() OVERRIDE;
41 virtual bool Accept() OVERRIDE;
42 virtual bool Close() OVERRIDE;
44 // views::WidgetDelegate:
45 virtual views::View* GetContentsView() OVERRIDE;
46 virtual views::Widget* GetWidget() OVERRIDE;
47 virtual const views::Widget* GetWidget() const OVERRIDE;
48 virtual void DeleteDelegate() OVERRIDE;
49 virtual ui::ModalType GetModalType() const OVERRIDE;
51 private:
52 virtual ~TabModalConfirmDialogViews();
54 // TabModalConfirmDialog:
55 virtual void AcceptTabModalDialog() OVERRIDE;
56 virtual void CancelTabModalDialog() OVERRIDE;
58 // TabModalConfirmDialogCloseDelegate:
59 virtual void CloseDialog() OVERRIDE;
61 // views::LinkListener:
62 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE;
64 scoped_ptr<TabModalConfirmDialogDelegate> delegate_;
66 // The message box view whose commands we handle.
67 views::MessageBoxView* message_box_view_;
69 views::Widget* dialog_;
71 DISALLOW_COPY_AND_ASSIGN(TabModalConfirmDialogViews);
74 #endif // CHROME_BROWSER_UI_VIEWS_TAB_MODAL_CONFIRM_DIALOG_VIEWS_H_