Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 5 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 #include <numeric> | 8 #include <numeric> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 523 afterDelay:0]; | 523 afterDelay:0]; |
| 524 } | 524 } |
| 525 | 525 |
| 526 // Called when the window meets the criteria to be closed (ie, | 526 // Called when the window meets the criteria to be closed (ie, |
| 527 // |-windowShouldClose:| returns YES). We must be careful to preserve the | 527 // |-windowShouldClose:| returns YES). We must be careful to preserve the |
| 528 // semantics of BrowserWindow::Close() and not call the Browser's dtor directly | 528 // semantics of BrowserWindow::Close() and not call the Browser's dtor directly |
| 529 // from this method. | 529 // from this method. |
| 530 - (void)windowWillClose:(NSNotification*)notification { | 530 - (void)windowWillClose:(NSNotification*)notification { |
| 531 DCHECK_EQ([notification object], [self window]); | 531 DCHECK_EQ([notification object], [self window]); |
| 532 DCHECK(browser_->tab_strip_model()->empty()); | 532 DCHECK(browser_->tab_strip_model()->empty()); |
| 533 windowShim_->OnWindowWillClose(); | |
| 533 [savedRegularWindow_ close]; | 534 [savedRegularWindow_ close]; |
| 534 // We delete statusBubble here because we need to kill off the dependency | 535 // We delete statusBubble here because we need to kill off the dependency |
| 535 // that its window has on our window before our window goes away. | 536 // that its window has on our window before our window goes away. |
| 536 delete statusBubble_; | 537 delete statusBubble_; |
| 537 statusBubble_ = NULL; | 538 statusBubble_ = NULL; |
| 538 // We can't actually use |-autorelease| here because there's an embedded | 539 // We can't actually use |-autorelease| here because there's an embedded |
| 539 // run loop in the |-performClose:| which contains its own autorelease pool. | 540 // run loop in the |-performClose:| which contains its own autorelease pool. |
| 540 // Instead call it after a zero-length delay, which gets us back to the main | 541 // Instead call it after a zero-length delay, which gets us back to the main |
| 541 // event loop. | 542 // event loop. |
| 542 [self performSelector:@selector(autorelease) | 543 [self performSelector:@selector(autorelease) |
| 543 withObject:nil | 544 withObject:nil |
| 544 afterDelay:0]; | 545 afterDelay:0]; |
| 545 } | 546 } |
|
Robert Sesek
2016/06/07 16:43:35
What about:
[[self window] performSelector:@selec
tapted
2016/06/08 00:00:29
So with this approach, I get a "guaranteed" double
tapted
2016/06/08 00:07:42
Ah - derp. No this is actually just a boring old d
Robert Sesek
2016/06/08 00:09:00
That makes sense, actually. What I wrote would be
| |
| 546 | 547 |
| 547 - (void)updateDevToolsForContents:(WebContents*)contents { | 548 - (void)updateDevToolsForContents:(WebContents*)contents { |
| 548 BOOL layout_changed = | 549 BOOL layout_changed = |
| 549 [devToolsController_ updateDevToolsForWebContents:contents | 550 [devToolsController_ updateDevToolsForWebContents:contents |
| 550 withProfile:browser_->profile()]; | 551 withProfile:browser_->profile()]; |
| 551 if (layout_changed && [findBarCocoaController_ isFindBarVisible]) | 552 if (layout_changed && [findBarCocoaController_ isFindBarVisible]) |
| 552 [self layoutSubviews]; | 553 [self layoutSubviews]; |
| 553 } | 554 } |
| 554 | 555 |
| 555 // Called when the user wants to close a window or from the shutdown process. | 556 // Called when the user wants to close a window or from the shutdown process. |
| (...skipping 1500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2056 | 2057 |
| 2057 - (BOOL)isTabbedWindow { | 2058 - (BOOL)isTabbedWindow { |
| 2058 return browser_->is_type_tabbed(); | 2059 return browser_->is_type_tabbed(); |
| 2059 } | 2060 } |
| 2060 | 2061 |
| 2061 - (NSRect)savedRegularWindowFrame { | 2062 - (NSRect)savedRegularWindowFrame { |
| 2062 return savedRegularWindowFrame_; | 2063 return savedRegularWindowFrame_; |
| 2063 } | 2064 } |
| 2064 | 2065 |
| 2065 @end // @implementation BrowserWindowController(WindowType) | 2066 @end // @implementation BrowserWindowController(WindowType) |
| OLD | NEW |