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