Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(318)

Side by Side Diff: trunk/src/chrome/browser/ui/cocoa/browser_window_controller_private.mm

Issue 13006019: Revert 190584 "Alternate NTP Mac: Show overlay at fixed position" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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;
210 maxY = [self layoutToolbarAtMinX:minX maxY:maxY width:width]; 209 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
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 CGFloat minToolbarHeight = 0; 254 toolbarToWebContentsOffset_ = toolbarBottomY - maxY;
255 if ([self hasToolbar]) { 255 contentAreaTop = toolbarBottomY;
256 minToolbarHeight = [toolbarController_
257 desiredHeightForCompression:bookmarks::kBookmarkBarOverlap];
258 }
259 contentAreaTop = toolbarTopY - minToolbarHeight;
260 toolbarToWebContentsOffset_ = contentAreaTop - maxY;
261 } 256 }
262 [self updateContentOffsets]; 257 [self updateContentOffsets];
263 258
264 NSRect contentAreaRect = NSMakeRect(minX, minY, width, contentAreaTop - minY); 259 NSRect contentAreaRect = NSMakeRect(minX, minY, width, contentAreaTop - minY);
265 [self layoutTabContentArea:contentAreaRect]; 260 [self layoutTabContentArea:contentAreaRect];
266 261
267 // Normally, we don't need to tell the toolbar whether or not to show the 262 // Normally, we don't need to tell the toolbar whether or not to show the
268 // divider, but things break down during animation. 263 // divider, but things break down during animation.
269 [toolbarController_ setDividerOpacity:[self toolbarDividerOpacity]]; 264 [toolbarController_ setDividerOpacity:[self toolbarDividerOpacity]];
270 } 265 }
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
840 - (void)disableBarVisibilityUpdates { 835 - (void)disableBarVisibilityUpdates {
841 // Early escape if there's nothing to do. 836 // Early escape if there's nothing to do.
842 if (!barVisibilityUpdatesEnabled_) 837 if (!barVisibilityUpdatesEnabled_)
843 return; 838 return;
844 839
845 barVisibilityUpdatesEnabled_ = NO; 840 barVisibilityUpdatesEnabled_ = NO;
846 [presentationModeController_ cancelAnimationAndTimers]; 841 [presentationModeController_ cancelAnimationAndTimers];
847 } 842 }
848 843
849 - (CGFloat)toolbarDividerOpacity { 844 - (CGFloat)toolbarDividerOpacity {
845 if ([self currentInstantUIState] != browser_window_controller::kInstantUINone)
846 return 1;
850 return [bookmarkBarController_ toolbarDividerOpacity]; 847 return [bookmarkBarController_ toolbarDividerOpacity];
851 } 848 }
852 849
853 - (browser_window_controller::InstantUIState)currentInstantUIState { 850 - (browser_window_controller::InstantUIState)currentInstantUIState {
854 if (!browser_->search_model()->mode().is_search_suggestions()) 851 if (!browser_->search_model()->mode().is_search_suggestions())
855 return browser_window_controller::kInstantUINone; 852 return browser_window_controller::kInstantUINone;
856 853
857 // If the search suggestions are already being displayed in the overlay 854 // If the search suggestions are already being displayed in the overlay
858 // contents then return kInstantUIOverlay. 855 // contents then return kInstantUIOverlay.
859 if ([overlayableContentsController_ isShowingOverlay]) 856 if ([overlayableContentsController_ isShowingOverlay])
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
951 relativeTo:[bookmarkBarController_ view]]; 948 relativeTo:[bookmarkBarController_ view]];
952 } else { 949 } else {
953 [contentView cr_ensureSubview:floatingBarBackingView_ 950 [contentView cr_ensureSubview:floatingBarBackingView_
954 isPositioned:NSWindowBelow 951 isPositioned:NSWindowBelow
955 relativeTo:[bookmarkBarController_ view]]; 952 relativeTo:[bookmarkBarController_ view]];
956 } 953 }
957 } 954 }
958 } 955 }
959 956
960 @end // @implementation BrowserWindowController(Private) 957 @end // @implementation BrowserWindowController(Private)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698