| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_layout.h" | 5 #import "chrome/browser/ui/cocoa/browser_window_layout.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 | 8 |
| 9 namespace chrome { | 9 namespace chrome { |
| 10 | 10 |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 // Lay out the backing bar in fullscreen mode. | 188 // Lay out the backing bar in fullscreen mode. |
| 189 if (parameters_.inAnyFullscreen) { | 189 if (parameters_.inAnyFullscreen) { |
| 190 output_.fullscreenBackingBarFrame = | 190 output_.fullscreenBackingBarFrame = |
| 191 NSMakeRect(0, maxY, width, [self fullscreenBackingBarHeight]); | 191 NSMakeRect(0, maxY, width, [self fullscreenBackingBarHeight]); |
| 192 } | 192 } |
| 193 | 193 |
| 194 // Place the find bar immediately below the toolbar/attached bookmark bar. | 194 // Place the find bar immediately below the toolbar/attached bookmark bar. |
| 195 output_.findBarMaxY = maxY; | 195 output_.findBarMaxY = maxY; |
| 196 output_.fullscreenExitButtonMaxY = maxY; | 196 output_.fullscreenExitButtonMaxY = maxY; |
| 197 | 197 |
| 198 if (parameters_.inAnyFullscreen) { | 198 if (parameters_.inAnyFullscreen && |
| 199 switch (parameters_.slidingStyle) { | 199 parameters_.slidingStyle == fullscreen_mac::OMNIBOX_TABS_HIDDEN) { |
| 200 case fullscreen_mac::OMNIBOX_TABS_PRESENT: | 200 // If in presentation mode, reset |maxY| to top of screen, so that the |
| 201 // Do nothing in Canonical Fullscreen. All content slides. | 201 // floating bar slides over the things which appear to be in the content |
| 202 break; | 202 // area. |
| 203 case fullscreen_mac::OMNIBOX_TABS_HIDDEN: | 203 maxY = parameters_.windowSize.height; |
| 204 // If in presentation mode, reset |maxY| to top of screen, so that the | |
| 205 // floating bar slides over the things which appear to be in the content | |
| 206 // area. | |
| 207 maxY = parameters_.contentViewSize.height; | |
| 208 break; | |
| 209 } | |
| 210 } | 204 } |
| 211 | 205 |
| 212 // Lay out the info bar. It is never hidden. The frame needs to be high | 206 // Lay out the info bar. It is never hidden. The frame needs to be high |
| 213 // enough to accomodate the top arrow, which might stretch all the way to the | 207 // enough to accomodate the top arrow, which might stretch all the way to the |
| 214 // page info bubble icon. | 208 // page info bubble icon. |
| 215 if (parameters_.infoBarHeight != 0) { | 209 if (parameters_.infoBarHeight != 0) { |
| 216 CGFloat infoBarMaxY = | 210 CGFloat infoBarMaxY = |
| 217 NSMinY(output_.toolbarFrame) + parameters.pageInfoBubblePointY; | 211 NSMinY(output_.toolbarFrame) + parameters.pageInfoBubblePointY; |
| 218 CGFloat infoBarMinY = maxY - parameters_.infoBarHeight; | 212 CGFloat infoBarMinY = maxY - parameters_.infoBarHeight; |
| 219 output_.infoBarFrame = | 213 output_.infoBarFrame = |
| (...skipping 18 matching lines...) Expand all Loading... |
| 238 } | 232 } |
| 239 | 233 |
| 240 // Layout the download shelf at the bottom of the content view. | 234 // Layout the download shelf at the bottom of the content view. |
| 241 CGFloat minY = 0; | 235 CGFloat minY = 0; |
| 242 if (parameters.hasDownloadShelf) { | 236 if (parameters.hasDownloadShelf) { |
| 243 output_.downloadShelfFrame = | 237 output_.downloadShelfFrame = |
| 244 NSMakeRect(0, 0, width, parameters.downloadShelfHeight); | 238 NSMakeRect(0, 0, width, parameters.downloadShelfHeight); |
| 245 minY = NSMaxY(output_.downloadShelfFrame); | 239 minY = NSMaxY(output_.downloadShelfFrame); |
| 246 } | 240 } |
| 247 | 241 |
| 242 if (parameters_.inAnyFullscreen && |
| 243 parameters_.slidingStyle == fullscreen_mac::OMNIBOX_TABS_PRESENT) { |
| 244 // If in Canonical Fullscreen, content should be shifted down by an amount |
| 245 // equal to all the widgets and views at the top of the window. It should |
| 246 // not be further shifted by the appearance/disappearance of the AppKit |
| 247 // menu bar. |
| 248 maxY = parameters_.windowSize.height; |
| 249 maxY -= NSHeight(output_.toolbarFrame) + NSHeight(output_.tabStripFrame) + |
| 250 NSHeight(output_.bookmarkFrame) + parameters.infoBarHeight; |
| 251 } |
| 252 |
| 248 // All the remaining space becomes the frame of the content area. | 253 // All the remaining space becomes the frame of the content area. |
| 249 output_.contentAreaFrame = NSMakeRect(0, minY, width, maxY - minY); | 254 output_.contentAreaFrame = NSMakeRect(0, minY, width, maxY - minY); |
| 250 } | 255 } |
| 251 | 256 |
| 252 - (CGFloat)fullscreenBackingBarHeight { | 257 - (CGFloat)fullscreenBackingBarHeight { |
| 253 if (!parameters_.inAnyFullscreen) | 258 if (!parameters_.inAnyFullscreen) |
| 254 return 0; | 259 return 0; |
| 255 | 260 |
| 256 CGFloat totalHeight = 0; | 261 CGFloat totalHeight = 0; |
| 257 if (parameters_.hasTabStrip) | 262 if (parameters_.hasTabStrip) |
| 258 totalHeight += chrome::kTabStripHeight; | 263 totalHeight += chrome::kTabStripHeight; |
| 259 | 264 |
| 260 if (parameters_.hasToolbar) { | 265 if (parameters_.hasToolbar) { |
| 261 totalHeight += parameters_.toolbarHeight; | 266 totalHeight += parameters_.toolbarHeight; |
| 262 } else if (parameters_.hasLocationBar) { | 267 } else if (parameters_.hasLocationBar) { |
| 263 totalHeight += | 268 totalHeight += |
| 264 parameters_.toolbarHeight + kLocBarTopInset + kLocBarBottomInset; | 269 parameters_.toolbarHeight + kLocBarTopInset + kLocBarBottomInset; |
| 265 } | 270 } |
| 266 | 271 |
| 267 if (!parameters_.bookmarkBarHidden && | 272 if (!parameters_.bookmarkBarHidden && |
| 268 !parameters_.placeBookmarkBarBelowInfoBar) | 273 !parameters_.placeBookmarkBarBelowInfoBar) |
| 269 totalHeight += parameters_.bookmarkBarHeight; | 274 totalHeight += parameters_.bookmarkBarHeight; |
| 270 | 275 |
| 271 return totalHeight; | 276 return totalHeight; |
| 272 } | 277 } |
| 273 | 278 |
| 274 @end | 279 @end |
| OLD | NEW |