| 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 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #import "base/memory/scoped_nsobject.h" | 10 #import "base/memory/scoped_nsobject.h" |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 maxY = [self layoutTabStripAtMaxY:maxY | 199 maxY = [self layoutTabStripAtMaxY:maxY |
| 200 width:width | 200 width:width |
| 201 fullscreen:[self isFullscreen]]; | 201 fullscreen:[self isFullscreen]]; |
| 202 } | 202 } |
| 203 | 203 |
| 204 // Sanity-check |maxY|. | 204 // Sanity-check |maxY|. |
| 205 DCHECK_GE(maxY, minY); | 205 DCHECK_GE(maxY, minY); |
| 206 DCHECK_LE(maxY, NSMaxY(contentBounds) + yOffset); | 206 DCHECK_LE(maxY, NSMaxY(contentBounds) + yOffset); |
| 207 | 207 |
| 208 // Place the toolbar at the top of the reserved area. | 208 // Place the toolbar at the top of the reserved area. |
| 209 CGFloat toolbarTopY = maxY; |
| 209 maxY = [self layoutToolbarAtMinX:minX maxY:maxY width:width]; | 210 maxY = [self layoutToolbarAtMinX:minX maxY:maxY width:width]; |
| 210 CGFloat toolbarBottomY = maxY; | |
| 211 | 211 |
| 212 // If we're not displaying the bookmark bar below the infobar, then it goes | 212 // If we're not displaying the bookmark bar below the infobar, then it goes |
| 213 // immediately below the toolbar. | 213 // immediately below the toolbar. |
| 214 BOOL placeBookmarkBarBelowInfoBar = [self placeBookmarkBarBelowInfoBar]; | 214 BOOL placeBookmarkBarBelowInfoBar = [self placeBookmarkBarBelowInfoBar]; |
| 215 if (!placeBookmarkBarBelowInfoBar) | 215 if (!placeBookmarkBarBelowInfoBar) |
| 216 maxY = [self layoutBookmarkBarAtMinX:minX maxY:maxY width:width]; | 216 maxY = [self layoutBookmarkBarAtMinX:minX maxY:maxY width:width]; |
| 217 | 217 |
| 218 // The floating bar backing view doesn't actually add any height. | 218 // The floating bar backing view doesn't actually add any height. |
| 219 NSRect floatingBarBackingRect = | 219 NSRect floatingBarBackingRect = |
| 220 NSMakeRect(minX, maxY, width, floatingBarHeight); | 220 NSMakeRect(minX, maxY, width, floatingBarHeight); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 244 maxY = [self layoutBookmarkBarAtMinX:minX maxY:maxY width:width]; | 244 maxY = [self layoutBookmarkBarAtMinX:minX maxY:maxY width:width]; |
| 245 | 245 |
| 246 // In presentation mode the content area takes up all the remaining space | 246 // In presentation mode the content area takes up all the remaining space |
| 247 // (from the bottom of the infobar down). In normal mode the content area | 247 // (from the bottom of the infobar down). In normal mode the content area |
| 248 // takes up the space between the bottom of the toolbar down. | 248 // takes up the space between the bottom of the toolbar down. |
| 249 CGFloat contentAreaTop = 0; | 249 CGFloat contentAreaTop = 0; |
| 250 if (inPresentationMode) { | 250 if (inPresentationMode) { |
| 251 toolbarToWebContentsOffset_ = 0; | 251 toolbarToWebContentsOffset_ = 0; |
| 252 contentAreaTop = maxY; | 252 contentAreaTop = maxY; |
| 253 } else { | 253 } else { |
| 254 toolbarToWebContentsOffset_ = toolbarBottomY - maxY; | 254 CGFloat minToolbarHeight = 0; |
| 255 contentAreaTop = toolbarBottomY; | 255 if ([self hasToolbar]) { |
| 256 minToolbarHeight = [toolbarController_ |
| 257 desiredHeightForCompression:bookmarks::kBookmarkBarOverlap]; |
| 258 } |
| 259 contentAreaTop = toolbarTopY - minToolbarHeight; |
| 260 toolbarToWebContentsOffset_ = contentAreaTop - maxY; |
| 256 } | 261 } |
| 257 [self updateContentOffsets]; | 262 [self updateContentOffsets]; |
| 258 | 263 |
| 259 NSRect contentAreaRect = NSMakeRect(minX, minY, width, contentAreaTop - minY); | 264 NSRect contentAreaRect = NSMakeRect(minX, minY, width, contentAreaTop - minY); |
| 260 [self layoutTabContentArea:contentAreaRect]; | 265 [self layoutTabContentArea:contentAreaRect]; |
| 261 | 266 |
| 262 // Normally, we don't need to tell the toolbar whether or not to show the | 267 // Normally, we don't need to tell the toolbar whether or not to show the |
| 263 // divider, but things break down during animation. | 268 // divider, but things break down during animation. |
| 264 [toolbarController_ setDividerOpacity:[self toolbarDividerOpacity]]; | 269 [toolbarController_ setDividerOpacity:[self toolbarDividerOpacity]]; |
| 265 } | 270 } |
| (...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 835 - (void)disableBarVisibilityUpdates { | 840 - (void)disableBarVisibilityUpdates { |
| 836 // Early escape if there's nothing to do. | 841 // Early escape if there's nothing to do. |
| 837 if (!barVisibilityUpdatesEnabled_) | 842 if (!barVisibilityUpdatesEnabled_) |
| 838 return; | 843 return; |
| 839 | 844 |
| 840 barVisibilityUpdatesEnabled_ = NO; | 845 barVisibilityUpdatesEnabled_ = NO; |
| 841 [presentationModeController_ cancelAnimationAndTimers]; | 846 [presentationModeController_ cancelAnimationAndTimers]; |
| 842 } | 847 } |
| 843 | 848 |
| 844 - (CGFloat)toolbarDividerOpacity { | 849 - (CGFloat)toolbarDividerOpacity { |
| 845 if ([self currentInstantUIState] != browser_window_controller::kInstantUINone) | |
| 846 return 1; | |
| 847 return [bookmarkBarController_ toolbarDividerOpacity]; | 850 return [bookmarkBarController_ toolbarDividerOpacity]; |
| 848 } | 851 } |
| 849 | 852 |
| 850 - (browser_window_controller::InstantUIState)currentInstantUIState { | 853 - (browser_window_controller::InstantUIState)currentInstantUIState { |
| 851 if (!browser_->search_model()->mode().is_search_suggestions()) | 854 if (!browser_->search_model()->mode().is_search_suggestions()) |
| 852 return browser_window_controller::kInstantUINone; | 855 return browser_window_controller::kInstantUINone; |
| 853 | 856 |
| 854 // If the search suggestions are already being displayed in the overlay | 857 // If the search suggestions are already being displayed in the overlay |
| 855 // contents then return kInstantUIOverlay. | 858 // contents then return kInstantUIOverlay. |
| 856 if ([overlayableContentsController_ isShowingOverlay]) | 859 if ([overlayableContentsController_ isShowingOverlay]) |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 948 relativeTo:[bookmarkBarController_ view]]; | 951 relativeTo:[bookmarkBarController_ view]]; |
| 949 } else { | 952 } else { |
| 950 [contentView cr_ensureSubview:floatingBarBackingView_ | 953 [contentView cr_ensureSubview:floatingBarBackingView_ |
| 951 isPositioned:NSWindowBelow | 954 isPositioned:NSWindowBelow |
| 952 relativeTo:[bookmarkBarController_ view]]; | 955 relativeTo:[bookmarkBarController_ view]]; |
| 953 } | 956 } |
| 954 } | 957 } |
| 955 } | 958 } |
| 956 | 959 |
| 957 @end // @implementation BrowserWindowController(Private) | 960 @end // @implementation BrowserWindowController(Private) |
| OLD | NEW |