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/toolbar/toolbar_controller.h" | 5 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/mac/bundle_locations.h" | 9 #include "base/mac/bundle_locations.h" |
10 #include "base/mac/foundation_util.h" | 10 #include "base/mac/foundation_util.h" |
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 addObserver:self | 647 addObserver:self |
648 selector:@selector(browserActionsContainerWillAnimate:) | 648 selector:@selector(browserActionsContainerWillAnimate:) |
649 name:kBrowserActionsContainerWillAnimate | 649 name:kBrowserActionsContainerWillAnimate |
650 object:browserActionsContainerView_]; | 650 object:browserActionsContainerView_]; |
651 [[NSNotificationCenter defaultCenter] | 651 [[NSNotificationCenter defaultCenter] |
652 addObserver:self | 652 addObserver:self |
653 selector:@selector(adjustBrowserActionsContainerForNewWindow:) | 653 selector:@selector(adjustBrowserActionsContainerForNewWindow:) |
654 name:NSWindowDidBecomeKeyNotification | 654 name:NSWindowDidBecomeKeyNotification |
655 object:[[self view] window]]; | 655 object:[[self view] window]]; |
656 } | 656 } |
657 CGFloat containerWidth = [browserActionsContainerView_ isHidden] ? 0.0 : | 657 if (![browserActionsContainerView_ isHidden]) |
658 NSWidth([browserActionsContainerView_ frame]); | 658 [self pinLocationBarToLeftOfBrowserActionsContainerAndAnimate:NO]; |
659 if (containerWidth > 0.0) | |
660 [self adjustLocationSizeBy:(containerWidth * -1) animate:NO]; | |
661 } | 659 } |
662 | 660 |
663 - (void)adjustBrowserActionsContainerForNewWindow: | 661 - (void)adjustBrowserActionsContainerForNewWindow: |
664 (NSNotification*)notification { | 662 (NSNotification*)notification { |
665 [self toolbarFrameChanged]; | 663 [self toolbarFrameChanged]; |
666 [[NSNotificationCenter defaultCenter] | 664 [[NSNotificationCenter defaultCenter] |
667 removeObserver:self | 665 removeObserver:self |
668 name:NSWindowDidBecomeKeyNotification | 666 name:NSWindowDidBecomeKeyNotification |
669 object:[[self view] window]]; | 667 object:[[self view] window]]; |
670 } | 668 } |
671 | 669 |
672 - (void)browserActionsContainerDragged:(NSNotification*)notification { | 670 - (void)browserActionsContainerDragged:(NSNotification*)notification { |
673 CGFloat locationBarWidth = NSWidth([locationBar_ frame]); | 671 [self pinLocationBarToLeftOfBrowserActionsContainerAndAnimate:NO]; |
674 locationBarAtMinSize_ = locationBarWidth <= kMinimumLocationBarWidth; | |
675 [self adjustLocationSizeBy: | |
676 [browserActionsContainerView_ resizeDeltaX] animate:NO]; | |
677 } | 672 } |
678 | 673 |
679 - (void)browserActionsVisibilityChanged:(NSNotification*)notification { | 674 - (void)browserActionsVisibilityChanged:(NSNotification*)notification { |
680 [self pinLocationBarToLeftOfBrowserActionsContainerAndAnimate:NO]; | 675 [self pinLocationBarToLeftOfBrowserActionsContainerAndAnimate:NO]; |
681 } | 676 } |
682 | 677 |
683 - (void)browserActionsContainerWillAnimate:(NSNotification*)notification { | 678 - (void)browserActionsContainerWillAnimate:(NSNotification*)notification { |
684 [self pinLocationBarToLeftOfBrowserActionsContainerAndAnimate:YES]; | 679 [self pinLocationBarToLeftOfBrowserActionsContainerAndAnimate:YES]; |
685 } | 680 } |
686 | 681 |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
887 - (void)hideDropURLsIndicatorInView:(NSView*)view { | 882 - (void)hideDropURLsIndicatorInView:(NSView*)view { |
888 // Do nothing. | 883 // Do nothing. |
889 } | 884 } |
890 | 885 |
891 // (URLDropTargetController protocol) | 886 // (URLDropTargetController protocol) |
892 - (BOOL)isUnsupportedDropData:(id<NSDraggingInfo>)info { | 887 - (BOOL)isUnsupportedDropData:(id<NSDraggingInfo>)info { |
893 return drag_util::IsUnsupportedDropData(profile_, info); | 888 return drag_util::IsUnsupportedDropData(profile_, info); |
894 } | 889 } |
895 | 890 |
896 @end | 891 @end |
OLD | NEW |