| 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/browser_window_controller_private.h" | 5 #import "chrome/browser/ui/cocoa/browser_window_controller_private.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #import "base/auto_reset.h" | 9 #import "base/auto_reset.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 806 - (CGFloat)toolbarDividerOpacity { | 806 - (CGFloat)toolbarDividerOpacity { |
| 807 return [bookmarkBarController_ toolbarDividerOpacity]; | 807 return [bookmarkBarController_ toolbarDividerOpacity]; |
| 808 } | 808 } |
| 809 | 809 |
| 810 - (void)updateInfoBarTipVisibility { | 810 - (void)updateInfoBarTipVisibility { |
| 811 // If there's no toolbar then hide the infobar tip. | 811 // If there's no toolbar then hide the infobar tip. |
| 812 [infoBarContainerController_ | 812 [infoBarContainerController_ |
| 813 setShouldSuppressTopInfoBarTip:![self hasToolbar]]; | 813 setShouldSuppressTopInfoBarTip:![self hasToolbar]]; |
| 814 } | 814 } |
| 815 | 815 |
| 816 - (NSInteger)pageInfoBubblePointY { | 816 - (NSInteger)infoBarAnchorPointY { |
| 817 LocationBarViewMac* locationBarView = [self locationBarBridge]; | 817 LocationBarViewMac* locationBarView = [self locationBarBridge]; |
| 818 | 818 |
| 819 // The point, in window coordinates. | 819 // The point, in window coordinates. |
| 820 NSPoint iconBottom = locationBarView->GetPageInfoBubblePoint(); | 820 NSPoint iconBottom = locationBarView->GetInfoBarAnchorPoint(); |
| 821 | 821 |
| 822 // The toolbar, in window coordinates. | 822 // The toolbar, in window coordinates. |
| 823 NSView* toolbar = [toolbarController_ view]; | 823 NSView* toolbar = [toolbarController_ view]; |
| 824 CGFloat toolbarY = NSMinY([toolbar convertRect:[toolbar bounds] toView:nil]); | 824 CGFloat toolbarY = NSMinY([toolbar convertRect:[toolbar bounds] toView:nil]); |
| 825 | 825 |
| 826 return iconBottom.y - toolbarY; | 826 return iconBottom.y - toolbarY; |
| 827 } | 827 } |
| 828 | 828 |
| 829 - (void)enterAppKitFullscreen { | 829 - (void)enterAppKitFullscreen { |
| 830 [[self window] toggleFullScreen:nil]; | 830 [[self window] toggleFullScreen:nil]; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 892 [layout setToolbarHeight:NSHeight([[toolbarController_ view] bounds])]; | 892 [layout setToolbarHeight:NSHeight([[toolbarController_ view] bounds])]; |
| 893 | 893 |
| 894 [layout setHasLocationBar:[self hasLocationBar]]; | 894 [layout setHasLocationBar:[self hasLocationBar]]; |
| 895 | 895 |
| 896 [layout setPlaceBookmarkBarBelowInfoBar:[self placeBookmarkBarBelowInfoBar]]; | 896 [layout setPlaceBookmarkBarBelowInfoBar:[self placeBookmarkBarBelowInfoBar]]; |
| 897 [layout setBookmarkBarHidden:[bookmarkBarController_ view].isHidden]; | 897 [layout setBookmarkBarHidden:[bookmarkBarController_ view].isHidden]; |
| 898 [layout setBookmarkBarHeight: | 898 [layout setBookmarkBarHeight: |
| 899 NSHeight([[bookmarkBarController_ view] bounds])]; | 899 NSHeight([[bookmarkBarController_ view] bounds])]; |
| 900 | 900 |
| 901 [layout setInfoBarHeight:[infoBarContainerController_ heightOfInfoBars]]; | 901 [layout setInfoBarHeight:[infoBarContainerController_ heightOfInfoBars]]; |
| 902 [layout setPageInfoBubblePointY:[self pageInfoBubblePointY]]; | 902 [layout setInfoBarAnchorPointY:[self infoBarAnchorPointY]]; |
| 903 | 903 |
| 904 [layout setHasDownloadShelf:(downloadShelfController_.get() != nil)]; | 904 [layout setHasDownloadShelf:(downloadShelfController_.get() != nil)]; |
| 905 [layout setDownloadShelfHeight: | 905 [layout setDownloadShelfHeight: |
| 906 NSHeight([[downloadShelfController_ view] bounds])]; | 906 NSHeight([[downloadShelfController_ view] bounds])]; |
| 907 } | 907 } |
| 908 | 908 |
| 909 - (void)applyLayout:(BrowserWindowLayout*)layout { | 909 - (void)applyLayout:(BrowserWindowLayout*)layout { |
| 910 chrome::LayoutOutput output = [layout computeLayout]; | 910 chrome::LayoutOutput output = [layout computeLayout]; |
| 911 | 911 |
| 912 if (!NSIsEmptyRect(output.tabStripLayout.frame)) | 912 if (!NSIsEmptyRect(output.tabStripLayout.frame)) |
| 913 [self applyTabStripLayout:output.tabStripLayout]; | 913 [self applyTabStripLayout:output.tabStripLayout]; |
| 914 | 914 |
| 915 if (!NSIsEmptyRect(output.toolbarFrame)) | 915 if (!NSIsEmptyRect(output.toolbarFrame)) |
| 916 [[toolbarController_ view] setFrame:output.toolbarFrame]; | 916 [[toolbarController_ view] setFrame:output.toolbarFrame]; |
| 917 | 917 |
| 918 if (!NSIsEmptyRect(output.bookmarkFrame)) | 918 if (!NSIsEmptyRect(output.bookmarkFrame)) |
| 919 [bookmarkBarController_ layoutToFrame:output.bookmarkFrame]; | 919 [bookmarkBarController_ layoutToFrame:output.bookmarkFrame]; |
| 920 | 920 |
| 921 // The info bar is never hidden. Sometimes it has zero effective height. | 921 // The info bar is never hidden. Sometimes it has zero effective height. |
| 922 [[infoBarContainerController_ view] setFrame:output.infoBarFrame]; | 922 [[infoBarContainerController_ view] setFrame:output.infoBarFrame]; |
| 923 [infoBarContainerController_ | 923 [infoBarContainerController_ |
| 924 setMaxTopArrowHeight:output.infoBarMaxTopArrowHeight]; | 924 setMaxTopArrowHeight:output.infoBarMaxTopArrowHeight]; |
| 925 [infoBarContainerController_ | 925 [infoBarContainerController_ |
| 926 setInfobarArrowX:[self locationBarBridge]->GetPageInfoBubblePoint().x]; | 926 setInfobarArrowX:[self locationBarBridge]->GetInfoBarAnchorPoint().x]; |
| 927 | 927 |
| 928 [[downloadShelfController_ view] setFrame:output.downloadShelfFrame]; | 928 [[downloadShelfController_ view] setFrame:output.downloadShelfFrame]; |
| 929 | 929 |
| 930 [self layoutTabContentArea:output.contentAreaFrame]; | 930 [self layoutTabContentArea:output.contentAreaFrame]; |
| 931 | 931 |
| 932 if (!NSIsEmptyRect(output.fullscreenBackingBarFrame)) { | 932 if (!NSIsEmptyRect(output.fullscreenBackingBarFrame)) { |
| 933 [floatingBarBackingView_ setFrame:output.fullscreenBackingBarFrame]; | 933 [floatingBarBackingView_ setFrame:output.fullscreenBackingBarFrame]; |
| 934 [fullscreenToolbarController_ | 934 [fullscreenToolbarController_ |
| 935 updateToolbarFrame:output.fullscreenBackingBarFrame]; | 935 updateToolbarFrame:output.fullscreenBackingBarFrame]; |
| 936 } | 936 } |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1190 if (fullscreenLowPowerCoordinator_) | 1190 if (fullscreenLowPowerCoordinator_) |
| 1191 fullscreenLowPowerCoordinator_->SetHasActiveSheet(false); | 1191 fullscreenLowPowerCoordinator_->SetHasActiveSheet(false); |
| 1192 } | 1192 } |
| 1193 | 1193 |
| 1194 - (void)childWindowsDidChange { | 1194 - (void)childWindowsDidChange { |
| 1195 if (fullscreenLowPowerCoordinator_) | 1195 if (fullscreenLowPowerCoordinator_) |
| 1196 fullscreenLowPowerCoordinator_->ChildWindowsChanged(); | 1196 fullscreenLowPowerCoordinator_->ChildWindowsChanged(); |
| 1197 } | 1197 } |
| 1198 | 1198 |
| 1199 @end // @implementation BrowserWindowController(Private) | 1199 @end // @implementation BrowserWindowController(Private) |
| OLD | NEW |