1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_PRIVATE_H_
6 #define CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_PRIVATE_H_
8 #import "chrome/browser/ui/cocoa/browser_window_controller.h"
10 namespace browser_window_controller
{
12 enum CoreAnimationStatus
{
13 kCoreAnimationDisabled
,
14 kCoreAnimationEnabledLazy
,
15 kCoreAnimationEnabledAlways
,
18 } // namespace browser_window_controller
20 // Private methods for the |BrowserWindowController|. This category should
21 // contain the private methods used by different parts of the BWC; private
22 // methods used only by single parts should be declared in their own file.
23 // TODO(viettrungluu): [crbug.com/35543] work on splitting out stuff from the
24 // BWC, and figuring out which methods belong here (need to unravel
26 @interface
BrowserWindowController(Private
)
28 // Create the appropriate tab strip controller based on whether or not side
29 // tabs are enabled. Replaces the current controller.
30 - (void)createTabStripController
;
32 // Saves the window's position in the local state preferences.
33 - (void)saveWindowPositionIfNeeded
;
35 // We need to adjust where sheets come out of the window, as by default they
36 // erupt from the omnibox, which is rather weird.
37 - (NSRect
)window
:(NSWindow
*)window
38 willPositionSheet
:(NSWindow
*)sheet
39 usingRect
:(NSRect
)defaultSheetRect
;
41 // Repositions the window's subviews. From the top down: toolbar, normal
42 // bookmark bar (if shown), infobar, NTP detached bookmark bar (if shown),
43 // content area, download shelf (if any).
44 - (void)layoutSubviews
;
46 // Find the total height of the floating bar (in presentation mode). Safe to
47 // call even when not in presentation mode.
48 - (CGFloat
)floatingBarHeight
;
50 // Shows the informational "how to exit fullscreen" bubble.
51 - (void)showFullscreenExitBubbleIfNecessary
;
52 - (void)destroyFullscreenExitBubbleIfNecessary
;
54 // Lays out the tab strip at the given maximum y-coordinate, with the given
55 // width, possibly for fullscreen mode; returns the new maximum y (below the
56 // tab strip). This is safe to call even when there is no tab strip.
57 - (CGFloat
)layoutTabStripAtMaxY
:(CGFloat
)maxY
59 fullscreen
:(BOOL
)fullscreen
;
61 // Lays out the toolbar (or just location bar for popups) at the given maximum
62 // y-coordinate, with the given width; returns the new maximum y (below the
64 - (CGFloat
)layoutToolbarAtMinX
:(CGFloat
)minX
68 // Returns YES if the bookmark bar should be placed below the infobar, NO
70 - (BOOL
)placeBookmarkBarBelowInfoBar
;
72 // Lays out the bookmark bar at the given maximum y-coordinate, with the given
73 // width; returns the new maximum y (below the bookmark bar). Note that one must
74 // call it with the appropriate |maxY| which depends on whether or not the
75 // bookmark bar is shown as the NTP bubble or not (use
76 // |-placeBookmarkBarBelowInfoBar|).
77 - (CGFloat
)layoutBookmarkBarAtMinX
:(CGFloat
)minX
81 // Lay out the view which draws the background for the floating bar when in
82 // presentation mode, with the given frame and presentation-mode-status. Should
83 // be called even when not in presentation mode to hide the backing view.
84 - (void)layoutFloatingBarBackingView
:(NSRect
)frame
85 presentationMode
:(BOOL
)presentationMode
;
87 // Lays out the infobar at the given maximum y-coordinate, with the given width;
88 // returns the new maximum y (below the infobar).
89 - (CGFloat
)layoutInfoBarAtMinX
:(CGFloat
)minX
93 // Lays out the download shelf, if there is one, at the given minimum
94 // y-coordinate, with the given width; returns the new minimum y (above the
95 // download shelf). This is safe to call even if there is no download shelf.
96 - (CGFloat
)layoutDownloadShelfAtMinX
:(CGFloat
)minX
100 // Lays out the tab content area in the given frame. If the height changes,
101 // sends a message to the renderer to resize.
102 - (void)layoutTabContentArea
:(NSRect
)frame
;
104 // Sets the toolbar's height to a value appropriate for the given compression.
105 // Also adjusts the bookmark bar's height by the opposite amount in order to
106 // keep the total height of the two views constant.
107 - (void)adjustToolbarAndBookmarkBarForCompression
:(CGFloat
)compression
;
109 // Whether to show the presentation mode toggle button in the UI. Returns YES
110 // if in fullscreen mode on Lion or later. This method is safe to call on all
112 - (BOOL
)shouldShowPresentationModeToggle
;
114 // Moves views between windows in preparation for fullscreen mode on Snow
115 // Leopard. (Lion and later reuses the original window for
116 // fullscreen mode, so there is no need to move views around.) This method does
117 // not position views; callers must also call |-layoutSubviews|. This method
118 // must not be called on Lion or later.
119 - (void)moveViewsForFullscreenForSnowLeopard
:(BOOL
)fullscreen
120 regularWindow
:(NSWindow
*)regularWindow
121 fullscreenWindow
:(NSWindow
*)fullscreenWindow
;
123 // Sets presentation mode, creating the PresentationModeController if needed and
124 // forcing a relayout. If |forceDropdown| is YES, this method will always
125 // initially show the floating bar when entering presentation mode, even if the
126 // floating bar does not have focus. This method is safe to call on all OS
128 - (void)setPresentationModeInternal
:(BOOL
)presentationMode
129 forceDropdown
:(BOOL
)forceDropdown
;
131 // Called on Snow Leopard or earlier to enter or exit fullscreen. These methods
132 // are internal implementations of |-setFullscreen:|. These methods must not be
133 // called on Lion or later.
134 - (void)enterFullscreenForSnowLeopard
;
135 - (void)exitFullscreenForSnowLeopard
;
137 // Register or deregister for content view resize notifications. These
138 // notifications are used while transitioning to fullscreen mode in Lion or
139 // later. This method is safe to call on all OS versions.
140 - (void)registerForContentViewResizeNotifications
;
141 - (void)deregisterForContentViewResizeNotifications
;
143 // Adjust the UI when entering or leaving presentation mode. This method is
144 // safe to call on all OS versions.
145 - (void)adjustUIForPresentationMode
:(BOOL
)fullscreen
;
147 // Allows/prevents bar visibility locks and releases from updating the visual
148 // state. Enabling makes changes instantaneously; disabling cancels any
150 - (void)enableBarVisibilityUpdates
;
151 - (void)disableBarVisibilityUpdates
;
153 // The opacity for the toolbar divider; 0 means that it shouldn't be shown.
154 - (CGFloat
)toolbarDividerOpacity
;
156 // Ensures the z-order of subviews is correct.
157 - (void)updateSubviewZOrder
:(BOOL
)inPresentationMode
;
159 - (void)updateAllowOverlappingViews
:(BOOL
)inPresentationMode
;
161 // Update visibility of the infobar tip, depending on the state of the window.
162 - (void)updateInfoBarTipVisibility
;
164 // Checks if core animation should be enabled or not.
165 - (browser_window_controller::CoreAnimationStatus
)coreAnimationStatus
;
167 @end
// @interface BrowserWindowController(Private)
169 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_PRIVATE_H_