| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 } | 81 } |
| 82 | 82 |
| 83 - (void)setWindowSize:(NSSize)size { | 83 - (void)setWindowSize:(NSSize)size { |
| 84 parameters_.windowSize = size; | 84 parameters_.windowSize = size; |
| 85 } | 85 } |
| 86 | 86 |
| 87 - (void)setInAnyFullscreen:(BOOL)inAnyFullscreen { | 87 - (void)setInAnyFullscreen:(BOOL)inAnyFullscreen { |
| 88 parameters_.inAnyFullscreen = inAnyFullscreen; | 88 parameters_.inAnyFullscreen = inAnyFullscreen; |
| 89 } | 89 } |
| 90 | 90 |
| 91 - (void)setFullscreenSlidingStyle:(fullscreen_mac::SlidingStyle)slidingStyle { | 91 - (void)setSlidingStyle:(FullscreenSlidingStyle)slidingStyle { |
| 92 parameters_.slidingStyle = slidingStyle; | 92 parameters_.slidingStyle = slidingStyle; |
| 93 } | 93 } |
| 94 | 94 |
| 95 - (void)setFullscreenMenubarOffset:(CGFloat)menubarOffset { | 95 - (void)setFullscreenMenubarOffset:(CGFloat)menubarOffset { |
| 96 parameters_.menubarOffset = menubarOffset; | 96 parameters_.menubarOffset = menubarOffset; |
| 97 } | 97 } |
| 98 | 98 |
| 99 - (void)setFullscreenToolbarFraction:(CGFloat)toolbarFraction { | 99 - (void)setFullscreenToolbarFraction:(CGFloat)toolbarFraction { |
| 100 parameters_.toolbarFraction = toolbarFraction; | 100 parameters_.toolbarFraction = toolbarFraction; |
| 101 } | 101 } |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 if (parameters_.inAnyFullscreen) { | 289 if (parameters_.inAnyFullscreen) { |
| 290 output_.fullscreenBackingBarFrame = | 290 output_.fullscreenBackingBarFrame = |
| 291 NSMakeRect(0, maxY, width, [self fullscreenBackingBarHeight]); | 291 NSMakeRect(0, maxY, width, [self fullscreenBackingBarHeight]); |
| 292 } | 292 } |
| 293 | 293 |
| 294 // Place the find bar immediately below the toolbar/attached bookmark bar. | 294 // Place the find bar immediately below the toolbar/attached bookmark bar. |
| 295 output_.findBarMaxY = maxY; | 295 output_.findBarMaxY = maxY; |
| 296 output_.fullscreenExitButtonMaxY = maxY; | 296 output_.fullscreenExitButtonMaxY = maxY; |
| 297 | 297 |
| 298 if (parameters_.inAnyFullscreen && | 298 if (parameters_.inAnyFullscreen && |
| 299 (parameters_.slidingStyle == fullscreen_mac::OMNIBOX_TABS_HIDDEN || | 299 (parameters_.slidingStyle == |
| 300 parameters_.slidingStyle == fullscreen_mac::OMNIBOX_TABS_NONE)) { | 300 FullscreenSlidingStyle::OMNIBOX_TABS_HIDDEN || |
| 301 parameters_.slidingStyle == FullscreenSlidingStyle::OMNIBOX_TABS_NONE)) { |
| 301 // If in presentation mode, reset |maxY| to top of screen, so that the | 302 // If in presentation mode, reset |maxY| to top of screen, so that the |
| 302 // floating bar slides over the things which appear to be in the content | 303 // floating bar slides over the things which appear to be in the content |
| 303 // area. | 304 // area. |
| 304 maxY = parameters_.windowSize.height; | 305 maxY = parameters_.windowSize.height; |
| 305 } | 306 } |
| 306 | 307 |
| 307 // Lay out the info bar. It is never hidden. | 308 // Lay out the info bar. It is never hidden. |
| 308 if (parameters_.infoBarHeight != 0) { | 309 if (parameters_.infoBarHeight != 0) { |
| 309 CGFloat infoBarMaxY = maxY; | 310 CGFloat infoBarMaxY = maxY; |
| 310 CGFloat infoBarMinY = maxY - parameters_.infoBarHeight; | 311 CGFloat infoBarMinY = maxY - parameters_.infoBarHeight; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 340 | 341 |
| 341 // Layout the download shelf at the bottom of the content view. | 342 // Layout the download shelf at the bottom of the content view. |
| 342 CGFloat minY = 0; | 343 CGFloat minY = 0; |
| 343 if (parameters.hasDownloadShelf) { | 344 if (parameters.hasDownloadShelf) { |
| 344 output_.downloadShelfFrame = | 345 output_.downloadShelfFrame = |
| 345 NSMakeRect(0, 0, width, parameters.downloadShelfHeight); | 346 NSMakeRect(0, 0, width, parameters.downloadShelfHeight); |
| 346 minY = NSMaxY(output_.downloadShelfFrame); | 347 minY = NSMaxY(output_.downloadShelfFrame); |
| 347 } | 348 } |
| 348 | 349 |
| 349 if (parameters_.inAnyFullscreen && | 350 if (parameters_.inAnyFullscreen && |
| 350 parameters_.slidingStyle == fullscreen_mac::OMNIBOX_TABS_PRESENT) { | 351 parameters_.slidingStyle == |
| 352 FullscreenSlidingStyle::OMNIBOX_TABS_PRESENT) { |
| 351 // If in Canonical Fullscreen, content should be shifted down by an amount | 353 // If in Canonical Fullscreen, content should be shifted down by an amount |
| 352 // equal to all the widgets and views at the top of the window. It should | 354 // equal to all the widgets and views at the top of the window. It should |
| 353 // not be further shifted by the appearance/disappearance of the AppKit | 355 // not be further shifted by the appearance/disappearance of the AppKit |
| 354 // menu bar. | 356 // menu bar. |
| 355 maxY = parameters_.windowSize.height; | 357 maxY = parameters_.windowSize.height; |
| 356 maxY -= NSHeight(output_.toolbarFrame) + | 358 maxY -= NSHeight(output_.toolbarFrame) + |
| 357 NSHeight(output_.tabStripLayout.frame) + | 359 NSHeight(output_.tabStripLayout.frame) + |
| 358 NSHeight(output_.bookmarkFrame) + parameters.infoBarHeight; | 360 NSHeight(output_.bookmarkFrame) + parameters.infoBarHeight; |
| 359 } | 361 } |
| 360 | 362 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 386 | 388 |
| 387 @end | 389 @end |
| 388 | 390 |
| 389 @implementation BrowserWindowLayout (ExposedForTesting) | 391 @implementation BrowserWindowLayout (ExposedForTesting) |
| 390 | 392 |
| 391 - (void)setOSYosemiteOrLater:(BOOL)osYosemiteOrLater { | 393 - (void)setOSYosemiteOrLater:(BOOL)osYosemiteOrLater { |
| 392 parameters_.isOSYosemiteOrLater = osYosemiteOrLater; | 394 parameters_.isOSYosemiteOrLater = osYosemiteOrLater; |
| 393 } | 395 } |
| 394 | 396 |
| 395 @end | 397 @end |
| OLD | NEW |