Popular sites on the NTP: check that experiment group StartsWith (rather than IS...
[chromium-blink-merge.git] / chrome / browser / ui / cocoa / constrained_window / constrained_window_mac.h
blobe3d981edd473d5ba63b33dffd050956c2b3e3fe3
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_COCOA_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_MAC_
6 #define CHROME_BROWSER_UI_COCOA_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_MAC_
8 #import <Cocoa/Cocoa.h>
10 namespace content {
11 class WebContents;
13 class ConstrainedWindowMac;
14 class SingleWebContentsDialogManagerCocoa;
15 @protocol ConstrainedWindowSheet;
17 // A delegate for a constrained window. The delegate is notified when the
18 // window closes.
19 class ConstrainedWindowMacDelegate {
20 public:
21 virtual void OnConstrainedWindowClosed(ConstrainedWindowMac* window) = 0;
24 // Constrained window implementation for Mac.
25 // Normally an instance of this class is owned by the delegate. The delegate
26 // should delete the instance when the window is closed.
27 class ConstrainedWindowMac {
28 public:
29 ConstrainedWindowMac(ConstrainedWindowMacDelegate* delegate,
30 content::WebContents* web_contents,
31 id<ConstrainedWindowSheet> sheet);
32 ~ConstrainedWindowMac();
34 // Closes the constrained window.
35 void CloseWebContentsModalDialog();
37 SingleWebContentsDialogManagerCocoa* manager() const { return manager_; }
38 void set_manager(SingleWebContentsDialogManagerCocoa* manager) {
39 manager_ = manager;
42 // Called by |manager_| when the dialog is closing.
43 void OnDialogClosing();
45 private:
46 ConstrainedWindowMacDelegate* delegate_; // weak, owns us.
47 SingleWebContentsDialogManagerCocoa* manager_; // weak, owned by WCMDM.
50 #endif // CHROME_BROWSER_UI_COCOA_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_MAC_