Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / cocoa / browser_window_controller_private.h
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 // Updates whether the bottom two corners are rounded.
95 - (void)updateRoundedBottomCorners;
96
97 // Sets the toolbar's height to a value appropriate for the given compression.
98 // Also adjusts the bookmark bar's height by the opposite amount in order to
99 // keep the total height of the two views constant.
100 - (void)adjustToolbarAndBookmarkBarForCompression:(CGFloat)compression;
101
102 // Moves views between windows in preparation for fullscreen mode when not using
103 // Cocoa's System Fullscreen API.  (System Fullscreen reuses the original window
104 // for fullscreen mode, so there is no need to move views around.)  This method
105 // does not position views; callers must also call |-layoutSubviews:|.
106 - (void)moveViewsForImmersiveFullscreen:(BOOL)fullscreen
107                           regularWindow:(NSWindow*)regularWindow
108                        fullscreenWindow:(NSWindow*)fullscreenWindow;
109
110 // Called when a permission bubble closes, and informs the presentation
111 // controller that the dropdown can be hidden.  (The dropdown should never be
112 // hidden while a permissions bubble is visible.)
113 - (void)permissionBubbleWindowWillClose:(NSNotification*)notification;
114
115 // Sets presentation mode, creating the PresentationModeController if needed and
116 // forcing a relayout.  If |forceDropdown| is YES, this method will always
117 // initially show the floating bar when entering presentation mode, even if the
118 // floating bar does not have focus.  This method is safe to call on all OS
119 // versions.
120 - (void)setPresentationModeInternal:(BOOL)presentationMode
121                       forceDropdown:(BOOL)forceDropdown;
122
123 // Enter or exit fullscreen without using Cocoa's System Fullscreen API.  These
124 // methods are internal implementations of |-setFullscreen:|.
125 - (void)enterImmersiveFullscreen;
126 - (void)exitImmersiveFullscreen;
127
128 // Register or deregister for content view resize notifications.  These
129 // notifications are used while transitioning into fullscreen mode using Cocoa's
130 // System Fullscreen API.
131 - (void)registerForContentViewResizeNotifications;
132 - (void)deregisterForContentViewResizeNotifications;
133
134 // Adjust the UI when entering or leaving presentation mode.  This method is
135 // safe to call on all OS versions.
136 - (void)adjustUIForPresentationMode:(BOOL)fullscreen;
137
138 // Allows/prevents bar visibility locks and releases from updating the visual
139 // state. Enabling makes changes instantaneously; disabling cancels any
140 // timers/animation.
141 - (void)enableBarVisibilityUpdates;
142 - (void)disableBarVisibilityUpdates;
143
144 // If there are no visibility locks and bar visibity updates are enabled, hides
145 // the bar with |animation| and |delay|.  Otherwise, does nothing.
146 - (void)hideOverlayIfPossibleWithAnimation:(BOOL)animation delay:(BOOL)delay;
147
148 // The opacity for the toolbar divider; 0 means that it shouldn't be shown.
149 - (CGFloat)toolbarDividerOpacity;
150
151 // Ensures the z-order of subviews is correct.
152 - (void)updateSubviewZOrder:(BOOL)inPresentationMode;
153
154 - (void)updateAllowOverlappingViews:(BOOL)inPresentationMode;
155
156 // Update visibility of the infobar tip, depending on the state of the window.
157 - (void)updateInfoBarTipVisibility;
158
159 @end  // @interface BrowserWindowController(Private)
160
161 #endif  // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_PRIVATE_H_