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

Side by Side Diff: chrome/browser/ui/cocoa/browser_window_layout.mm

Issue 2467833003: [Mac] Move the fullscreen toolbar style to FullscreenToolbarController (Closed)
Patch Set: fix for rsesek Created 4 years, 1 month 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
OLDNEW
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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 } 92 }
93 93
94 - (void)setWindowSize:(NSSize)size { 94 - (void)setWindowSize:(NSSize)size {
95 parameters_.windowSize = size; 95 parameters_.windowSize = size;
96 } 96 }
97 97
98 - (void)setInAnyFullscreen:(BOOL)inAnyFullscreen { 98 - (void)setInAnyFullscreen:(BOOL)inAnyFullscreen {
99 parameters_.inAnyFullscreen = inAnyFullscreen; 99 parameters_.inAnyFullscreen = inAnyFullscreen;
100 } 100 }
101 101
102 - (void)setSlidingStyle:(FullscreenSlidingStyle)slidingStyle { 102 - (void)setFullscreenToolbarStyle:(FullscreenToolbarStyle)style {
103 parameters_.slidingStyle = slidingStyle; 103 parameters_.toolbarStyle = style;
104 } 104 }
105 105
106 - (void)setFullscreenMenubarOffset:(CGFloat)menubarOffset { 106 - (void)setFullscreenMenubarOffset:(CGFloat)menubarOffset {
107 parameters_.menubarOffset = menubarOffset; 107 parameters_.menubarOffset = menubarOffset;
108 } 108 }
109 109
110 - (void)setFullscreenToolbarFraction:(CGFloat)toolbarFraction { 110 - (void)setFullscreenToolbarFraction:(CGFloat)toolbarFraction {
111 parameters_.toolbarFraction = toolbarFraction; 111 parameters_.toolbarFraction = toolbarFraction;
112 } 112 }
113 113
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 // Lay out the backing bar in fullscreen mode. 305 // Lay out the backing bar in fullscreen mode.
306 if (parameters_.inAnyFullscreen) { 306 if (parameters_.inAnyFullscreen) {
307 output_.fullscreenBackingBarFrame = 307 output_.fullscreenBackingBarFrame =
308 NSMakeRect(0, maxY, width, [self fullscreenBackingBarHeight]); 308 NSMakeRect(0, maxY, width, [self fullscreenBackingBarHeight]);
309 } 309 }
310 310
311 // Place the find bar immediately below the toolbar/attached bookmark bar. 311 // Place the find bar immediately below the toolbar/attached bookmark bar.
312 output_.findBarMaxY = maxY; 312 output_.findBarMaxY = maxY;
313 313
314 if (parameters_.inAnyFullscreen && 314 if (parameters_.inAnyFullscreen &&
315 (parameters_.slidingStyle == 315 (parameters_.toolbarStyle == FullscreenToolbarStyle::TOOLBAR_HIDDEN ||
316 FullscreenSlidingStyle::OMNIBOX_TABS_HIDDEN || 316 parameters_.toolbarStyle == FullscreenToolbarStyle::TOOLBAR_NONE)) {
317 parameters_.slidingStyle == FullscreenSlidingStyle::OMNIBOX_TABS_NONE)) { 317 // If the toolbar is hidden or missing, reset |maxY| to top of screen, so
318 // If in presentation mode, reset |maxY| to top of screen, so that the 318 // that the toolbar slides over the things which appear to be in the
319 // floating bar slides over the things which appear to be in the content 319 // content area.
320 // area.
321 maxY = parameters_.windowSize.height; 320 maxY = parameters_.windowSize.height;
322 } 321 }
323 322
324 // Lay out the info bar. It is never hidden. 323 // Lay out the info bar. It is never hidden.
325 if (parameters_.infoBarHeight != 0) { 324 if (parameters_.infoBarHeight != 0) {
326 CGFloat infoBarMaxY = maxY; 325 CGFloat infoBarMaxY = maxY;
327 CGFloat infoBarMinY = maxY - parameters_.infoBarHeight; 326 CGFloat infoBarMinY = maxY - parameters_.infoBarHeight;
328 327
329 // If there's a toolbar, then the frame needs to be high enough to 328 // If there's a toolbar, then the frame needs to be high enough to
330 // accomodate the top arrow, which might stretch all the way to the page 329 // accomodate the top arrow, which might stretch all the way to the page
(...skipping 26 matching lines...) Expand all
357 356
358 // Layout the download shelf at the bottom of the content view. 357 // Layout the download shelf at the bottom of the content view.
359 CGFloat minY = 0; 358 CGFloat minY = 0;
360 if (parameters.hasDownloadShelf) { 359 if (parameters.hasDownloadShelf) {
361 output_.downloadShelfFrame = 360 output_.downloadShelfFrame =
362 NSMakeRect(0, 0, width, parameters.downloadShelfHeight); 361 NSMakeRect(0, 0, width, parameters.downloadShelfHeight);
363 minY = NSMaxY(output_.downloadShelfFrame); 362 minY = NSMaxY(output_.downloadShelfFrame);
364 } 363 }
365 364
366 if (parameters_.inAnyFullscreen && 365 if (parameters_.inAnyFullscreen &&
367 parameters_.slidingStyle == 366 parameters_.toolbarStyle == FullscreenToolbarStyle::TOOLBAR_PRESENT) {
368 FullscreenSlidingStyle::OMNIBOX_TABS_PRESENT) {
369 // If in Canonical Fullscreen, content should be shifted down by an amount 367 // If in Canonical Fullscreen, content should be shifted down by an amount
370 // equal to all the widgets and views at the top of the window. It should 368 // equal to all the widgets and views at the top of the window. It should
371 // not be further shifted by the appearance/disappearance of the AppKit 369 // not be further shifted by the appearance/disappearance of the AppKit
372 // menu bar. 370 // menu bar.
373 maxY = parameters_.windowSize.height; 371 maxY = parameters_.windowSize.height;
374 maxY -= NSHeight(output_.toolbarFrame) + 372 maxY -= NSHeight(output_.toolbarFrame) +
375 NSHeight(output_.tabStripLayout.frame) + 373 NSHeight(output_.tabStripLayout.frame) +
376 NSHeight(output_.bookmarkFrame) + parameters.infoBarHeight; 374 NSHeight(output_.bookmarkFrame) + parameters.infoBarHeight;
377 } 375 }
378 376
(...skipping 25 matching lines...) Expand all
404 402
405 @end 403 @end
406 404
407 @implementation BrowserWindowLayout (ExposedForTesting) 405 @implementation BrowserWindowLayout (ExposedForTesting)
408 406
409 - (void)setOSYosemiteOrLater:(BOOL)osYosemiteOrLater { 407 - (void)setOSYosemiteOrLater:(BOOL)osYosemiteOrLater {
410 parameters_.isOSYosemiteOrLater = osYosemiteOrLater; 408 parameters_.isOSYosemiteOrLater = osYosemiteOrLater;
411 } 409 }
412 410
413 @end 411 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_layout.h ('k') | chrome/browser/ui/cocoa/browser_window_layout_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698