| 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 <math.h> | 7 #include <math.h> |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 CGFloat maxY = maxY_; | 273 CGFloat maxY = maxY_; |
| 274 | 274 |
| 275 // Sanity-check |maxY|. | 275 // Sanity-check |maxY|. |
| 276 DCHECK_GE(maxY, 0); | 276 DCHECK_GE(maxY, 0); |
| 277 DCHECK_LE(maxY, parameters_.contentViewSize.height + fullscreenYOffset_); | 277 DCHECK_LE(maxY, parameters_.contentViewSize.height + fullscreenYOffset_); |
| 278 | 278 |
| 279 CGFloat width = parameters_.contentViewSize.width; | 279 CGFloat width = parameters_.contentViewSize.width; |
| 280 | 280 |
| 281 // Lay out the toolbar. | 281 // Lay out the toolbar. |
| 282 if (parameters.hasToolbar) { | 282 if (parameters.hasToolbar) { |
| 283 output_.toolbarFrame = NSMakeRect( | 283 CGFloat toolbarY = maxY; |
| 284 0, maxY - parameters_.toolbarHeight, width, parameters_.toolbarHeight); | 284 if (parameters_.inAnyFullscreen && |
| 285 parameters_.toolbarStyle == FullscreenToolbarStyle::TOOLBAR_NONE) { |
| 286 toolbarY = parameters_.windowSize.height + fullscreenYOffset_; |
| 287 } |
| 288 |
| 289 output_.toolbarFrame = NSMakeRect(0, toolbarY - parameters_.toolbarHeight, |
| 290 width, parameters_.toolbarHeight); |
| 285 maxY = NSMinY(output_.toolbarFrame); | 291 maxY = NSMinY(output_.toolbarFrame); |
| 286 } else if (parameters_.hasLocationBar) { | 292 } else if (parameters_.hasLocationBar) { |
| 287 CGFloat toolbarX = kLocBarLeftRightInset; | 293 CGFloat toolbarX = kLocBarLeftRightInset; |
| 288 CGFloat toolbarY = maxY - parameters_.toolbarHeight - kLocBarTopInset; | 294 CGFloat toolbarY = maxY - parameters_.toolbarHeight - kLocBarTopInset; |
| 289 CGFloat toolbarWidth = width - 2 * kLocBarLeftRightInset; | 295 CGFloat toolbarWidth = width - 2 * kLocBarLeftRightInset; |
| 290 output_.toolbarFrame = | 296 output_.toolbarFrame = |
| 291 NSMakeRect(toolbarX, toolbarY, toolbarWidth, parameters_.toolbarHeight); | 297 NSMakeRect(toolbarX, toolbarY, toolbarWidth, parameters_.toolbarHeight); |
| 292 maxY = NSMinY(output_.toolbarFrame) - kLocBarBottomInset; | 298 maxY = NSMinY(output_.toolbarFrame) - kLocBarBottomInset; |
| 293 } | 299 } |
| 294 | 300 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 | 408 |
| 403 @end | 409 @end |
| 404 | 410 |
| 405 @implementation BrowserWindowLayout (ExposedForTesting) | 411 @implementation BrowserWindowLayout (ExposedForTesting) |
| 406 | 412 |
| 407 - (void)setOSYosemiteOrLater:(BOOL)osYosemiteOrLater { | 413 - (void)setOSYosemiteOrLater:(BOOL)osYosemiteOrLater { |
| 408 parameters_.isOSYosemiteOrLater = osYosemiteOrLater; | 414 parameters_.isOSYosemiteOrLater = osYosemiteOrLater; |
| 409 } | 415 } |
| 410 | 416 |
| 411 @end | 417 @end |
| OLD | NEW |