| 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 } | 117 } |
| 118 | 118 |
| 119 - (void)setAvatarSize:(NSSize)avatarSize { | 119 - (void)setAvatarSize:(NSSize)avatarSize { |
| 120 parameters_.avatarSize = avatarSize; | 120 parameters_.avatarSize = avatarSize; |
| 121 } | 121 } |
| 122 | 122 |
| 123 - (void)setAvatarLineWidth:(CGFloat)avatarLineWidth { | 123 - (void)setAvatarLineWidth:(CGFloat)avatarLineWidth { |
| 124 parameters_.avatarLineWidth = avatarLineWidth; | 124 parameters_.avatarLineWidth = avatarLineWidth; |
| 125 } | 125 } |
| 126 | 126 |
| 127 - (void)setToolbarHidden:(BOOL)toolbarHidden { |
| 128 parameters_.toolbarHidden = toolbarHidden; |
| 129 } |
| 130 |
| 127 - (void)setHasToolbar:(BOOL)hasToolbar { | 131 - (void)setHasToolbar:(BOOL)hasToolbar { |
| 128 parameters_.hasToolbar = hasToolbar; | 132 parameters_.hasToolbar = hasToolbar; |
| 129 } | 133 } |
| 130 | 134 |
| 131 - (void)setHasLocationBar:(BOOL)hasLocationBar { | 135 - (void)setHasLocationBar:(BOOL)hasLocationBar { |
| 132 parameters_.hasLocationBar = hasLocationBar; | 136 parameters_.hasLocationBar = hasLocationBar; |
| 133 } | 137 } |
| 134 | 138 |
| 135 - (void)setToolbarHeight:(CGFloat)toolbarHeight { | 139 - (void)setToolbarHeight:(CGFloat)toolbarHeight { |
| 136 parameters_.toolbarHeight = toolbarHeight; | 140 parameters_.toolbarHeight = toolbarHeight; |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 chrome::LayoutParameters parameters = parameters_; | 268 chrome::LayoutParameters parameters = parameters_; |
| 265 CGFloat maxY = maxY_; | 269 CGFloat maxY = maxY_; |
| 266 | 270 |
| 267 // Sanity-check |maxY|. | 271 // Sanity-check |maxY|. |
| 268 DCHECK_GE(maxY, 0); | 272 DCHECK_GE(maxY, 0); |
| 269 DCHECK_LE(maxY, parameters_.contentViewSize.height + fullscreenYOffset_); | 273 DCHECK_LE(maxY, parameters_.contentViewSize.height + fullscreenYOffset_); |
| 270 | 274 |
| 271 CGFloat width = parameters_.contentViewSize.width; | 275 CGFloat width = parameters_.contentViewSize.width; |
| 272 | 276 |
| 273 // Lay out the toolbar. | 277 // Lay out the toolbar. |
| 274 if (parameters.hasToolbar) { | 278 if (!parameters.toolbarHidden) { |
| 275 output_.toolbarFrame = NSMakeRect( | 279 if (parameters.hasToolbar) { |
| 276 0, maxY - parameters_.toolbarHeight, width, parameters_.toolbarHeight); | 280 output_.toolbarFrame = NSMakeRect(0, maxY - parameters_.toolbarHeight, |
| 277 maxY = NSMinY(output_.toolbarFrame); | 281 width, parameters_.toolbarHeight); |
| 278 } else if (parameters_.hasLocationBar) { | 282 maxY = NSMinY(output_.toolbarFrame); |
| 279 CGFloat toolbarX = kLocBarLeftRightInset; | 283 } else if (parameters_.hasLocationBar) { |
| 280 CGFloat toolbarY = maxY - parameters_.toolbarHeight - kLocBarTopInset; | 284 CGFloat toolbarX = kLocBarLeftRightInset; |
| 281 CGFloat toolbarWidth = width - 2 * kLocBarLeftRightInset; | 285 CGFloat toolbarY = maxY - parameters_.toolbarHeight - kLocBarTopInset; |
| 282 output_.toolbarFrame = | 286 CGFloat toolbarWidth = width - 2 * kLocBarLeftRightInset; |
| 283 NSMakeRect(toolbarX, toolbarY, toolbarWidth, parameters_.toolbarHeight); | 287 output_.toolbarFrame = NSMakeRect(toolbarX, toolbarY, toolbarWidth, |
| 284 maxY = NSMinY(output_.toolbarFrame) - kLocBarBottomInset; | 288 parameters_.toolbarHeight); |
| 289 maxY = NSMinY(output_.toolbarFrame) - kLocBarBottomInset; |
| 290 } |
| 285 } | 291 } |
| 286 | 292 |
| 287 // Lay out the bookmark bar, if it's above the info bar. | 293 // Lay out the bookmark bar, if it's above the info bar. |
| 288 if (!parameters.bookmarkBarHidden && | 294 if (!parameters.bookmarkBarHidden && |
| 289 !parameters.placeBookmarkBarBelowInfoBar) { | 295 !parameters.placeBookmarkBarBelowInfoBar) { |
| 290 output_.bookmarkFrame = NSMakeRect(0, | 296 output_.bookmarkFrame = NSMakeRect(0, |
| 291 maxY - parameters.bookmarkBarHeight, | 297 maxY - parameters.bookmarkBarHeight, |
| 292 width, | 298 width, |
| 293 parameters.bookmarkBarHeight); | 299 parameters.bookmarkBarHeight); |
| 294 maxY = NSMinY(output_.bookmarkFrame); | 300 maxY = NSMinY(output_.bookmarkFrame); |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 | 400 |
| 395 @end | 401 @end |
| 396 | 402 |
| 397 @implementation BrowserWindowLayout (ExposedForTesting) | 403 @implementation BrowserWindowLayout (ExposedForTesting) |
| 398 | 404 |
| 399 - (void)setOSYosemiteOrLater:(BOOL)osYosemiteOrLater { | 405 - (void)setOSYosemiteOrLater:(BOOL)osYosemiteOrLater { |
| 400 parameters_.isOSYosemiteOrLater = osYosemiteOrLater; | 406 parameters_.isOSYosemiteOrLater = osYosemiteOrLater; |
| 401 } | 407 } |
| 402 | 408 |
| 403 @end | 409 @end |
| OLD | NEW |