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 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 424 [tabStripController_ browserWillBeDestroyed]; | 424 [tabStripController_ browserWillBeDestroyed]; |
| 425 [findBarCocoaController_ browserWillBeDestroyed]; | 425 [findBarCocoaController_ browserWillBeDestroyed]; |
| 426 [downloadShelfController_ browserWillBeDestroyed]; | 426 [downloadShelfController_ browserWillBeDestroyed]; |
| 427 [bookmarkBarController_ browserWillBeDestroyed]; | 427 [bookmarkBarController_ browserWillBeDestroyed]; |
| 428 [avatarButtonController_ browserWillBeDestroyed]; | 428 [avatarButtonController_ browserWillBeDestroyed]; |
| 429 [bookmarkBubbleController_ browserWillBeDestroyed]; | 429 [bookmarkBubbleController_ browserWillBeDestroyed]; |
| 430 | 430 |
| 431 [super dealloc]; | 431 [super dealloc]; |
| 432 } | 432 } |
| 433 | 433 |
| 434 // Hack to address crbug.com/667274 | |
| 435 // On TouchBar MacBooks, the touch bar machinery retains a reference | |
| 436 // to the browser window controller (which is an NSTouchBarProvider by | |
| 437 // default) but doesn't release it if Chrome quits before it takes the | |
| 438 // key window (for example, quitting from the Dock icon context menu.) | |
| 439 // | |
| 440 // If the window denies being a touch bar provider, it's never added | |
| 441 // to the set of providers and the reference is never taken. This | |
| 442 // prevents us from providing a touch bar from the window directly | |
| 443 // but descendant responders can still provide one. | |
| 444 // | |
| 445 // TODO(lgrey): Add radar here once it's been filed. | |
| 446 - (BOOL)conformsToProtocol:(Protocol* )protocol { | |
|
Robert Sesek
2016/12/01 21:23:05
nit: extra space after *
| |
| 447 if ([protocol isEqual:NSProtocolFromString(@"NSFunctionBarProvider")] || | |
| 448 [protocol isEqual:NSProtocolFromString(@"NSTouchBarProvider")]) { | |
| 449 return NO; | |
| 450 } | |
| 451 return [super conformsToProtocol:protocol]; | |
| 452 } | |
| 453 | |
| 434 - (gfx::Rect)enforceMinWindowSize:(gfx::Rect)bounds { | 454 - (gfx::Rect)enforceMinWindowSize:(gfx::Rect)bounds { |
| 435 gfx::Rect checkedBounds = bounds; | 455 gfx::Rect checkedBounds = bounds; |
| 436 | 456 |
| 437 NSSize minSize = [[self window] minSize]; | 457 NSSize minSize = [[self window] minSize]; |
| 438 if (bounds.width() < minSize.width) | 458 if (bounds.width() < minSize.width) |
| 439 checkedBounds.set_width(minSize.width); | 459 checkedBounds.set_width(minSize.width); |
| 440 if (bounds.height() < minSize.height) | 460 if (bounds.height() < minSize.height) |
| 441 checkedBounds.set_height(minSize.height); | 461 checkedBounds.set_height(minSize.height); |
| 442 | 462 |
| 443 return checkedBounds; | 463 return checkedBounds; |
| (...skipping 1531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1975 | 1995 |
| 1976 - (NSRect)savedRegularWindowFrame { | 1996 - (NSRect)savedRegularWindowFrame { |
| 1977 return savedRegularWindowFrame_; | 1997 return savedRegularWindowFrame_; |
| 1978 } | 1998 } |
| 1979 | 1999 |
| 1980 - (BOOL)isFullscreenTransitionInProgress { | 2000 - (BOOL)isFullscreenTransitionInProgress { |
| 1981 return enteringAppKitFullscreen_ || exitingAppKitFullscreen_; | 2001 return enteringAppKitFullscreen_ || exitingAppKitFullscreen_; |
| 1982 } | 2002 } |
| 1983 | 2003 |
| 1984 @end // @implementation BrowserWindowController(WindowType) | 2004 @end // @implementation BrowserWindowController(WindowType) |
| OLD | NEW |