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