| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "app/l10n_util_mac.h" | 9 #include "app/l10n_util_mac.h" |
| 10 #include "base/mac_util.h" | 10 #include "base/mac_util.h" |
| (...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 664 [self adjustLocationAndGoPositionsBy: | 664 [self adjustLocationAndGoPositionsBy: |
| 665 [browserActionsContainerView_ resizeDeltaX] animate:NO]; | 665 [browserActionsContainerView_ resizeDeltaX] animate:NO]; |
| 666 } | 666 } |
| 667 | 667 |
| 668 - (void)browserActionsContainerDragFinished:(NSNotification*)notification { | 668 - (void)browserActionsContainerDragFinished:(NSNotification*)notification { |
| 669 [browserActionsController_ resizeContainerAndAnimate:YES]; | 669 [browserActionsController_ resizeContainerAndAnimate:YES]; |
| 670 [self pinGoButtonToLeftOfBrowserActionsContainerAndAnimate:YES]; | 670 [self pinGoButtonToLeftOfBrowserActionsContainerAndAnimate:YES]; |
| 671 } | 671 } |
| 672 | 672 |
| 673 - (void)browserActionsVisibilityChanged:(NSNotification*)notification { | 673 - (void)browserActionsVisibilityChanged:(NSNotification*)notification { |
| 674 [self pinGoButtonToLeftOfBrowserActionsContainerAndAnimate:NO]; | 674 [self pinGoButtonToLeftOfBrowserActionsContainerAndAnimate: |
| 675 [[[self view] window] isVisible]]; |
| 675 } | 676 } |
| 676 | 677 |
| 677 - (void)pinGoButtonToLeftOfBrowserActionsContainerAndAnimate:(BOOL)animate { | 678 - (void)pinGoButtonToLeftOfBrowserActionsContainerAndAnimate:(BOOL)animate { |
| 678 CGFloat goXPos = [goButton_ frame].origin.x + NSWidth([goButton_ frame]); | 679 CGFloat goXPos = [goButton_ frame].origin.x + NSWidth([goButton_ frame]); |
| 679 CGFloat leftPadding; | 680 CGFloat leftPadding; |
| 680 | 681 |
| 681 if ([browserActionsContainerView_ isHidden]) { | 682 if ([browserActionsContainerView_ isHidden]) { |
| 682 leftPadding = NSWidth([[goButton_ window] frame]) - goXPos; | 683 CGFloat edgeXPos = [pageButton_ isHidden] ? |
| 684 NSWidth([[goButton_ window] frame]) : [pageButton_ frame].origin.x; |
| 685 leftPadding = edgeXPos - goXPos; |
| 683 } else { | 686 } else { |
| 684 NSRect containerFrame = animate ? | 687 NSRect containerFrame = animate ? |
| 685 [browserActionsContainerView_ animationEndFrame] : | 688 [browserActionsContainerView_ animationEndFrame] : |
| 686 [browserActionsContainerView_ frame]; | 689 [browserActionsContainerView_ frame]; |
| 687 | 690 |
| 688 leftPadding = containerFrame.origin.x - goXPos; | 691 leftPadding = containerFrame.origin.x - goXPos; |
| 689 } | 692 } |
| 690 if (leftPadding != kBrowserActionsContainerLeftPadding) { | 693 if (leftPadding != kBrowserActionsContainerLeftPadding) { |
| 691 CGFloat dX = leftPadding - kBrowserActionsContainerLeftPadding; | 694 CGFloat dX = leftPadding - kBrowserActionsContainerLeftPadding; |
| 692 [self adjustLocationAndGoPositionsBy:dX animate:animate]; | 695 [self adjustLocationAndGoPositionsBy:dX animate:animate]; |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 895 - (void)indicateDropURLsInView:(NSView*)view at:(NSPoint)point { | 898 - (void)indicateDropURLsInView:(NSView*)view at:(NSPoint)point { |
| 896 // Do nothing. | 899 // Do nothing. |
| 897 } | 900 } |
| 898 | 901 |
| 899 // (URLDropTargetController protocol) | 902 // (URLDropTargetController protocol) |
| 900 - (void)hideDropURLsIndicatorInView:(NSView*)view { | 903 - (void)hideDropURLsIndicatorInView:(NSView*)view { |
| 901 // Do nothing. | 904 // Do nothing. |
| 902 } | 905 } |
| 903 | 906 |
| 904 @end | 907 @end |
| OLD | NEW |