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 "chrome/browser/ui/cocoa/web_contents_modal_dialog_manager_cocoa.h" | |
11 #include "components/web_modal/native_web_contents_modal_dialog.h" | 12 #include "components/web_modal/native_web_contents_modal_dialog.h" |
12 | 13 |
13 namespace content { | 14 namespace content { |
14 class WebContents; | 15 class WebContents; |
15 } | 16 } |
16 class ConstrainedWindowMac; | 17 class ConstrainedWindowMac; |
17 @protocol ConstrainedWindowSheet; | 18 @protocol ConstrainedWindowSheet; |
18 | 19 |
19 // 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 |
20 // window closes. | 21 // window closes. |
21 class ConstrainedWindowMacDelegate { | 22 class ConstrainedWindowMacDelegate { |
22 public: | 23 public: |
23 virtual void OnConstrainedWindowClosed(ConstrainedWindowMac* window) = 0; | 24 virtual void OnConstrainedWindowClosed(ConstrainedWindowMac* window) = 0; |
24 }; | 25 }; |
25 | 26 |
26 // Constrained window implementation for Mac. | 27 // Constrained window implementation for Mac. |
27 // Normally an instance of this class is owned by the delegate. The delegate | 28 // Normally an instance of this class is owned by the delegate. The delegate |
28 // should delete the instance when the window is closed. | 29 // should delete the instance when the window is closed. |
29 class ConstrainedWindowMac { | 30 class ConstrainedWindowMac : |
31 public WebContentsModalDialogManagerCocoa::Observer { | |
30 public: | 32 public: |
31 ConstrainedWindowMac( | 33 ConstrainedWindowMac(ConstrainedWindowMacDelegate* delegate, |
32 ConstrainedWindowMacDelegate* delegate, | 34 content::WebContents* web_contents, |
33 content::WebContents* web_contents, | 35 id<ConstrainedWindowSheet> sheet); |
34 id<ConstrainedWindowSheet> sheet); | 36 ~ConstrainedWindowMac() override; |
35 virtual ~ConstrainedWindowMac(); | |
36 | 37 |
37 void ShowWebContentsModalDialog(); | 38 // Closes the constrained window. |
38 // Closes the constrained window and deletes this instance. | |
39 void CloseWebContentsModalDialog(); | 39 void CloseWebContentsModalDialog(); |
40 void FocusWebContentsModalDialog(); | 40 |
41 void PulseWebContentsModalDialog(); | 41 // WebContentsModalDialogManagerCocoa::Observer overrides. |
42 web_modal::NativeWebContentsModalDialog GetNativeDialog(); | 42 void OnDialogClosing() override; |
43 | 43 |
44 private: | 44 private: |
45 ConstrainedWindowMacDelegate* delegate_; // weak, owns us. | 45 ConstrainedWindowMacDelegate* delegate_; // weak, owns us. |
46 | 46 |
47 // The WebContents that owns and constrains this ConstrainedWindowMac. Weak. | 47 // The WebContents that owns and constrains this ConstrainedWindowMac. Weak. |
48 content::WebContents* web_contents_; | 48 content::WebContents* web_contents_; |
49 | 49 |
50 base::scoped_nsprotocol<id<ConstrainedWindowSheet>> sheet_; | 50 base::scoped_nsprotocol<id<ConstrainedWindowSheet>> sheet_; |
tapted
2015/02/26 23:34:48
is this still needed?
Andre
2015/03/02 02:55:55
Deleted.
| |
51 | 51 |
52 // This is true if the constrained window has been shown. | 52 // Weak. Owned by WebContentsModalDialogManager. |
53 bool shown_; | 53 WebContentsModalDialogManagerCocoa* native_manager_; |
54 }; | 54 }; |
55 | 55 |
56 #endif // CHROME_BROWSER_UI_COCOA_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_MAC_ | 56 #endif // CHROME_BROWSER_UI_COCOA_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_MAC_ |
OLD | NEW |