OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_COCOA_CONSTRAINED_WINDOW_MAC_H_ | 5 #ifndef CHROME_BROWSER_COCOA_CONSTRAINED_WINDOW_MAC_H_ |
6 #define CHROME_BROWSER_COCOA_CONSTRAINED_WINDOW_MAC_H_ | 6 #define CHROME_BROWSER_COCOA_CONSTRAINED_WINDOW_MAC_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #import <Cocoa/Cocoa.h> | 9 #import <Cocoa/Cocoa.h> |
10 | 10 |
11 #include "chrome/browser/tab_contents/constrained_window.h" | 11 #include "chrome/browser/tab_contents/constrained_window.h" |
12 | 12 |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "base/logging.h" | |
15 #include "base/scoped_nsobject.h" | 14 #include "base/scoped_nsobject.h" |
16 | 15 |
17 @class BrowserWindowController; | 16 @class BrowserWindowController; |
18 @class GTMWindowSheetController; | 17 @class GTMWindowSheetController; |
19 @class NSView; | 18 @class NSView; |
20 @class NSWindow; | 19 @class NSWindow; |
21 class TabContents; | 20 class TabContents; |
22 | 21 |
23 // Base class for constrained dialog delegates. Never inherit from this | 22 // Base class for constrained dialog delegates. Never inherit from this |
24 // directly. | 23 // directly. |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 delegate_(nil), | 87 delegate_(nil), |
89 didEndSelector_(NULL) { } | 88 didEndSelector_(NULL) { } |
90 | 89 |
91 ConstrainedWindowMacDelegateCustomSheet(id delegate, SEL didEndSelector) | 90 ConstrainedWindowMacDelegateCustomSheet(id delegate, SEL didEndSelector) |
92 : customSheet_(nil), | 91 : customSheet_(nil), |
93 delegate_([delegate retain]), | 92 delegate_([delegate retain]), |
94 didEndSelector_(didEndSelector) { } | 93 didEndSelector_(didEndSelector) { } |
95 | 94 |
96 protected: | 95 protected: |
97 // For when you need to delay initalization after the constructor call. | 96 // For when you need to delay initalization after the constructor call. |
98 void init(NSWindow* sheet, id delegate, SEL didEndSelector) { | 97 void init(NSWindow* sheet, id delegate, SEL didEndSelector); |
99 DCHECK(!delegate_.get()); | |
100 DCHECK(!didEndSelector_); | |
101 customSheet_.reset([sheet retain]); | |
102 delegate_.reset([delegate retain]); | |
103 didEndSelector_ = didEndSelector; | |
104 DCHECK(delegate_.get()); | |
105 DCHECK(didEndSelector_); | |
106 } | |
107 void set_sheet(NSWindow* sheet) { customSheet_.reset([sheet retain]); } | 98 void set_sheet(NSWindow* sheet) { customSheet_.reset([sheet retain]); } |
108 NSWindow* sheet() { return customSheet_; } | 99 NSWindow* sheet() { return customSheet_; } |
109 | 100 |
110 private: | 101 private: |
111 virtual void RunSheet(GTMWindowSheetController* sheetController, | 102 virtual void RunSheet(GTMWindowSheetController* sheetController, |
112 NSView* view); | 103 NSView* view); |
113 scoped_nsobject<NSWindow> customSheet_; | 104 scoped_nsobject<NSWindow> customSheet_; |
114 scoped_nsobject<id> delegate_; | 105 scoped_nsobject<id> delegate_; |
115 SEL didEndSelector_; | 106 SEL didEndSelector_; |
116 }; | 107 }; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 // Controller of the window that contains this sheet. | 146 // Controller of the window that contains this sheet. |
156 BrowserWindowController* controller_; | 147 BrowserWindowController* controller_; |
157 | 148 |
158 // Stores if |ShowConstrainedWindow()| was called. | 149 // Stores if |ShowConstrainedWindow()| was called. |
159 bool should_be_visible_; | 150 bool should_be_visible_; |
160 | 151 |
161 DISALLOW_COPY_AND_ASSIGN(ConstrainedWindowMac); | 152 DISALLOW_COPY_AND_ASSIGN(ConstrainedWindowMac); |
162 }; | 153 }; |
163 | 154 |
164 #endif // CHROME_BROWSER_COCOA_CONSTRAINED_WINDOW_MAC_H_ | 155 #endif // CHROME_BROWSER_COCOA_CONSTRAINED_WINDOW_MAC_H_ |
165 | |
OLD | NEW |