| 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 #import "chrome/browser/cocoa/toolbar_controller.h" | 5 #import "chrome/browser/cocoa/toolbar_controller.h" |
| 6 | 6 |
| 7 #include "app/l10n_util_mac.h" | 7 #include "app/l10n_util_mac.h" |
| 8 #include "base/mac_util.h" | 8 #include "base/mac_util.h" |
| 9 #include "base/nsimage_cache_mac.h" | 9 #include "base/nsimage_cache_mac.h" |
| 10 #include "base/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 NSRect locationFrame = [locationBar_ frame]; | 510 NSRect locationFrame = [locationBar_ frame]; |
| 511 locationFrame.size.width += dX; | 511 locationFrame.size.width += dX; |
| 512 [locationBar_ setFrame:locationFrame]; | 512 [locationBar_ setFrame:locationFrame]; |
| 513 } | 513 } |
| 514 | 514 |
| 515 - (NSRect)starButtonInWindowCoordinates { | 515 - (NSRect)starButtonInWindowCoordinates { |
| 516 return [[[starButton_ window] contentView] convertRect:[starButton_ bounds] | 516 return [[[starButton_ window] contentView] convertRect:[starButton_ bounds] |
| 517 fromView:starButton_]; | 517 fromView:starButton_]; |
| 518 } | 518 } |
| 519 | 519 |
| 520 - (void)setHeightCompression:(CGFloat)compressByHeight { | 520 - (CGFloat)desiredHeightForCompression:(CGFloat)compressByHeight { |
| 521 // Resize. | 521 return kBaseToolbarHeight - compressByHeight; |
| 522 CGFloat newToolbarHeight = kBaseToolbarHeight - compressByHeight; | |
| 523 [resizeDelegate_ resizeView:[self view] newHeight:newToolbarHeight]; | |
| 524 } | 522 } |
| 525 | 523 |
| 526 - (void)setDividerOpacity:(CGFloat)opacity { | 524 - (void)setDividerOpacity:(CGFloat)opacity { |
| 527 BackgroundGradientView* view = [self backgroundGradientView]; | 525 BackgroundGradientView* view = [self backgroundGradientView]; |
| 528 [view setShowsDivider:(opacity > 0 ? YES : NO)]; | 526 [view setShowsDivider:(opacity > 0 ? YES : NO)]; |
| 529 | 527 |
| 530 // We may not have a toolbar view (e.g., popup windows only have a location | 528 // We may not have a toolbar view (e.g., popup windows only have a location |
| 531 // bar). | 529 // bar). |
| 532 if ([view isKindOfClass:[ToolbarView class]]) { | 530 if ([view isKindOfClass:[ToolbarView class]]) { |
| 533 ToolbarView* toolbarView = (ToolbarView*)view; | 531 ToolbarView* toolbarView = (ToolbarView*)view; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 | 601 |
| 604 NSRect r = NSMakeRect(minX, NSMinY(locationFrame), maxX - minX, | 602 NSRect r = NSMakeRect(minX, NSMinY(locationFrame), maxX - minX, |
| 605 NSHeight(locationFrame)); | 603 NSHeight(locationFrame)); |
| 606 gfx::Rect stack_bounds( | 604 gfx::Rect stack_bounds( |
| 607 NSRectToCGRect([[self view] convertRect:r toView:nil])); | 605 NSRectToCGRect([[self view] convertRect:r toView:nil])); |
| 608 // Inset the bounds to just inside the visible edges (see comment above). | 606 // Inset the bounds to just inside the visible edges (see comment above). |
| 609 stack_bounds.Inset(kLocationStackEdgeWidth, 0); | 607 stack_bounds.Inset(kLocationStackEdgeWidth, 0); |
| 610 return stack_bounds; | 608 return stack_bounds; |
| 611 } | 609 } |
| 612 @end | 610 @end |
| OLD | NEW |