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 #include <Carbon/Carbon.h> | 5 #include <Carbon/Carbon.h> |
6 | 6 |
7 #include "base/mac_util.h" | 7 #include "base/mac_util.h" |
8 #include "base/scoped_nsdisable_screen_updates.h" | 8 #include "base/scoped_nsdisable_screen_updates.h" |
9 #import "base/scoped_nsobject.h" | 9 #import "base/scoped_nsobject.h" |
10 #include "base/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 | 230 |
231 [super dealloc]; | 231 [super dealloc]; |
232 } | 232 } |
233 | 233 |
234 // Access the C++ bridge between the NSWindow and the rest of Chromium | 234 // Access the C++ bridge between the NSWindow and the rest of Chromium |
235 - (BrowserWindow*)browserWindow { | 235 - (BrowserWindow*)browserWindow { |
236 return windowShim_.get(); | 236 return windowShim_.get(); |
237 } | 237 } |
238 | 238 |
239 - (void)destroyBrowser { | 239 - (void)destroyBrowser { |
| 240 [NSApp removeWindowsItem:[self window]]; |
| 241 |
240 // We need the window to go away now. | 242 // We need the window to go away now. |
241 [self close]; | 243 // We can't actually use |-autorelease| here because there's an embedded |
| 244 // run loop in the |-performClose:| which contains its own autorelease pool. |
| 245 // Instead we use call it after a zero-length delay, which gets us back |
| 246 // to the main event loop. |
| 247 [self performSelector:@selector(autorelease) |
| 248 withObject:nil |
| 249 afterDelay:0]; |
242 } | 250 } |
243 | 251 |
244 // Called when the window meets the criteria to be closed (ie, | 252 // Called when the window meets the criteria to be closed (ie, |
245 // |-windowShouldClose:| returns YES). We must be careful to preserve the | 253 // |-windowShouldClose:| returns YES). We must be careful to preserve the |
246 // semantics of BrowserWindow::Close() and not call the Browser's dtor directly | 254 // semantics of BrowserWindow::Close() and not call the Browser's dtor directly |
247 // from this method. | 255 // from this method. |
248 - (void)windowWillClose:(NSNotification*)notification { | 256 - (void)windowWillClose:(NSNotification*)notification { |
249 DCHECK_EQ([notification object], [self window]); | 257 DCHECK_EQ([notification object], [self window]); |
250 DCHECK(!browser_->tabstrip_model()->count()); | 258 DCHECK(!browser_->tabstrip_model()->count()); |
251 [savedRegularWindow_ close]; | 259 [savedRegularWindow_ close]; |
252 [bookmarkBubbleController_ close]; | 260 [bookmarkBubbleController_ close]; |
253 // We delete statusBubble here because we need to kill off the dependency | 261 // We delete statusBubble here because we need to kill off the dependency |
254 // that its window has on our window before our window goes away. | 262 // that its window has on our window before our window goes away. |
255 delete statusBubble_; | 263 delete statusBubble_; |
256 statusBubble_ = NULL; | 264 statusBubble_ = NULL; |
257 [self autorelease]; | 265 // We can't actually use |-autorelease| here because there's an embedded |
| 266 // run loop in the |-performClose:| which contains its own autorelease pool. |
| 267 // Instead we call it after a zero-length delay, which gets us back |
| 268 // to the main event loop. |
| 269 [self performSelector:@selector(autorelease) |
| 270 withObject:nil |
| 271 afterDelay:0]; |
258 } | 272 } |
259 | 273 |
260 - (void)attachConstrainedWindow:(ConstrainedWindowMac*)window { | 274 - (void)attachConstrainedWindow:(ConstrainedWindowMac*)window { |
261 [tabStripController_ attachConstrainedWindow:window]; | 275 [tabStripController_ attachConstrainedWindow:window]; |
262 } | 276 } |
263 | 277 |
264 - (void)removeConstrainedWindow:(ConstrainedWindowMac*)window { | 278 - (void)removeConstrainedWindow:(ConstrainedWindowMac*)window { |
265 [tabStripController_ removeConstrainedWindow:window]; | 279 [tabStripController_ removeConstrainedWindow:window]; |
266 } | 280 } |
267 | 281 |
(...skipping 1252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1520 if (frameOverlayInactiveImage) { | 1534 if (frameOverlayInactiveImage) { |
1521 [theme setValue:frameOverlayInactiveImage | 1535 [theme setValue:frameOverlayInactiveImage |
1522 forAttribute:@"overlay" | 1536 forAttribute:@"overlay" |
1523 style:GTMThemeStyleWindow | 1537 style:GTMThemeStyleWindow |
1524 state:GTMThemeStateInactiveWindow]; | 1538 state:GTMThemeStateInactiveWindow]; |
1525 } | 1539 } |
1526 | 1540 |
1527 return theme; | 1541 return theme; |
1528 } | 1542 } |
1529 @end | 1543 @end |
OLD | NEW |