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_COCOA_TAB_MODAL_CONFIRM_DIALOG_MAC_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_TAB_MODAL_CONFIRM_DIALOG_MAC_H_ |
6 #define CHROME_BROWSER_UI_COCOA_TAB_MODAL_CONFIRM_DIALOG_MAC_H_ | 6 #define CHROME_BROWSER_UI_COCOA_TAB_MODAL_CONFIRM_DIALOG_MAC_H_ |
7 | 7 |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "chrome/browser/ui/cocoa/constrained_window_mac.h" | |
12 #include "chrome/browser/ui/cocoa/constrained_window/constrained_window_mac2.h" | 11 #include "chrome/browser/ui/cocoa/constrained_window/constrained_window_mac2.h" |
13 #include "chrome/browser/ui/tab_modal_confirm_dialog.h" | 12 #include "chrome/browser/ui/tab_modal_confirm_dialog.h" |
14 | 13 |
15 @class ConstrainedWindowAlert; | 14 @class ConstrainedWindowAlert; |
16 class TabModalConfirmDialogDelegate; | |
17 | 15 |
18 namespace content { | 16 namespace content { |
19 class WebContents; | 17 class WebContents; |
20 } | 18 } |
21 | 19 |
| 20 class TabModalConfirmDialogDelegate; |
| 21 @class TabModalConfirmDialogMacBridge; |
| 22 |
22 // Displays a tab-modal dialog, i.e. a dialog that will block the current page | 23 // Displays a tab-modal dialog, i.e. a dialog that will block the current page |
23 // but still allow the user to switch to a different page. | 24 // but still allow the user to switch to a different page. |
24 // To display the dialog, allocate this object on the heap. It will open the | 25 // To display the dialog, allocate this object on the heap. It will open the |
25 // dialog from its constructor and then delete itself when the user dismisses | 26 // dialog from its constructor and then delete itself when the user dismisses |
26 // the dialog. | 27 // the dialog. |
27 class TabModalConfirmDialogMac | 28 class TabModalConfirmDialogMac : public TabModalConfirmDialog, |
28 : public TabModalConfirmDialog, | 29 public ConstrainedWindowMacDelegate2 { |
29 public ConstrainedWindowMacDelegateSystemSheet { | |
30 public: | 30 public: |
31 TabModalConfirmDialogMac(TabModalConfirmDialogDelegate* delegate, | 31 TabModalConfirmDialogMac(TabModalConfirmDialogDelegate* delegate, |
32 content::WebContents* web_contents); | 32 content::WebContents* web_contents); |
33 | 33 |
34 // ConstrainedWindowDelegateMacSystemSheet: | |
35 virtual void DeleteDelegate() OVERRIDE; | |
36 | |
37 private: | 34 private: |
38 virtual ~TabModalConfirmDialogMac(); | 35 virtual ~TabModalConfirmDialogMac(); |
39 | 36 |
40 // TabModalConfirmDialog: | 37 // TabModalConfirmDialog: |
41 virtual void AcceptTabModalDialog() OVERRIDE; | 38 virtual void AcceptTabModalDialog() OVERRIDE; |
42 virtual void CancelTabModalDialog() OVERRIDE; | 39 virtual void CancelTabModalDialog() OVERRIDE; |
43 | 40 |
44 scoped_ptr<TabModalConfirmDialogDelegate> delegate_; | |
45 | |
46 DISALLOW_COPY_AND_ASSIGN(TabModalConfirmDialogMac); | |
47 }; | |
48 | |
49 @class TabModalConfirmDialogMacBridge2; | |
50 | |
51 // This class is the same as TabModalConfirmDialogMac except that it uses | |
52 // the new constrained window look and feel. | |
53 class TabModalConfirmDialogMac2 : public TabModalConfirmDialog, | |
54 public ConstrainedWindowMacDelegate2 { | |
55 public: | |
56 TabModalConfirmDialogMac2(TabModalConfirmDialogDelegate* delegate, | |
57 content::WebContents* web_contents); | |
58 | |
59 private: | |
60 virtual ~TabModalConfirmDialogMac2(); | |
61 | |
62 // TabModalConfirmDialog: | |
63 virtual void AcceptTabModalDialog() OVERRIDE; | |
64 virtual void CancelTabModalDialog() OVERRIDE; | |
65 | |
66 // ConstrainedWindowMacDelegate2: | 41 // ConstrainedWindowMacDelegate2: |
67 virtual void OnConstrainedWindowClosed( | 42 virtual void OnConstrainedWindowClosed( |
68 ConstrainedWindowMac2* window) OVERRIDE; | 43 ConstrainedWindowMac2* window) OVERRIDE; |
69 | 44 |
70 scoped_ptr<ConstrainedWindowMac2> window_; | 45 scoped_ptr<ConstrainedWindowMac2> window_; |
71 scoped_ptr<TabModalConfirmDialogDelegate> delegate_; | 46 scoped_ptr<TabModalConfirmDialogDelegate> delegate_; |
72 scoped_nsobject<ConstrainedWindowAlert> alert_; | 47 scoped_nsobject<ConstrainedWindowAlert> alert_; |
73 scoped_nsobject<TabModalConfirmDialogMacBridge2> bridge_; | 48 scoped_nsobject<TabModalConfirmDialogMacBridge> bridge_; |
74 | 49 |
75 DISALLOW_COPY_AND_ASSIGN(TabModalConfirmDialogMac2); | 50 DISALLOW_COPY_AND_ASSIGN(TabModalConfirmDialogMac); |
76 }; | 51 }; |
77 | 52 |
78 #endif // CHROME_BROWSER_UI_COCOA_TAB_MODAL_CONFIRM_DIALOG_MAC_H_ | 53 #endif // CHROME_BROWSER_UI_COCOA_TAB_MODAL_CONFIRM_DIALOG_MAC_H_ |
OLD | NEW |