1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
|
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_PRIVATE_H_
#define CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_PRIVATE_H_
#pragma once
#import "chrome/browser/ui/cocoa/browser_window_controller.h"
// Private methods for the |BrowserWindowController|. This category should
// contain the private methods used by different parts of the BWC; private
// methods used only by single parts should be declared in their own file.
// TODO(viettrungluu): [crbug.com/35543] work on splitting out stuff from the
// BWC, and figuring out which methods belong here (need to unravel
// "dependencies").
@interface BrowserWindowController(Private)
// Create the appropriate tab strip controller based on whether or not side
// tabs are enabled. Replaces the current controller.
- (void)createTabStripController;
// Creates the button used to toggle presentation mode. Must only be called on
// Lion or later. Does nothing if the button already exists.
- (void)createAndInstallPresentationModeToggleButton;
// Saves the window's position in the local state preferences.
- (void)saveWindowPositionIfNeeded;
// We need to adjust where sheets come out of the window, as by default they
// erupt from the omnibox, which is rather weird.
- (NSRect)window:(NSWindow*)window
willPositionSheet:(NSWindow*)sheet
usingRect:(NSRect)defaultSheetRect;
// Repositions the window's subviews. From the top down: toolbar, normal
// bookmark bar (if shown), infobar, NTP detached bookmark bar (if shown),
// content area, download shelf (if any).
- (void)layoutSubviews;
// Find the total height of the floating bar (in presentation mode). Safe to
// call even when not in presentation mode.
- (CGFloat)floatingBarHeight;
// Shows the informational "how to exit fullscreen" bubble.
- (void)showFullscreenExitBubbleIfNecessary;
- (void)destroyFullscreenExitBubbleIfNecessary;
// Lays out the presentation mode toggle button at the top right corner of the
// overlay. Creates the button if needed, and removes it if it is not needed.
// This method is safe to call on all OS versions.
- (void)layoutPresentationModeToggleAtOverlayMaxX:(CGFloat)maxX
overlayMaxY:(CGFloat)maxY;
// Lays out the tab strip at the given maximum y-coordinate, with the given
// width, possibly for fullscreen mode; returns the new maximum y (below the
// tab strip). This is safe to call even when there is no tab strip.
- (CGFloat)layoutTabStripAtMaxY:(CGFloat)maxY
width:(CGFloat)width
fullscreen:(BOOL)fullscreen;
// Lays out the toolbar (or just location bar for popups) at the given maximum
// y-coordinate, with the given width; returns the new maximum y (below the
// toolbar).
- (CGFloat)layoutToolbarAtMinX:(CGFloat)minX
maxY:(CGFloat)maxY
width:(CGFloat)width;
// Returns YES if the bookmark bar should be placed below the infobar, NO
// otherwise.
- (BOOL)placeBookmarkBarBelowInfoBar;
// Lays out the bookmark bar at the given maximum y-coordinate, with the given
// width; returns the new maximum y (below the bookmark bar). Note that one must
// call it with the appropriate |maxY| which depends on whether or not the
// bookmark bar is shown as the NTP bubble or not (use
// |-placeBookmarkBarBelowInfoBar|).
- (CGFloat)layoutBookmarkBarAtMinX:(CGFloat)minX
maxY:(CGFloat)maxY
width:(CGFloat)width;
// Lay out the view which draws the background for the floating bar when in
// presentation mode, with the given frame and presentation-mode-status. Should
// be called even when not in presentation mode to hide the backing view.
- (void)layoutFloatingBarBackingView:(NSRect)frame
presentationMode:(BOOL)presentationMode;
// Lays out the infobar at the given maximum y-coordinate, with the given width;
// returns the new maximum y (below the infobar).
- (CGFloat)layoutInfoBarAtMinX:(CGFloat)minX
maxY:(CGFloat)maxY
width:(CGFloat)width;
// Lays out the download shelf, if there is one, at the given minimum
// y-coordinate, with the given width; returns the new minimum y (above the
// download shelf). This is safe to call even if there is no download shelf.
- (CGFloat)layoutDownloadShelfAtMinX:(CGFloat)minX
minY:(CGFloat)minY
width:(CGFloat)width;
// Lays out the tab content area in the given frame. If the height changes,
// sends a message to the renderer to resize.
- (void)layoutTabContentArea:(NSRect)frame;
// Should we show the normal bookmark bar?
- (BOOL)shouldShowBookmarkBar;
// Is the current page one for which the bookmark should be shown detached *if*
// the normal bookmark bar is not shown?
- (BOOL)shouldShowDetachedBookmarkBar;
// Sets the toolbar's height to a value appropriate for the given compression.
// Also adjusts the bookmark bar's height by the opposite amount in order to
// keep the total height of the two views constant.
- (void)adjustToolbarAndBookmarkBarForCompression:(CGFloat)compression;
// Gets and sets whether to default to presentation mode when entering
// fullscreen on Lion or later. On Leopard and Snow Leopard, this preference is
// ignored (fullscreen mode always turns presentation mode on). This method is
// safe to call on all OS versions.
- (BOOL)shouldUsePresentationModeWhenEnteringFullscreen;
- (void)setShouldUsePresentationModeWhenEnteringFullscreen:(BOOL)flag;
// Whether to show the presentation mode toggle button in the UI. Returns YES
// if in fullscreen mode on Lion or later. This method is safe to call on all
// OS versions.
- (BOOL)shouldShowPresentationModeToggle;
// Moves views between windows in preparation for fullscreen mode on Snow
// Leopard or earlier. (Lion and later reuses the original window for
// fullscreen mode, so there is no need to move views around.) This method does
// not position views; callers must also call |-layoutSubviews|. This method
// must not be called on Lion or later.
- (void)moveViewsForFullscreenForSnowLeopardOrEarlier:(BOOL)fullscreen
regularWindow:(NSWindow*)regularWindow
fullscreenWindow:(NSWindow*)fullscreenWindow;
// Sets presentation mode, creating the PresentationModeController if needed and
// forcing a relayout. If |forceDropdown| is YES, this method will always
// initially show the floating bar when entering presentation mode, even if the
// floating bar does not have focus. This method is safe to call on all OS
// versions.
- (void)setPresentationModeInternal:(BOOL)presentationMode
forceDropdown:(BOOL)forceDropdown;
// Called on Snow Leopard or earlier to enter or exit fullscreen. These methods
// are internal implementations of |-setFullscreen:|. These methods must not be
// called on Lion or later.
- (void)enterFullscreenForSnowLeopardOrEarlier;
- (void)exitFullscreenForSnowLeopardOrEarlier;
// Register or deregister for content view resize notifications. These
// notifications are used while transitioning to fullscreen mode in Lion or
// later. This method is safe to call on all OS versions.
- (void)registerForContentViewResizeNotifications;
- (void)deregisterForContentViewResizeNotifications;
// Adjust the UI when entering or leaving presentation mode. This method is
// safe to call on all OS versions.
- (void)adjustUIForPresentationMode:(BOOL)fullscreen;
// Allows/prevents bar visibility locks and releases from updating the visual
// state. Enabling makes changes instantaneously; disabling cancels any
// timers/animation.
- (void)enableBarVisibilityUpdates;
- (void)disableBarVisibilityUpdates;
@end // @interface BrowserWindowController(Private)
#endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_PRIVATE_H_
|