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 // Updates whether the bottom two corners are rounded. | 59 // Updates whether the bottom two corners are rounded. |
96 - (void)updateRoundedBottomCorners; | 60 - (void)updateRoundedBottomCorners; |
97 | 61 |
98 // Sets the toolbar's height to a value appropriate for the given compression. | 62 // Sets the toolbar's height to a value appropriate for the given compression. |
99 // Also adjusts the bookmark bar's height by the opposite amount in order to | 63 // Also adjusts the bookmark bar's height by the opposite amount in order to |
(...skipping 30 matching lines...) Expand all Loading... | |
130 - (void)enableBarVisibilityUpdates; | 94 - (void)enableBarVisibilityUpdates; |
131 - (void)disableBarVisibilityUpdates; | 95 - (void)disableBarVisibilityUpdates; |
132 | 96 |
133 // If there are no visibility locks and bar visibity updates are enabled, hides | 97 // If there are no visibility locks and bar visibity updates are enabled, hides |
134 // the bar with |animation| and |delay|. Otherwise, does nothing. | 98 // the bar with |animation| and |delay|. Otherwise, does nothing. |
135 - (void)hideOverlayIfPossibleWithAnimation:(BOOL)animation delay:(BOOL)delay; | 99 - (void)hideOverlayIfPossibleWithAnimation:(BOOL)animation delay:(BOOL)delay; |
136 | 100 |
137 // The opacity for the toolbar divider; 0 means that it shouldn't be shown. | 101 // The opacity for the toolbar divider; 0 means that it shouldn't be shown. |
138 - (CGFloat)toolbarDividerOpacity; | 102 - (CGFloat)toolbarDividerOpacity; |
139 | 103 |
140 // Ensures the z-order of subviews is correct. | |
141 - (void)updateSubviewZOrder:(BOOL)inPresentationMode; | |
142 | |
143 // Update visibility of the infobar tip, depending on the state of the window. | 104 // Update visibility of the infobar tip, depending on the state of the window. |
144 - (void)updateInfoBarTipVisibility; | 105 - (void)updateInfoBarTipVisibility; |
145 | 106 |
146 // Returns the max top arrow height for infobar. | 107 // The min Y of the bubble point, relative to the toolbar. |
Robert Sesek
2014/09/12 15:40:00
In what coordinate space?
erikchen
2014/09/12 17:26:14
updated comment
| |
147 - (NSInteger)infoBarMaxTopArrowHeight; | 108 - (NSInteger)pageInfoBubblePointY; |
148 | 109 |
149 // Configures the presentationModeController_ right after it is constructed. | 110 // Configures the presentationModeController_ right after it is constructed. |
150 - (void)configurePresentationModeController; | 111 - (void)configurePresentationModeController; |
151 | 112 |
152 // Allows the omnibox to slide. Also prepares UI for several fullscreen modes. | 113 // Allows the omnibox to slide. Also prepares UI for several fullscreen modes. |
153 // This method gets called when entering AppKit fullscren, or when entering | 114 // This method gets called when entering AppKit fullscren, or when entering |
154 // Immersive fullscreen. Expects fullscreenStyle_ to be set. | 115 // Immersive fullscreen. Expects fullscreenStyle_ to be set. |
155 - (void)adjustUIForSlidingFullscreenStyle:(fullscreen_mac::SlidingStyle)style; | 116 - (void)adjustUIForSlidingFullscreenStyle:(fullscreen_mac::SlidingStyle)style; |
156 | 117 |
157 // This method gets called when exiting AppKit fullscreen, or when exiting | 118 // This method gets called when exiting AppKit fullscreen, or when exiting |
158 // Immersive fullscreen. It performs some common UI changes, and stops the | 119 // Immersive fullscreen. It performs some common UI changes, and stops the |
159 // omnibox from sliding. | 120 // omnibox from sliding. |
160 - (void)adjustUIForExitingFullscreenAndStopOmniboxSliding; | 121 - (void)adjustUIForExitingFullscreenAndStopOmniboxSliding; |
161 | 122 |
162 // Exposed for testing. | 123 // Exposed for testing. |
163 // Creates a PresentationModeController with the given style. | 124 // Creates a PresentationModeController with the given style. |
164 - (PresentationModeController*)newPresentationModeControllerWithStyle: | 125 - (PresentationModeController*)newPresentationModeControllerWithStyle: |
165 (fullscreen_mac::SlidingStyle)style; | 126 (fullscreen_mac::SlidingStyle)style; |
166 | 127 |
167 // Toggles the AppKit Fullscreen API. By default, doing so enters Canonical | 128 // Toggles the AppKit Fullscreen API. By default, doing so enters Canonical |
168 // Fullscreen. | 129 // Fullscreen. |
169 - (void)enterAppKitFullscreen; | 130 - (void)enterAppKitFullscreen; |
170 - (void)exitAppKitFullscreen; | 131 - (void)exitAppKitFullscreen; |
171 | 132 |
133 // Updates |layout| with the full set of parameters required to statelessly | |
134 // determine the layout of the views managed by this controller. | |
135 - (void)updateLayoutParameters:(BrowserWindowLayout*)layout; | |
136 | |
137 // Applies a layout to the views managed by this controller. | |
138 - (void)applyLayout:(BrowserWindowLayout*)layout; | |
139 | |
140 // Ensures that the window's content view's subviews have the correct | |
141 // z-ordering. Will add or remove subviews as necessary. | |
142 - (void)updateSubviewZOrder; | |
143 | |
144 // Performs updateSubviewZOrder when this controller is not in fullscreen. | |
145 - (void)updateSubviewZOrderNormal; | |
146 | |
147 // Performs updateSubviewZOrder when this controller is in fullscreen. | |
148 - (void)updateSubviewZOrderFullscreen; | |
149 | |
150 // Sets the content view's subviews. Attempts to not touch the tabContentArea | |
151 // to prevent redraws. | |
152 - (void)setContentViewSubviews:(NSArray*)subviews; | |
153 | |
154 // A hack required to get NSThemeFrame sub layers to order correctly. See | |
155 // implementation for more details. | |
156 - (void)updateSubviewZOrderHack; | |
157 | |
172 @end // @interface BrowserWindowController(Private) | 158 @end // @interface BrowserWindowController(Private) |
173 | 159 |
174 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_PRIVATE_H_ | 160 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_PRIVATE_H_ |
OLD | NEW |