Reland "mac: Implement custom AppKit Enter Fullscreen transition."
[chromium-blink-merge.git] / chrome / browser / ui / cocoa / browser_window_controller_private.h
blob341c42886e2dbe56667ace8ae2a52c0830cb9706
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
19 // "dependencies").
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
48 // otherwise.
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
87 // timers/animation.
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
123 // Fullscreen.
124 - (void)enterAppKitFullscreen;
125 - (void)exitAppKitFullscreen;
127 // Updates |layout| with the full set of parameters required to statelessly
128 // determine the layout of the views managed by this controller.
129 - (void)updateLayoutParameters:(BrowserWindowLayout*)layout;
131 // Applies a layout to the views managed by this controller.
132 - (void)applyLayout:(BrowserWindowLayout*)layout;
134 // Ensures that the window's content view's subviews have the correct
135 // z-ordering. Will add or remove subviews as necessary.
136 - (void)updateSubviewZOrder;
138 // Performs updateSubviewZOrder when this controller is not in fullscreen.
139 - (void)updateSubviewZOrderNormal;
141 // Performs updateSubviewZOrder when this controller is in fullscreen.
142 - (void)updateSubviewZOrderFullscreen;
144 // Sets the content view's subviews. Attempts to not touch the tabContentArea
145 // to prevent redraws.
146 - (void)setContentViewSubviews:(NSArray*)subviews;
148 // There is a bug in Mavericks for applications linked against OSX 10.8 and
149 // earlier. The bug requires Screens Have Separate Spaces to be enabled, and
150 // for the window to be on a secondary screen. When AppKit Fullscreen is
151 // invoked on the window, its final frame is 22pt too short. These methods
152 // detect when the relevant conditions have been met so that a hack can be
153 // applied to fix the size of the window.
154 // http://crbug.com/396980
155 + (BOOL)systemSettingsRequireMavericksAppKitFullscreenHack;
156 - (BOOL)shouldUseMavericksAppKitFullscreenHack;
158 // Whether the instance should use a custom transition when animating into and
159 // out of AppKit Fullscreen.
160 - (BOOL)shouldUseCustomAppKitFullscreenTransition;
162 @end // @interface BrowserWindowController(Private)
164 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_PRIVATE_H_