| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/framed_browser_window.h" | 5 #import "chrome/browser/ui/cocoa/framed_browser_window.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 #include <objc/runtime.h> | 8 #include <objc/runtime.h> |
| 9 #include <stddef.h> | 9 #include <stddef.h> |
| 10 | 10 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 // - close/min in the background don't bring the window forward | 33 // - close/min in the background don't bring the window forward |
| 34 // - rollover effects work correctly | 34 // - rollover effects work correctly |
| 35 | 35 |
| 36 // The NSLayoutConstraint class hierarchy only exists in the 10.11 SDK. When | 36 // The NSLayoutConstraint class hierarchy only exists in the 10.11 SDK. When |
| 37 // targeting something lower, constraintEqualToAnchor:constant: needs to be | 37 // targeting something lower, constraintEqualToAnchor:constant: needs to be |
| 38 // invoked using duck typing. | 38 // invoked using duck typing. |
| 39 #if !defined(MAC_OS_X_VERSION_10_11) || \ | 39 #if !defined(MAC_OS_X_VERSION_10_11) || \ |
| 40 MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_11 | 40 MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_11 |
| 41 @interface NSObject (NSLayoutConstraint) | 41 @interface NSObject (NSLayoutConstraint) |
| 42 - (NSLayoutConstraint*)constraintEqualToAnchor:(id)anchor constant:(CGFloat)c; | 42 - (NSLayoutConstraint*)constraintEqualToAnchor:(id)anchor constant:(CGFloat)c; |
| 43 - (NSLayoutConstraint*)constraintEqualToAnchor:(id)anchor; |
| 43 @end | 44 @end |
| 44 #endif | 45 #endif |
| 45 | 46 |
| 46 namespace { | 47 namespace { |
| 47 | 48 |
| 48 // Size of the gradient. Empirically determined so that the gradient looks | 49 // Size of the gradient. Empirically determined so that the gradient looks |
| 49 // like what the heuristic does when there are just a few tabs. | 50 // like what the heuristic does when there are just a few tabs. |
| 50 const CGFloat kWindowGradientHeight = 24.0; | 51 const CGFloat kWindowGradientHeight = 24.0; |
| 51 | 52 |
| 52 } | 53 } |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 | 279 |
| 279 #if !defined(MAC_OS_X_VERSION_10_11) || \ | 280 #if !defined(MAC_OS_X_VERSION_10_11) || \ |
| 280 MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_11 | 281 MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_11 |
| 281 id leadingSourceAnchorDuck = leadingSourceAnchor; | 282 id leadingSourceAnchorDuck = leadingSourceAnchor; |
| 282 #else | 283 #else |
| 283 NSLayoutXAxisAnchor* leadingSourceAnchorDuck = leadingSourceAnchor; | 284 NSLayoutXAxisAnchor* leadingSourceAnchorDuck = leadingSourceAnchor; |
| 284 #endif | 285 #endif |
| 285 [[leadingSourceAnchorDuck constraintEqualToAnchor:leadingTargetAnchor | 286 [[leadingSourceAnchorDuck constraintEqualToAnchor:leadingTargetAnchor |
| 286 constant:leadingOffset] | 287 constant:leadingOffset] |
| 287 setActive:YES]; | 288 setActive:YES]; |
| 289 |
| 290 [[[button bottomAnchor] |
| 291 constraintEqualToAnchor:[[button superview] bottomAnchor]] |
| 292 setActive:YES]; |
| 288 } | 293 } |
| 289 | 294 |
| 290 - (void)adjustCloseButton:(NSNotification*)notification { | 295 - (void)adjustCloseButton:(NSNotification*)notification { |
| 291 [self adjustButton:[notification object] | 296 [self adjustButton:[notification object] |
| 292 ofKind:NSWindowCloseButton]; | 297 ofKind:NSWindowCloseButton]; |
| 293 } | 298 } |
| 294 | 299 |
| 295 - (void)adjustMiniaturizeButton:(NSNotification*)notification { | 300 - (void)adjustMiniaturizeButton:(NSNotification*)notification { |
| 296 [self adjustButton:[notification object] | 301 [self adjustButton:[notification object] |
| 297 ofKind:NSWindowMiniaturizeButton]; | 302 ofKind:NSWindowMiniaturizeButton]; |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 [self childWindowsDidChange]; | 521 [self childWindowsDidChange]; |
| 517 } | 522 } |
| 518 | 523 |
| 519 - (void)childWindowsDidChange { | 524 - (void)childWindowsDidChange { |
| 520 id delegate = [self delegate]; | 525 id delegate = [self delegate]; |
| 521 if ([delegate respondsToSelector:@selector(childWindowsDidChange)]) | 526 if ([delegate respondsToSelector:@selector(childWindowsDidChange)]) |
| 522 [delegate childWindowsDidChange]; | 527 [delegate childWindowsDidChange]; |
| 523 } | 528 } |
| 524 | 529 |
| 525 @end | 530 @end |
| OLD | NEW |