• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
4 
5 #ifndef CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_PRIVATE_H_
6 #define CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_PRIVATE_H_
7 
8 #import "chrome/browser/ui/cocoa/browser_window_controller.h"
9 
10 // Private methods for the |BrowserWindowController|. This category should
11 // contain the private methods used by different parts of the BWC; private
12 // methods used only by single parts should be declared in their own file.
13 // TODO(viettrungluu): [crbug.com/35543] work on splitting out stuff from the
14 // BWC, and figuring out which methods belong here (need to unravel
15 // "dependencies").
16 @interface BrowserWindowController(Private)
17 
18 // Create the appropriate tab strip controller based on whether or not side
19 // tabs are enabled. Replaces the current controller.
20 - (void)createTabStripController;
21 
22 // Saves the window's position in the local state preferences.
23 - (void)saveWindowPositionIfNeeded;
24 
25 // We need to adjust where sheets come out of the window, as by default they
26 // erupt from the omnibox, which is rather weird.
27 - (NSRect)window:(NSWindow*)window
28     willPositionSheet:(NSWindow*)sheet
29             usingRect:(NSRect)defaultSheetRect;
30 
31 // Repositions the window's subviews. From the top down: toolbar, normal
32 // bookmark bar (if shown), infobar, NTP detached bookmark bar (if shown),
33 // content area, download shelf (if any).
34 - (void)layoutSubviews;
35 
36 // Find the total height of the floating bar (in presentation mode). Safe to
37 // call even when not in presentation mode.
38 - (CGFloat)floatingBarHeight;
39 
40 // Shows the informational "how to exit fullscreen" bubble.
41 - (void)showFullscreenExitBubbleIfNecessary;
42 - (void)destroyFullscreenExitBubbleIfNecessary;
43 
44 // Lays out the tab strip at the given maximum y-coordinate, with the given
45 // width, possibly for fullscreen mode; returns the new maximum y (below the
46 // tab strip). This is safe to call even when there is no tab strip.
47 - (CGFloat)layoutTabStripAtMaxY:(CGFloat)maxY
48                           width:(CGFloat)width
49                      fullscreen:(BOOL)fullscreen;
50 
51 // Lays out the toolbar (or just location bar for popups) at the given maximum
52 // y-coordinate, with the given width; returns the new maximum y (below the
53 // toolbar).
54 - (CGFloat)layoutToolbarAtMinX:(CGFloat)minX
55                           maxY:(CGFloat)maxY
56                          width:(CGFloat)width;
57 
58 // Returns YES if the bookmark bar should be placed below the infobar, NO
59 // otherwise.
60 - (BOOL)placeBookmarkBarBelowInfoBar;
61 
62 // Lays out the bookmark bar at the given maximum y-coordinate, with the given
63 // width; returns the new maximum y (below the bookmark bar). Note that one must
64 // call it with the appropriate |maxY| which depends on whether or not the
65 // bookmark bar is shown as the NTP bubble or not (use
66 // |-placeBookmarkBarBelowInfoBar|).
67 - (CGFloat)layoutBookmarkBarAtMinX:(CGFloat)minX
68                               maxY:(CGFloat)maxY
69                              width:(CGFloat)width;
70 
71 // Lay out the view which draws the background for the floating bar when in
72 // presentation mode, with the given frame and presentation-mode-status. Should
73 // be called even when not in presentation mode to hide the backing view.
74 - (void)layoutFloatingBarBackingView:(NSRect)frame
75                     presentationMode:(BOOL)presentationMode;
76 
77 // Lays out the infobar at the given maximum y-coordinate, with the given width;
78 // returns the new maximum y (below the infobar).
79 - (CGFloat)layoutInfoBarAtMinX:(CGFloat)minX
80                           maxY:(CGFloat)maxY
81                          width:(CGFloat)width;
82 
83 // Lays out the download shelf, if there is one, at the given minimum
84 // y-coordinate, with the given width; returns the new minimum y (above the
85 // download shelf). This is safe to call even if there is no download shelf.
86 - (CGFloat)layoutDownloadShelfAtMinX:(CGFloat)minX
87                                 minY:(CGFloat)minY
88                                width:(CGFloat)width;
89 
90 // Lays out the tab content area in the given frame. If the height changes,
91 // sends a message to the renderer to resize.
92 - (void)layoutTabContentArea:(NSRect)frame;
93 
94 // Sets the toolbar's height to a value appropriate for the given compression.
95 // Also adjusts the bookmark bar's height by the opposite amount in order to
96 // keep the total height of the two views constant.
97 - (void)adjustToolbarAndBookmarkBarForCompression:(CGFloat)compression;
98 
99 // Moves views between windows in preparation for fullscreen mode when not using
100 // Cocoa's System Fullscreen API.  (System Fullscreen reuses the original window
101 // for fullscreen mode, so there is no need to move views around.)  This method
102 // does not position views; callers must also call |-layoutSubviews:|.
103 - (void)moveViewsForImmersiveFullscreen:(BOOL)fullscreen
104                           regularWindow:(NSWindow*)regularWindow
105                        fullscreenWindow:(NSWindow*)fullscreenWindow;
106 
107 // Sets presentation mode, creating the PresentationModeController if needed and
108 // forcing a relayout.  If |forceDropdown| is YES, this method will always
109 // initially show the floating bar when entering presentation mode, even if the
110 // floating bar does not have focus.  This method is safe to call on all OS
111 // versions.
112 - (void)setPresentationModeInternal:(BOOL)presentationMode
113                       forceDropdown:(BOOL)forceDropdown;
114 
115 // Enter or exit fullscreen without using Cocoa's System Fullscreen API.  These
116 // methods are internal implementations of |-setFullscreen:|.
117 - (void)enterImmersiveFullscreen;
118 - (void)exitImmersiveFullscreen;
119 
120 // Register or deregister for content view resize notifications.  These
121 // notifications are used while transitioning into fullscreen mode using Cocoa's
122 // System Fullscreen API.
123 - (void)registerForContentViewResizeNotifications;
124 - (void)deregisterForContentViewResizeNotifications;
125 
126 // Adjust the UI when entering or leaving presentation mode.  This method is
127 // safe to call on all OS versions.
128 - (void)adjustUIForPresentationMode:(BOOL)fullscreen;
129 
130 // Allows/prevents bar visibility locks and releases from updating the visual
131 // state. Enabling makes changes instantaneously; disabling cancels any
132 // timers/animation.
133 - (void)enableBarVisibilityUpdates;
134 - (void)disableBarVisibilityUpdates;
135 
136 // The opacity for the toolbar divider; 0 means that it shouldn't be shown.
137 - (CGFloat)toolbarDividerOpacity;
138 
139 // Ensures the z-order of subviews is correct.
140 - (void)updateSubviewZOrder:(BOOL)inPresentationMode;
141 
142 - (void)updateAllowOverlappingViews:(BOOL)inPresentationMode;
143 
144 // Update visibility of the infobar tip, depending on the state of the window.
145 - (void)updateInfoBarTipVisibility;
146 
147 @end  // @interface BrowserWindowController(Private)
148 
149 #endif  // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_PRIVATE_H_
150