Chromium Code Reviews| Index: chrome/browser/ui/cocoa/browser_window_controller_private.mm |
| diff --git a/chrome/browser/ui/cocoa/browser_window_controller_private.mm b/chrome/browser/ui/cocoa/browser_window_controller_private.mm |
| index 5511c6a0ca62815bf1e9965f401bd8918f58e834..894b79811e9cb528890c56eae151c5c518e7b839 100644 |
| --- a/chrome/browser/ui/cocoa/browser_window_controller_private.mm |
| +++ b/chrome/browser/ui/cocoa/browser_window_controller_private.mm |
| @@ -13,7 +13,6 @@ |
| #include "chrome/browser/prefs/scoped_user_pref_update.h" |
| #include "chrome/browser/profiles/profile.h" |
| #include "chrome/browser/profiles/profile_info_util.h" |
| -#include "chrome/browser/search/search.h" |
| #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" |
| #include "chrome/browser/ui/browser.h" |
| #include "chrome/browser/ui/browser_window_state.h" |
| @@ -34,8 +33,6 @@ |
| #import "chrome/browser/ui/cocoa/tabs/tab_strip_view.h" |
| #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" |
| #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" |
| -#include "chrome/browser/ui/search/search_model.h" |
| -#include "chrome/browser/ui/search/search_ui.h" |
| #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| #include "chrome/common/chrome_switches.h" |
| #include "chrome/common/pref_names.h" |
| @@ -214,7 +211,6 @@ willPositionSheet:(NSWindow*)sheet |
| DCHECK_LE(maxY, NSMaxY(contentBounds) + yOffset); |
| // Place the toolbar at the top of the reserved area. |
| - CGFloat toolbarTopY = maxY; |
| maxY = [self layoutToolbarAtMinX:minX maxY:maxY width:width]; |
| // If we're not displaying the bookmark bar below the info bar, then it goes |
| @@ -222,7 +218,6 @@ willPositionSheet:(NSWindow*)sheet |
| BOOL placeBookmarkBarBelowInfoBar = [self placeBookmarkBarBelowInfoBar]; |
| if (!placeBookmarkBarBelowInfoBar) |
| maxY = [self layoutBookmarkBarAtMinX:minX maxY:maxY width:width]; |
| - CGFloat toolbarBottomY = maxY; |
| // The floating bar backing view doesn't actually add any height. |
| NSRect floatingBarBackingRect = |
| @@ -230,8 +225,11 @@ willPositionSheet:(NSWindow*)sheet |
| [self layoutFloatingBarBackingView:floatingBarBackingRect |
| presentationMode:inPresentationMode]; |
| - [fullscreenExitBubbleController_ positionInWindowAtTop:toolbarBottomY |
| - width:width]; |
| + // Place the find bar immediately below the toolbar/attached bookmark bar. In |
| + // presentation mode, it hangs off the top of the screen when the bar is |
| + // hidden. The find bar is unaffected by the side tab positioning. |
|
Robert Sesek
2013/06/27 13:29:48
Remove the bit about side tabs. I deleted that loo
sail
2013/06/27 18:26:03
Done.
|
| + [findBarCocoaController_ positionFindBarViewAtMaxY:maxY maxWidth:width]; |
| + [fullscreenExitBubbleController_ positionInWindowAtTop:maxY width:width]; |
| // If in presentation mode, reset |maxY| to top of screen, so that the |
| // floating bar slides over the things which appear to be in the content area. |
| @@ -242,55 +240,15 @@ willPositionSheet:(NSWindow*)sheet |
| // presentation mode in which case it's at the top of the visual content area. |
| maxY = [self layoutInfoBarAtMinX:minX maxY:maxY width:width]; |
| - // Place the download shelf, if any, at the bottom of the view. |
| - minY = [self layoutDownloadShelfAtMinX:minX minY:minY width:width]; |
| - |
| - // Place the bookmark bar. |
| + // If the bookmark bar is detached, place it next in the visual content area. |
| if (placeBookmarkBarBelowInfoBar) |
| maxY = [self layoutBookmarkBarAtMinX:minX maxY:maxY width:width]; |
| - // In presentation mode the content area takes up all the remaining space |
| - // (from the bottom of the info bar down). In normal mode the content area |
| - // takes up the space between the bottom of the toolbar down. |
| - CGFloat contentAreaTop = 0; |
| - if (inPresentationMode) { |
| - // The tabContentaArea starts at the bottom of the info bar (or top of the |
| - // screen if there's no info bar). |
| - contentAreaTop = maxY; |
| - CGFloat floatingBarHeight = |
| - NSHeight(floatingBarBackingRect) * [self floatingBarShownFraction]; |
| - // When an instant overlay is shown this is the amount it needs to be pushed |
| - // down so that it doesn't get covered by the floating toolbar. |
| - toolbarToWebContentsOffset_ = |
| - floatingBarHeight - (NSMaxY(contentBounds) - maxY); |
| - } else { |
| - // The tabContentArea view starts below the omnibox. |
| - CGFloat minToolbarHeight = 0; |
| - if ([self hasToolbar]) { |
| - // 1 to account for the toolbar separator. |
| - minToolbarHeight = [toolbarController_ desiredHeightForCompression:1]; |
| - } |
| - contentAreaTop = toolbarTopY - minToolbarHeight; |
| - // This is the space between the bottom of the omnibox and the bottom of the |
| - // last bar (info bar or bookmark bar or toolbar). This is used to push the |
| - // tab web content down when no instant overlay is shown. |
| - toolbarToWebContentsOffset_ = contentAreaTop - maxY; |
| - } |
| - [self updateContentOffsets]; |
| - |
| - // Place the find bar immediately below the toolbar/attached bookmark bar. In |
| - // presentation mode, it hangs off the top of the screen when the bar is |
| - // hidden. |
| - if ([self currentInstantUIState] == |
| - browser_window_controller::kInstantUIFullPageResults) { |
| - [findBarCocoaController_ positionFindBarViewAtMaxY:contentAreaTop - 1 |
| - maxWidth:width]; |
| - } else { |
| - [findBarCocoaController_ positionFindBarViewAtMaxY:toolbarBottomY |
| - maxWidth:width]; |
| - } |
| + // Place the download shelf, if any, at the bottom of the view. |
| + minY = [self layoutDownloadShelfAtMinX:minX minY:minY width:width]; |
| - NSRect contentAreaRect = NSMakeRect(minX, minY, width, contentAreaTop - minY); |
| + // Finally, the content area takes up all of the remaining space. |
| + NSRect contentAreaRect = NSMakeRect(minX, minY, width, maxY - minY); |
| [self layoutTabContentArea:contentAreaRect]; |
| // Normally, we don't need to tell the toolbar whether or not to show the |
| @@ -884,71 +842,6 @@ willPositionSheet:(NSWindow*)sheet |
| return [bookmarkBarController_ toolbarDividerOpacity]; |
| } |
| -- (browser_window_controller::InstantUIState)currentInstantUIState { |
| - if (!browser_->search_model()->mode().is_search()) |
| - return browser_window_controller::kInstantUINone; |
| - |
| - // If the search suggestions are already being displayed in the overlay |
| - // contents then return kInstantUIOverlay. |
| - if ([overlayableContentsController_ isShowingOverlay]) |
| - return browser_window_controller::kInstantUIOverlay; |
| - |
| - if (browser_->search_model()->top_bars_visible()) |
| - return browser_window_controller::kInstantUINone; |
| - |
| - return browser_window_controller::kInstantUIFullPageResults; |
| -} |
| - |
| -- (void)updateContentOffsets { |
| - if ([self inPresentationMode]) { |
| - // In presentation mode the tabContentArea starts at the bottom of the info |
| - // bar (or top of the screen if there's no info bar). |
| - if ([self currentInstantUIState] != |
| - browser_window_controller::kInstantUIFullPageResults) { |
| - // Normal mode, keep the tab web contents at the top (below the info bar). |
| - [overlayableContentsController_ setActiveContainerOffset:0]; |
| - } else { |
| - // Instant suggestions are displayed in the main tab contents so push that |
| - // down so that the floating toolbar doesn't obscure it. |
| - [overlayableContentsController_ |
| - setActiveContainerOffset:toolbarToWebContentsOffset_]; |
| - } |
| - // Floating overlay (if any) should also be below the floating toolbar. |
| - [overlayableContentsController_ |
| - setOverlayContentsOffset:toolbarToWebContentsOffset_]; |
| - |
| - [[self tabContentArea] setContentOffset:0]; |
| - [devToolsController_ setTopContentOffset:0]; |
| - } else { |
| - // In normal mode the tabContentArea starts just below the omnibox and the |
| - // bookmark bar and info bar overlap it. |
| - if ([self currentInstantUIState] != |
| - browser_window_controller::kInstantUIFullPageResults) { |
| - // Normal mode, push the tab web contents down so that it doesn't obscure |
| - // the bookmark bar and info bar. |
| - [overlayableContentsController_ |
| - setActiveContainerOffset:toolbarToWebContentsOffset_]; |
| - } else { |
| - // Instant suggestions are displayed in the main tab contents so don't |
| - // push it down (keep it next to the omnibox). |
| - [overlayableContentsController_ setActiveContainerOffset:0]; |
| - } |
| - // Floating overlay (if any) should also be at the top (next to the |
| - // omnibox). |
| - [overlayableContentsController_ setOverlayContentsOffset:0]; |
| - |
| - // Prevent the fast resize view from drawing white over the bookmark bar. |
| - [[self tabContentArea] setContentOffset:toolbarToWebContentsOffset_]; |
| - // Prevent the dev tools splitter from overlapping the bookmark bar. |
| - if ([self currentInstantUIState] != |
| - browser_window_controller::kInstantUINone) { |
| - [devToolsController_ setTopContentOffset:0]; |
| - } else { |
| - [devToolsController_ setTopContentOffset:toolbarToWebContentsOffset_]; |
| - } |
| - } |
| -} |
| - |
| - (void)updateSubviewZOrder:(BOOL)inPresentationMode { |
| NSView* contentView = [[self window] contentView]; |
| NSView* toolbarView = [toolbarController_ view]; |
| @@ -960,17 +853,14 @@ willPositionSheet:(NSWindow*)sheet |
| isPositioned:NSWindowAbove |
| relativeTo:[self tabContentArea]]; |
| } else { |
| - // Toolbar is below tab contents so that the infob ar arrow can appear above |
| - // it. Unlike other views the toolbar never overlaps the actual web |
| - // content. |
| + // Toolbar is below tab contents so that the infob arrow can appear above |
|
Robert Sesek
2013/06/27 13:29:48
infob -> infobar
sail
2013/06/27 18:26:03
Done.
|
| + // it. |
| [contentView cr_ensureSubview:toolbarView |
| isPositioned:NSWindowBelow |
| relativeTo:[self tabContentArea]]; |
| } |
| - // The bookmark bar is always below the toolbar. In normal mode this means |
| - // that it is below tab contents. This allows Instant results to be above |
| - // the bookmark bar. |
| + // The bookmark bar is always below the toolbar. |
| [contentView cr_ensureSubview:[bookmarkBarController_ view] |
| isPositioned:NSWindowBelow |
| relativeTo:toolbarView]; |
| @@ -988,17 +878,13 @@ willPositionSheet:(NSWindow*)sheet |
| relativeTo:toolbarView]; |
| } |
| - // The find bar is above everything except Instant search results. |
| + // The find bar is above everything. |
| if (findBarCocoaController_) { |
| NSView* relativeView = nil; |
| - if (inPresentationMode) { |
| + if (inPresentationMode) |
| relativeView = toolbarView; |
| - } else if ([self currentInstantUIState] == |
| - browser_window_controller::kInstantUIOverlay) { |
| - relativeView = [infoBarContainerController_ view]; |
| - } else { |
| + else |
| relativeView = [self tabContentArea]; |
| - } |
| [contentView cr_ensureSubview:[findBarCocoaController_ view] |
| isPositioned:NSWindowAbove |
| relativeTo:relativeView]; |
| @@ -1060,12 +946,9 @@ willPositionSheet:(NSWindow*)sheet |
| } |
| - (void)updateInfoBarTipVisibility { |
| - // If the overlay is open or if there's no toolbar then hide the infobar tip. |
| - BOOL suppressInfoBarTip = |
| - [self currentInstantUIState] != |
| - browser_window_controller::kInstantUINone || ![self hasToolbar]; |
| + // If there's no toolbar then hide the infobar tip. |
| [infoBarContainerController_ |
| - setShouldSuppressTopInfoBarTip:suppressInfoBarTip]; |
| + setShouldSuppressTopInfoBarTip:![self hasToolbar]]; |
| } |
| - (browser_window_controller::CoreAnimationStatus)coreAnimationStatus { |