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"
9 #import "chrome/browser/ui/cocoa/browser_window_layout.h"
10 #import "chrome/browser/ui/cocoa/presentation_mode_controller.h"
12 @
class BrowserWindowLayout
;
14 // Private methods for the |BrowserWindowController|. This category should
15 // contain the private methods used by different parts of the BWC; private
16 // methods used only by single parts should be declared in their own file.
17 // TODO(viettrungluu): [crbug.com/35543] work on splitting out stuff from the
18 // BWC, and figuring out which methods belong here (need to unravel
20 @interface
BrowserWindowController(Private
)
22 // Create the appropriate tab strip controller based on whether or not side
23 // tabs are enabled. Replaces the current controller.
24 - (void)createTabStripController
;
26 // Saves the window's position in the local state preferences.
27 - (void)saveWindowPositionIfNeeded
;
29 // We need to adjust where sheets come out of the window, as by default they
30 // erupt from the omnibox, which is rather weird.
31 - (NSRect
)window
:(NSWindow
*)window
32 willPositionSheet
:(NSWindow
*)sheet
33 usingRect
:(NSRect
)defaultSheetRect
;
35 // Repositions the window's subviews. From the top down: toolbar, normal
36 // bookmark bar (if shown), infobar, NTP detached bookmark bar (if shown),
37 // content area, download shelf (if any).
38 - (void)layoutSubviews
;
40 // Shows the informational "how to exit fullscreen" bubble.
41 - (void)showFullscreenExitBubbleIfNecessary
;
42 - (void)destroyFullscreenExitBubbleIfNecessary
;
44 // Lays out the tab strip and avatar button.
45 - (void)applyTabStripLayout
:(const chrome::TabStripLayout
&)layout
;
47 // Returns YES if the bookmark bar should be placed below the infobar, NO
49 - (BOOL
)placeBookmarkBarBelowInfoBar
;
52 // Lays out the tab content area in the given frame. If the height changes,
53 // sends a message to the renderer to resize.
54 - (void)layoutTabContentArea
:(NSRect
)frame
;
56 // Sets the toolbar's height to a value appropriate for the given compression.
57 // Also adjusts the bookmark bar's height by the opposite amount in order to
58 // keep the total height of the two views constant.
59 - (void)adjustToolbarAndBookmarkBarForCompression
:(CGFloat
)compression
;
61 // Moves views between windows in preparation for fullscreen mode when not using
62 // Cocoa's System Fullscreen API. (System Fullscreen reuses the original window
63 // for fullscreen mode, so there is no need to move views around.) This method
64 // does not position views; callers must also call |-layoutSubviews:|.
65 - (void)moveViewsForImmersiveFullscreen
:(BOOL
)fullscreen
66 regularWindow
:(NSWindow
*)regularWindow
67 fullscreenWindow
:(NSWindow
*)fullscreenWindow
;
69 // Called when a permission bubble closes, and informs the presentation
70 // controller that the dropdown can be hidden. (The dropdown should never be
71 // hidden while a permissions bubble is visible.)
72 - (void)permissionBubbleWindowWillClose
:(NSNotification
*)notification
;
74 // Enter or exit fullscreen without using Cocoa's System Fullscreen API. These
75 // methods are internal implementations of |-setFullscreen:|.
76 - (void)enterImmersiveFullscreen
;
77 - (void)exitImmersiveFullscreen
;
79 // Register or deregister for content view resize notifications. These
80 // notifications are used while transitioning into fullscreen mode using Cocoa's
81 // System Fullscreen API.
82 - (void)registerForContentViewResizeNotifications
;
83 - (void)deregisterForContentViewResizeNotifications
;
85 // Allows/prevents bar visibility locks and releases from updating the visual
86 // state. Enabling makes changes instantaneously; disabling cancels any
88 - (void)enableBarVisibilityUpdates
;
89 - (void)disableBarVisibilityUpdates
;
91 // If there are no visibility locks and bar visibity updates are enabled, hides
92 // the bar with |animation| and |delay|. Otherwise, does nothing.
93 - (void)hideOverlayIfPossibleWithAnimation
:(BOOL
)animation delay
:(BOOL
)delay
;
95 // The opacity for the toolbar divider; 0 means that it shouldn't be shown.
96 - (CGFloat
)toolbarDividerOpacity
;
98 // Update visibility of the infobar tip, depending on the state of the window.
99 - (void)updateInfoBarTipVisibility
;
101 // The min Y of the bubble point in the coordinate space of the toolbar.
102 - (NSInteger
)pageInfoBubblePointY
;
104 // Configures the presentationModeController_ right after it is constructed.
105 - (void)configurePresentationModeController
;
107 // Allows the omnibox to slide. Also prepares UI for several fullscreen modes.
108 // This method gets called when entering AppKit fullscren, or when entering
109 // Immersive fullscreen. Expects fullscreenStyle_ to be set.
110 - (void)adjustUIForSlidingFullscreenStyle
:(fullscreen_mac::SlidingStyle
)style
;
112 // This method gets called when exiting AppKit fullscreen, or when exiting
113 // Immersive fullscreen. It performs some common UI changes, and stops the
114 // omnibox from sliding.
115 - (void)adjustUIForExitingFullscreenAndStopOmniboxSliding
;
117 // Exposed for testing.
118 // Creates a PresentationModeController with the given style.
119 - (PresentationModeController
*)newPresentationModeControllerWithStyle
:
120 (fullscreen_mac::SlidingStyle
)style
;
122 // Toggles the AppKit Fullscreen API. By default, doing so enters Canonical
124 - (void)enterAppKitFullscreen
;
125 - (void)exitAppKitFullscreen
;
127 // Returns where the fullscreen button should be positioned in the window.
128 // Returns NSZeroRect if there is no fullscreen button (if currently in
129 // fullscreen, or if running 10.6 or 10.10+).
130 - (NSRect
)fullscreenButtonFrame
;
132 // Updates |layout| with the full set of parameters required to statelessly
133 // determine the layout of the views managed by this controller.
134 - (void)updateLayoutParameters
:(BrowserWindowLayout
*)layout
;
136 // Applies a layout to the views managed by this controller.
137 - (void)applyLayout
:(BrowserWindowLayout
*)layout
;
139 // Ensures that the window's content view's subviews have the correct
140 // z-ordering. Will add or remove subviews as necessary.
141 - (void)updateSubviewZOrder
;
143 // Performs updateSubviewZOrder when this controller is not in fullscreen.
144 - (void)updateSubviewZOrderNormal
;
146 // Performs updateSubviewZOrder when this controller is in fullscreen.
147 - (void)updateSubviewZOrderFullscreen
;
149 // Sets the content view's subviews. Attempts to not touch the tabContentArea
150 // to prevent redraws.
151 - (void)setContentViewSubviews
:(NSArray
*)subviews
;
153 // There is a bug in Mavericks for applications linked against OSX 10.8 and
154 // earlier. The bug requires Screens Have Separate Spaces to be enabled, and
155 // for the window to be on a secondary screen. When AppKit Fullscreen is
156 // invoked on the window, its final frame is 22pt too short. These methods
157 // detect when the relevant conditions have been met so that a hack can be
158 // applied to fix the size of the window.
159 // http://crbug.com/396980
160 + (BOOL
)systemSettingsRequireMavericksAppKitFullscreenHack
;
161 - (BOOL
)shouldUseMavericksAppKitFullscreenHack
;
163 // Whether the instance should use a custom transition when animating into and
164 // out of AppKit Fullscreen.
165 - (BOOL
)shouldUseCustomAppKitFullscreenTransition
;
167 @end
// @interface BrowserWindowController(Private)
169 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_PRIVATE_H_