| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 | 7 |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 | 9 |
| 10 #include "chrome/browser/tab_contents/constrained_window.h" | 10 #include "chrome/browser/tab_contents/constrained_window.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 scoped_nsobject<id> systemSheet_; | 64 scoped_nsobject<id> systemSheet_; |
| 65 scoped_nsobject<id> delegate_; | 65 scoped_nsobject<id> delegate_; |
| 66 SEL didEndSelector_; | 66 SEL didEndSelector_; |
| 67 }; | 67 }; |
| 68 | 68 |
| 69 // Subclass this for a dialog delegate that displays a custom sheet, e.g. loaded | 69 // Subclass this for a dialog delegate that displays a custom sheet, e.g. loaded |
| 70 // from a nib file. | 70 // from a nib file. |
| 71 class ConstrainedWindowMacDelegateCustomSheet | 71 class ConstrainedWindowMacDelegateCustomSheet |
| 72 : public ConstrainedWindowMacDelegate { | 72 : public ConstrainedWindowMacDelegate { |
| 73 public: | 73 public: |
| 74 ConstrainedWindowMacDelegateCustomSheet( | 74 ConstrainedWindowMacDelegateCustomSheet() |
| 75 NSWindow* customSheet, id delegate, SEL didEndSelector) | 75 : customSheet_(nil), |
| 76 delegate_(nil), |
| 77 didEndSelector_(NULL) { } |
| 78 |
| 79 ConstrainedWindowMacDelegateCustomSheet(id delegate, SEL didEndSelector) |
| 76 : customSheet_(nil), | 80 : customSheet_(nil), |
| 77 delegate_([delegate retain]), | 81 delegate_([delegate retain]), |
| 78 didEndSelector_(didEndSelector) { } | 82 didEndSelector_(didEndSelector) { } |
| 79 | 83 |
| 80 protected: | 84 protected: |
| 85 // For when you need to delay initalization after the constructor call. |
| 86 void init(NSWindow* sheet, id delegate, SEL didEndSelector) { |
| 87 DCHECK(!delegate_.get()); |
| 88 DCHECK(!didEndSelector_); |
| 89 customSheet_.reset([sheet retain]); |
| 90 delegate_.reset([delegate retain]); |
| 91 didEndSelector_ = didEndSelector; |
| 92 DCHECK(delegate_.get()); |
| 93 DCHECK(didEndSelector_); |
| 94 } |
| 81 void set_sheet(NSWindow* sheet) { customSheet_.reset([sheet retain]); } | 95 void set_sheet(NSWindow* sheet) { customSheet_.reset([sheet retain]); } |
| 82 NSWindow* sheet() { return customSheet_; } | 96 NSWindow* sheet() { return customSheet_; } |
| 83 | 97 |
| 84 private: | 98 private: |
| 85 virtual void RunSheet(GTMWindowSheetController* sheetController, | 99 virtual void RunSheet(GTMWindowSheetController* sheetController, |
| 86 NSView* view); | 100 NSView* view); |
| 87 scoped_nsobject<NSWindow> customSheet_; | 101 scoped_nsobject<NSWindow> customSheet_; |
| 88 scoped_nsobject<id> delegate_; | 102 scoped_nsobject<id> delegate_; |
| 89 SEL didEndSelector_; | 103 SEL didEndSelector_; |
| 90 }; | 104 }; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 ConstrainedWindowMacDelegate* delegate_; | 140 ConstrainedWindowMacDelegate* delegate_; |
| 127 | 141 |
| 128 // Controller of the window that contains this sheet. | 142 // Controller of the window that contains this sheet. |
| 129 BrowserWindowController* controller_; | 143 BrowserWindowController* controller_; |
| 130 | 144 |
| 131 DISALLOW_COPY_AND_ASSIGN(ConstrainedWindowMac); | 145 DISALLOW_COPY_AND_ASSIGN(ConstrainedWindowMac); |
| 132 }; | 146 }; |
| 133 | 147 |
| 134 #endif // CHROME_BROWSER_COCOA_CONSTRAINED_WINDOW_MAC_H_ | 148 #endif // CHROME_BROWSER_COCOA_CONSTRAINED_WINDOW_MAC_H_ |
| 135 | 149 |
| OLD | NEW |