OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_TAB_MODAL_CONFIRM_DIALOG_VIEWS_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_TAB_MODAL_CONFIRM_DIALOG_VIEWS_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_TAB_MODAL_CONFIRM_DIALOG_VIEWS_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_TAB_MODAL_CONFIRM_DIALOG_VIEWS_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "chrome/browser/ui/tab_modal_confirm_dialog.h" | 10 #include "chrome/browser/ui/tab_modal_confirm_dialog.h" |
11 #include "ui/gfx/native_widget_types.h" | 11 #include "ui/gfx/native_widget_types.h" |
12 #include "ui/views/controls/link_listener.h" | 12 #include "ui/views/controls/link_listener.h" |
13 #include "ui/views/window/dialog_delegate.h" | 13 #include "ui/views/window/dialog_delegate.h" |
14 | 14 |
15 namespace content { | 15 namespace content { |
16 class WebContents; | 16 class WebContents; |
17 class BrowserContext; | |
18 } | 17 } |
19 | 18 |
20 namespace views { | 19 namespace views { |
21 class MessageBoxView; | 20 class MessageBoxView; |
22 class Widget; | 21 class Widget; |
23 } | 22 } |
24 | 23 |
25 // Displays a tab-modal dialog, i.e. a dialog that will block the current page | 24 // Displays a tab-modal dialog, i.e. a dialog that will block the current page |
26 // but still allow the user to switch to a different page. | 25 // but still allow the user to switch to a different page. |
27 // To display the dialog, allocate this object on the heap. It will open the | 26 // To display the dialog, allocate this object on the heap. It will open the |
28 // dialog from its constructor and then delete itself when the user dismisses | 27 // dialog from its constructor and then delete itself when the user dismisses |
29 // the dialog. | 28 // the dialog. |
30 class TabModalConfirmDialogViews : public TabModalConfirmDialog, | 29 class TabModalConfirmDialogViews : public TabModalConfirmDialog, |
31 public views::DialogDelegate, | 30 public views::DialogDelegate, |
32 public views::LinkListener { | 31 public views::LinkListener { |
33 public: | 32 public: |
34 TabModalConfirmDialogViews(TabModalConfirmDialogDelegate* delegate, | 33 TabModalConfirmDialogViews(TabModalConfirmDialogDelegate* delegate, |
35 content::WebContents* web_contents); | 34 content::WebContents* web_contents); |
36 | 35 |
37 // views::DialogDelegate: | 36 // views::DialogDelegate: |
38 virtual base::string16 GetWindowTitle() const OVERRIDE; | 37 virtual base::string16 GetWindowTitle() const OVERRIDE; |
39 virtual base::string16 GetDialogButtonLabel( | 38 virtual base::string16 GetDialogButtonLabel( |
40 ui::DialogButton button) const OVERRIDE; | 39 ui::DialogButton button) const OVERRIDE; |
41 virtual bool Cancel() OVERRIDE; | 40 virtual bool Cancel() OVERRIDE; |
42 virtual bool Accept() OVERRIDE; | 41 virtual bool Accept() OVERRIDE; |
43 virtual bool Close() OVERRIDE; | 42 virtual bool Close() OVERRIDE; |
44 | 43 |
45 // views::WidgetDelegate: | 44 // views::WidgetDelegate: |
46 virtual views::View* GetContentsView() OVERRIDE; | 45 virtual views::View* GetContentsView() OVERRIDE; |
47 virtual views::NonClientFrameView* CreateNonClientFrameView( | |
48 views::Widget* widget) OVERRIDE; | |
49 virtual views::Widget* GetWidget() OVERRIDE; | 46 virtual views::Widget* GetWidget() OVERRIDE; |
50 virtual const views::Widget* GetWidget() const OVERRIDE; | 47 virtual const views::Widget* GetWidget() const OVERRIDE; |
51 virtual void DeleteDelegate() OVERRIDE; | 48 virtual void DeleteDelegate() OVERRIDE; |
52 virtual ui::ModalType GetModalType() const OVERRIDE; | 49 virtual ui::ModalType GetModalType() const OVERRIDE; |
53 | 50 |
54 private: | 51 private: |
55 virtual ~TabModalConfirmDialogViews(); | 52 virtual ~TabModalConfirmDialogViews(); |
56 | 53 |
57 // TabModalConfirmDialog: | 54 // TabModalConfirmDialog: |
58 virtual void AcceptTabModalDialog() OVERRIDE; | 55 virtual void AcceptTabModalDialog() OVERRIDE; |
59 virtual void CancelTabModalDialog() OVERRIDE; | 56 virtual void CancelTabModalDialog() OVERRIDE; |
60 | 57 |
61 // TabModalConfirmDialogCloseDelegate: | 58 // TabModalConfirmDialogCloseDelegate: |
62 virtual void CloseDialog() OVERRIDE; | 59 virtual void CloseDialog() OVERRIDE; |
63 | 60 |
64 // views::LinkListener: | 61 // views::LinkListener: |
65 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE; | 62 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE; |
66 | 63 |
67 scoped_ptr<TabModalConfirmDialogDelegate> delegate_; | 64 scoped_ptr<TabModalConfirmDialogDelegate> delegate_; |
68 | 65 |
69 // The message box view whose commands we handle. | 66 // The message box view whose commands we handle. |
70 views::MessageBoxView* message_box_view_; | 67 views::MessageBoxView* message_box_view_; |
71 | 68 |
72 views::Widget* dialog_; | 69 views::Widget* dialog_; |
73 content::BrowserContext* browser_context_; | |
74 | 70 |
75 DISALLOW_COPY_AND_ASSIGN(TabModalConfirmDialogViews); | 71 DISALLOW_COPY_AND_ASSIGN(TabModalConfirmDialogViews); |
76 }; | 72 }; |
77 | 73 |
78 #endif // CHROME_BROWSER_UI_VIEWS_TAB_MODAL_CONFIRM_DIALOG_VIEWS_H_ | 74 #endif // CHROME_BROWSER_UI_VIEWS_TAB_MODAL_CONFIRM_DIALOG_VIEWS_H_ |
OLD | NEW |