13dff810fe0cc4962a5fa554318e9bf8bc45f5274Kristian Monsen// Copyright (c) 2011 The Chromium Authors. All rights reserved. 2c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// Use of this source code is governed by a BSD-style license that can be 3c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// found in the LICENSE file. 4c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 521d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen#ifndef CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_PRIVATE_H_ 621d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen#define CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_PRIVATE_H_ 73345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick#pragma once 8c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 921d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen#import "chrome/browser/ui/cocoa/browser_window_controller.h" 10c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 11c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 12c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// Private methods for the |BrowserWindowController|. This category should 13c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// contain the private methods used by different parts of the BWC; private 14c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// methods used only by single parts should be declared in their own file. 15c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// TODO(viettrungluu): [crbug.com/35543] work on splitting out stuff from the 16c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// BWC, and figuring out which methods belong here (need to unravel 17c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// "dependencies"). 18c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch@interface BrowserWindowController(Private) 19c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 20c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// Create the appropriate tab strip controller based on whether or not side 21c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// tabs are enabled. Replaces the current controller. 22c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch- (void)createTabStripController; 23c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 24c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// Saves the window's position in the local state preferences. 25c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch- (void)saveWindowPositionIfNeeded; 26c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 27c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// Saves the window's position to the given pref service. 28c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch- (void)saveWindowPositionToPrefs:(PrefService*)prefs; 29c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 30c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// We need to adjust where sheets come out of the window, as by default they 31c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// erupt from the omnibox, which is rather weird. 32c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch- (NSRect)window:(NSWindow*)window 33c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch willPositionSheet:(NSWindow*)sheet 34c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch usingRect:(NSRect)defaultSheetRect; 35c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 36c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// Repositions the window's subviews. From the top down: toolbar, normal 37c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// bookmark bar (if shown), infobar, NTP detached bookmark bar (if shown), 38c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// content area, download shelf (if any). 39c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch- (void)layoutSubviews; 40c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 41c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// Find the total height of the floating bar (in fullscreen mode). Safe to call 42c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// even when not in fullscreen mode. 43c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch- (CGFloat)floatingBarHeight; 44c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 45c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// Lays out the tab strip at the given maximum y-coordinate, with the given 46c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// width, possibly for fullscreen mode; returns the new maximum y (below the tab 47c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// strip). This is safe to call even when there is no tab strip. 48c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch- (CGFloat)layoutTabStripAtMaxY:(CGFloat)maxY 49c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch width:(CGFloat)width 50c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch fullscreen:(BOOL)fullscreen; 51c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 52c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// Lays out the toolbar (or just location bar for popups) at the given maximum 53c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// y-coordinate, with the given width; returns the new maximum y (below the 54c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// toolbar). 55c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch- (CGFloat)layoutToolbarAtMinX:(CGFloat)minX 56c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch maxY:(CGFloat)maxY 57c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch width:(CGFloat)width; 58c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 59c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// Returns YES if the bookmark bar should be placed below the infobar, NO 60c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// otherwise. 61c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch- (BOOL)placeBookmarkBarBelowInfoBar; 62c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 63c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// Lays out the bookmark bar at the given maximum y-coordinate, with the given 64c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// width; returns the new maximum y (below the bookmark bar). Note that one must 65c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// call it with the appropriate |maxY| which depends on whether or not the 66c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// bookmark bar is shown as the NTP bubble or not (use 67c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// |-placeBookmarkBarBelowInfoBar|). 68c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch- (CGFloat)layoutBookmarkBarAtMinX:(CGFloat)minX 69c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch maxY:(CGFloat)maxY 70c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch width:(CGFloat)width; 71c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 72c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// Lay out the view which draws the background for the floating bar when in 73c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// fullscreen mode, with the given frame and fullscreen-mode-status. Should be 74c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// called even when not in fullscreen mode to hide the backing view. 75c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch- (void)layoutFloatingBarBackingView:(NSRect)frame 76c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch fullscreen:(BOOL)fullscreen; 77c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 78c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// Lays out the infobar at the given maximum y-coordinate, with the given width; 79c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// returns the new maximum y (below the infobar). 80c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch- (CGFloat)layoutInfoBarAtMinX:(CGFloat)minX 81c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch maxY:(CGFloat)maxY 82c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch width:(CGFloat)width; 83c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 84c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// Lays out the download shelf, if there is one, at the given minimum 85c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// y-coordinate, with the given width; returns the new minimum y (above the 86c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// download shelf). This is safe to call even if there is no download shelf. 87c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch- (CGFloat)layoutDownloadShelfAtMinX:(CGFloat)minX 88c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch minY:(CGFloat)minY 89c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch width:(CGFloat)width; 90c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 91c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// Lays out the tab content area in the given frame. If the height changes, 92c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// sends a message to the renderer to resize. 93c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch- (void)layoutTabContentArea:(NSRect)frame; 94c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 95c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// Should we show the normal bookmark bar? 96c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch- (BOOL)shouldShowBookmarkBar; 97c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 98c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// Is the current page one for which the bookmark should be shown detached *if* 99c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// the normal bookmark bar is not shown? 100c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch- (BOOL)shouldShowDetachedBookmarkBar; 101c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 102c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// Sets the toolbar's height to a value appropriate for the given compression. 103c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// Also adjusts the bookmark bar's height by the opposite amount in order to 104c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// keep the total height of the two views constant. 105c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch- (void)adjustToolbarAndBookmarkBarForCompression:(CGFloat)compression; 106c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 107c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// Adjust the UI when entering or leaving fullscreen mode. 108c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch- (void)adjustUIForFullscreen:(BOOL)fullscreen; 109c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 110c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// Allows/prevents bar visibility locks and releases from updating the visual 111c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// state. Enabling makes changes instantaneously; disabling cancels any 112c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// timers/animation. 113c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch- (void)enableBarVisibilityUpdates; 114c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch- (void)disableBarVisibilityUpdates; 115c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 1163dff810fe0cc4962a5fa554318e9bf8bc45f5274Kristian Monsen// For versions of Mac OS that provide an "enter fullscreen" button, make one 1173dff810fe0cc4962a5fa554318e9bf8bc45f5274Kristian Monsen// appear (in a rather hacky manner). http://crbug.com/74065 : When switching 1183dff810fe0cc4962a5fa554318e9bf8bc45f5274Kristian Monsen// the fullscreen implementation to the new API, revisit how much of this 1193dff810fe0cc4962a5fa554318e9bf8bc45f5274Kristian Monsen// hacky code is necessary. 1203dff810fe0cc4962a5fa554318e9bf8bc45f5274Kristian Monsen- (void)setUpOSFullScreenButton; 1213dff810fe0cc4962a5fa554318e9bf8bc45f5274Kristian Monsen 122c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch@end // @interface BrowserWindowController(Private) 123c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 124c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 12521d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen#endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_PRIVATE_H_ 126