- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / cocoa / tab_modal_confirm_dialog_mac.h
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_UI_COCOA_TAB_MODAL_CONFIRM_DIALOG_MAC_H_
6 #define CHROME_BROWSER_UI_COCOA_TAB_MODAL_CONFIRM_DIALOG_MAC_H_
7
8 #import <Cocoa/Cocoa.h>
9
10 #include "base/memory/scoped_ptr.h"
11 #include "chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h"
12 #include "chrome/browser/ui/tab_modal_confirm_dialog.h"
13
14 @class ConstrainedWindowAlert;
15
16 namespace content {
17 class WebContents;
18 }
19
20 class TabModalConfirmDialogDelegate;
21 @class TabModalConfirmDialogMacBridge;
22
23 // Displays a tab-modal dialog, i.e. a dialog that will block the current page
24 // but still allow the user to switch to a different page.
25 // To display the dialog, allocate this object on the heap. It will open the
26 // dialog from its constructor and then delete itself when the user dismisses
27 // the dialog.
28 class TabModalConfirmDialogMac : public TabModalConfirmDialog,
29                                  public ConstrainedWindowMacDelegate {
30  public:
31   TabModalConfirmDialogMac(TabModalConfirmDialogDelegate* delegate,
32                            content::WebContents* web_contents);
33
34  private:
35   virtual ~TabModalConfirmDialogMac();
36
37   // TabModalConfirmDialog:
38   virtual void AcceptTabModalDialog() OVERRIDE;
39   virtual void CancelTabModalDialog() OVERRIDE;
40
41   // TabModalConfirmDialogCloseDelegate:
42   virtual void CloseDialog() OVERRIDE;
43
44   // ConstrainedWindowMacDelegate:
45   virtual void OnConstrainedWindowClosed(
46       ConstrainedWindowMac* window) OVERRIDE;
47
48   bool closing_;
49
50   scoped_ptr<ConstrainedWindowMac> window_;
51   scoped_ptr<TabModalConfirmDialogDelegate> delegate_;
52   base::scoped_nsobject<ConstrainedWindowAlert> alert_;
53   base::scoped_nsobject<TabModalConfirmDialogMacBridge> bridge_;
54
55   DISALLOW_COPY_AND_ASSIGN(TabModalConfirmDialogMac);
56 };
57
58 #endif  // CHROME_BROWSER_UI_COCOA_TAB_MODAL_CONFIRM_DIALOG_MAC_H_