OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 | 7 |
8 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 8 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
9 #import "chrome/browser/ui/cocoa/presentation_mode_controller.h" | 9 #import "chrome/browser/ui/cocoa/presentation_mode_controller.h" |
10 | 10 |
| 11 @class BrowserWindowLayout; |
| 12 |
11 // Private methods for the |BrowserWindowController|. This category should | 13 // Private methods for the |BrowserWindowController|. This category should |
12 // contain the private methods used by different parts of the BWC; private | 14 // contain the private methods used by different parts of the BWC; private |
13 // methods used only by single parts should be declared in their own file. | 15 // methods used only by single parts should be declared in their own file. |
14 // TODO(viettrungluu): [crbug.com/35543] work on splitting out stuff from the | 16 // TODO(viettrungluu): [crbug.com/35543] work on splitting out stuff from the |
15 // BWC, and figuring out which methods belong here (need to unravel | 17 // BWC, and figuring out which methods belong here (need to unravel |
16 // "dependencies"). | 18 // "dependencies"). |
17 @interface BrowserWindowController(Private) | 19 @interface BrowserWindowController(Private) |
18 | 20 |
19 // Create the appropriate tab strip controller based on whether or not side | 21 // Create the appropriate tab strip controller based on whether or not side |
20 // tabs are enabled. Replaces the current controller. | 22 // tabs are enabled. Replaces the current controller. |
21 - (void)createTabStripController; | 23 - (void)createTabStripController; |
22 | 24 |
23 // Saves the window's position in the local state preferences. | 25 // Saves the window's position in the local state preferences. |
24 - (void)saveWindowPositionIfNeeded; | 26 - (void)saveWindowPositionIfNeeded; |
25 | 27 |
26 // We need to adjust where sheets come out of the window, as by default they | 28 // We need to adjust where sheets come out of the window, as by default they |
27 // erupt from the omnibox, which is rather weird. | 29 // erupt from the omnibox, which is rather weird. |
28 - (NSRect)window:(NSWindow*)window | 30 - (NSRect)window:(NSWindow*)window |
29 willPositionSheet:(NSWindow*)sheet | 31 willPositionSheet:(NSWindow*)sheet |
30 usingRect:(NSRect)defaultSheetRect; | 32 usingRect:(NSRect)defaultSheetRect; |
31 | 33 |
32 // Repositions the window's subviews. From the top down: toolbar, normal | 34 // Repositions the window's subviews. From the top down: toolbar, normal |
33 // bookmark bar (if shown), infobar, NTP detached bookmark bar (if shown), | 35 // bookmark bar (if shown), infobar, NTP detached bookmark bar (if shown), |
34 // content area, download shelf (if any). | 36 // content area, download shelf (if any). |
35 - (void)layoutSubviews; | 37 - (void)layoutSubviews; |
36 | 38 |
37 // Find the total height of the floating bar (in presentation mode). Safe to | |
38 // call even when not in presentation mode. | |
39 - (CGFloat)floatingBarHeight; | |
40 | |
41 // Shows the informational "how to exit fullscreen" bubble. | 39 // Shows the informational "how to exit fullscreen" bubble. |
42 - (void)showFullscreenExitBubbleIfNecessary; | 40 - (void)showFullscreenExitBubbleIfNecessary; |
43 - (void)destroyFullscreenExitBubbleIfNecessary; | 41 - (void)destroyFullscreenExitBubbleIfNecessary; |
44 | 42 |
45 // Lays out the tab strip at the given maximum y-coordinate, with the given | 43 // 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 | 44 // width, possibly for fullscreen mode; returns the new maximum y (below the |
47 // tab strip). This is safe to call even when there is no tab strip. | 45 // tab strip). This is safe to call even when there is no tab strip. |
48 - (CGFloat)layoutTabStripAtMaxY:(CGFloat)maxY | 46 - (CGFloat)layoutTabStripAtMaxY:(CGFloat)maxY |
49 width:(CGFloat)width | 47 width:(CGFloat)width |
50 fullscreen:(BOOL)fullscreen; | 48 fullscreen:(BOOL)fullscreen; |
51 | 49 |
52 // 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 | |
54 // toolbar). | |
55 - (CGFloat)layoutToolbarAtMinX:(CGFloat)minX | |
56 maxY:(CGFloat)maxY | |
57 width:(CGFloat)width; | |
58 | |
59 // Returns YES if the bookmark bar should be placed below the infobar, NO | 50 // Returns YES if the bookmark bar should be placed below the infobar, NO |
60 // otherwise. | 51 // otherwise. |
61 - (BOOL)placeBookmarkBarBelowInfoBar; | 52 - (BOOL)placeBookmarkBarBelowInfoBar; |
62 | 53 |
63 // 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 | |
65 // 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 | |
67 // |-placeBookmarkBarBelowInfoBar|). | |
68 - (CGFloat)layoutBookmarkBarAtMinX:(CGFloat)minX | |
69 maxY:(CGFloat)maxY | |
70 width:(CGFloat)width; | |
71 | |
72 // Lay out the view which draws the background for the floating bar when in | |
73 // presentation mode, with the given frame and presentation-mode-status. Should | |
74 // be called even when not in presentation mode to hide the backing view. | |
75 - (void)layoutFloatingBarBackingView:(NSRect)frame | |
76 presentationMode:(BOOL)presentationMode; | |
77 | |
78 // Lays out the infobar at the given maximum y-coordinate, with the given width; | |
79 // returns the new maximum y (below the infobar). | |
80 - (CGFloat)layoutInfoBarAtMinX:(CGFloat)minX | |
81 maxY:(CGFloat)maxY | |
82 width:(CGFloat)width; | |
83 | |
84 // 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 | |
86 // download shelf). This is safe to call even if there is no download shelf. | |
87 - (CGFloat)layoutDownloadShelfAtMinX:(CGFloat)minX | |
88 minY:(CGFloat)minY | |
89 width:(CGFloat)width; | |
90 | 54 |
91 // Lays out the tab content area in the given frame. If the height changes, | 55 // Lays out the tab content area in the given frame. If the height changes, |
92 // sends a message to the renderer to resize. | 56 // sends a message to the renderer to resize. |
93 - (void)layoutTabContentArea:(NSRect)frame; | 57 - (void)layoutTabContentArea:(NSRect)frame; |
94 | 58 |
95 // Sets the toolbar's height to a value appropriate for the given compression. | 59 // Sets the toolbar's height to a value appropriate for the given compression. |
96 // Also adjusts the bookmark bar's height by the opposite amount in order to | 60 // Also adjusts the bookmark bar's height by the opposite amount in order to |
97 // keep the total height of the two views constant. | 61 // keep the total height of the two views constant. |
98 - (void)adjustToolbarAndBookmarkBarForCompression:(CGFloat)compression; | 62 - (void)adjustToolbarAndBookmarkBarForCompression:(CGFloat)compression; |
99 | 63 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 - (CGFloat)toolbarDividerOpacity; | 99 - (CGFloat)toolbarDividerOpacity; |
136 | 100 |
137 // When a view does not have a layer, but it has multiple subviews with layers, | 101 // When a view does not have a layer, but it has multiple subviews with layers, |
138 // the ordering of the layers is not well defined. Removing a subview and | 102 // the ordering of the layers is not well defined. Removing a subview and |
139 // re-adding it to the same position has the side effect of updating the layer | 103 // re-adding it to the same position has the side effect of updating the layer |
140 // ordering to better reflect the subview ordering. | 104 // ordering to better reflect the subview ordering. |
141 // This is a hack needed because NSThemeFrame is not layer backed, but it has | 105 // This is a hack needed because NSThemeFrame is not layer backed, but it has |
142 // multiple direct subviews which are. http://crbug.com/413009 | 106 // multiple direct subviews which are. http://crbug.com/413009 |
143 - (void)updateLayerOrdering:(NSView*)view; | 107 - (void)updateLayerOrdering:(NSView*)view; |
144 | 108 |
145 // Ensures the z-order of subviews is correct. | |
146 - (void)updateSubviewZOrder:(BOOL)inPresentationMode; | |
147 | |
148 // Update visibility of the infobar tip, depending on the state of the window. | 109 // Update visibility of the infobar tip, depending on the state of the window. |
149 - (void)updateInfoBarTipVisibility; | 110 - (void)updateInfoBarTipVisibility; |
150 | 111 |
151 // Returns the max top arrow height for infobar. | 112 // The min Y of the bubble point in the coordinate space of the toolbar. |
152 - (NSInteger)infoBarMaxTopArrowHeight; | 113 - (NSInteger)pageInfoBubblePointY; |
153 | 114 |
154 // Configures the presentationModeController_ right after it is constructed. | 115 // Configures the presentationModeController_ right after it is constructed. |
155 - (void)configurePresentationModeController; | 116 - (void)configurePresentationModeController; |
156 | 117 |
157 // Allows the omnibox to slide. Also prepares UI for several fullscreen modes. | 118 // Allows the omnibox to slide. Also prepares UI for several fullscreen modes. |
158 // This method gets called when entering AppKit fullscren, or when entering | 119 // This method gets called when entering AppKit fullscren, or when entering |
159 // Immersive fullscreen. Expects fullscreenStyle_ to be set. | 120 // Immersive fullscreen. Expects fullscreenStyle_ to be set. |
160 - (void)adjustUIForSlidingFullscreenStyle:(fullscreen_mac::SlidingStyle)style; | 121 - (void)adjustUIForSlidingFullscreenStyle:(fullscreen_mac::SlidingStyle)style; |
161 | 122 |
162 // This method gets called when exiting AppKit fullscreen, or when exiting | 123 // This method gets called when exiting AppKit fullscreen, or when exiting |
163 // Immersive fullscreen. It performs some common UI changes, and stops the | 124 // Immersive fullscreen. It performs some common UI changes, and stops the |
164 // omnibox from sliding. | 125 // omnibox from sliding. |
165 - (void)adjustUIForExitingFullscreenAndStopOmniboxSliding; | 126 - (void)adjustUIForExitingFullscreenAndStopOmniboxSliding; |
166 | 127 |
167 // Exposed for testing. | 128 // Exposed for testing. |
168 // Creates a PresentationModeController with the given style. | 129 // Creates a PresentationModeController with the given style. |
169 - (PresentationModeController*)newPresentationModeControllerWithStyle: | 130 - (PresentationModeController*)newPresentationModeControllerWithStyle: |
170 (fullscreen_mac::SlidingStyle)style; | 131 (fullscreen_mac::SlidingStyle)style; |
171 | 132 |
172 // Toggles the AppKit Fullscreen API. By default, doing so enters Canonical | 133 // Toggles the AppKit Fullscreen API. By default, doing so enters Canonical |
173 // Fullscreen. | 134 // Fullscreen. |
174 - (void)enterAppKitFullscreen; | 135 - (void)enterAppKitFullscreen; |
175 - (void)exitAppKitFullscreen; | 136 - (void)exitAppKitFullscreen; |
176 | 137 |
| 138 // Updates |layout| with the full set of parameters required to statelessly |
| 139 // determine the layout of the views managed by this controller. |
| 140 - (void)updateLayoutParameters:(BrowserWindowLayout*)layout; |
| 141 |
| 142 // Applies a layout to the views managed by this controller. |
| 143 - (void)applyLayout:(BrowserWindowLayout*)layout; |
| 144 |
| 145 // Ensures that the window's content view's subviews have the correct |
| 146 // z-ordering. Will add or remove subviews as necessary. |
| 147 - (void)updateSubviewZOrder; |
| 148 |
| 149 // Performs updateSubviewZOrder when this controller is not in fullscreen. |
| 150 - (void)updateSubviewZOrderNormal; |
| 151 |
| 152 // Performs updateSubviewZOrder when this controller is in fullscreen. |
| 153 - (void)updateSubviewZOrderFullscreen; |
| 154 |
| 155 // Sets the content view's subviews. Attempts to not touch the tabContentArea |
| 156 // to prevent redraws. |
| 157 - (void)setContentViewSubviews:(NSArray*)subviews; |
| 158 |
| 159 // A hack required to get NSThemeFrame sub layers to order correctly. See |
| 160 // implementation for more details. |
| 161 - (void)updateSubviewZOrderHack; |
| 162 |
177 @end // @interface BrowserWindowController(Private) | 163 @end // @interface BrowserWindowController(Private) |
178 | 164 |
179 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_PRIVATE_H_ | 165 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_PRIVATE_H_ |
OLD | NEW |