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_COCOA_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_MAC_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_MAC_ |
6 #define CHROME_BROWSER_UI_COCOA_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_MAC_ | 6 #define CHROME_BROWSER_UI_COCOA_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_MAC_ |
7 | 7 |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 | 9 |
10 #include "base/mac/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
11 #include "components/web_modal/web_contents_modal_dialog_manager.h" | 11 #include "components/web_modal/web_contents_modal_dialog_manager.h" |
12 | 12 |
13 namespace content { | 13 namespace content { |
14 class WebContents; | 14 class WebContents; |
15 } | 15 } |
16 class ConstrainedWindowMac; | 16 class ConstrainedWindowMac; |
17 class SingleWebContentsDialogManagerCocoa; | 17 class SingleWebContentsDialogManagerCocoa; |
18 @protocol ConstrainedWindowSheet; | 18 @protocol ConstrainedWindowSheet; |
19 | 19 |
20 // A delegate for a constrained window. The delegate is notified when the | 20 // A delegate for a constrained window. The delegate is notified when the |
21 // window closes. | 21 // window closes. |
22 class ConstrainedWindowMacDelegate { | 22 class ConstrainedWindowMacDelegate { |
23 public: | 23 public: |
24 virtual void OnConstrainedWindowClosed(ConstrainedWindowMac* window) = 0; | 24 virtual void OnConstrainedWindowClosed(ConstrainedWindowMac* window) = 0; |
25 }; | 25 }; |
26 | 26 |
27 // Creates a ConstrainedWindowMac, shows the dialog, and returns it. | 27 // Creates a ConstrainedWindowMac, shows the dialog, and returns it. |
28 scoped_ptr<ConstrainedWindowMac> CreateAndShowWebModalDialogMac( | 28 std::unique_ptr<ConstrainedWindowMac> CreateAndShowWebModalDialogMac( |
29 ConstrainedWindowMacDelegate* delegate, | 29 ConstrainedWindowMacDelegate* delegate, |
30 content::WebContents* web_contents, | 30 content::WebContents* web_contents, |
31 id<ConstrainedWindowSheet> sheet); | 31 id<ConstrainedWindowSheet> sheet); |
32 | 32 |
33 // Creates a ConstrainedWindowMac and returns it. | 33 // Creates a ConstrainedWindowMac and returns it. |
34 scoped_ptr<ConstrainedWindowMac> CreateWebModalDialogMac( | 34 std::unique_ptr<ConstrainedWindowMac> CreateWebModalDialogMac( |
35 ConstrainedWindowMacDelegate* delegate, | 35 ConstrainedWindowMacDelegate* delegate, |
36 content::WebContents* web_contents, | 36 content::WebContents* web_contents, |
37 id<ConstrainedWindowSheet> sheet); | 37 id<ConstrainedWindowSheet> sheet); |
38 | 38 |
39 // Constrained window implementation for Mac. | 39 // Constrained window implementation for Mac. |
40 // Normally an instance of this class is owned by the delegate. The delegate | 40 // Normally an instance of this class is owned by the delegate. The delegate |
41 // should delete the instance when the window is closed. | 41 // should delete the instance when the window is closed. |
42 class ConstrainedWindowMac { | 42 class ConstrainedWindowMac { |
43 public: | 43 public: |
44 ConstrainedWindowMac(ConstrainedWindowMacDelegate* delegate, | 44 ConstrainedWindowMac(ConstrainedWindowMacDelegate* delegate, |
(...skipping 21 matching lines...) Expand all Loading... |
66 bool DialogWasShown(); | 66 bool DialogWasShown(); |
67 | 67 |
68 // Gets the dialog manager for |web_contents_|. | 68 // Gets the dialog manager for |web_contents_|. |
69 web_modal::WebContentsModalDialogManager* GetDialogManager(); | 69 web_modal::WebContentsModalDialogManager* GetDialogManager(); |
70 | 70 |
71 private: | 71 private: |
72 ConstrainedWindowMacDelegate* delegate_; // weak, owns us. | 72 ConstrainedWindowMacDelegate* delegate_; // weak, owns us. |
73 SingleWebContentsDialogManagerCocoa* manager_; // weak, owned by WCMDM. | 73 SingleWebContentsDialogManagerCocoa* manager_; // weak, owned by WCMDM. |
74 content::WebContents* web_contents_; // weak, owned by dialog initiator. | 74 content::WebContents* web_contents_; // weak, owned by dialog initiator. |
75 base::scoped_nsprotocol<id<ConstrainedWindowSheet>> sheet_; | 75 base::scoped_nsprotocol<id<ConstrainedWindowSheet>> sheet_; |
76 scoped_ptr<SingleWebContentsDialogManagerCocoa> native_manager_; | 76 std::unique_ptr<SingleWebContentsDialogManagerCocoa> native_manager_; |
77 }; | 77 }; |
78 | 78 |
79 #endif // CHROME_BROWSER_UI_COCOA_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_MAC_ | 79 #endif // CHROME_BROWSER_UI_COCOA_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_MAC_ |
OLD | NEW |