• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
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 #pragma once
8 
9 #import "chrome/browser/ui/cocoa/browser_window_controller.h"
10 
11 
12 // Private methods for the |BrowserWindowController|. This category should
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.
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
17 // "dependencies").
18 @interface BrowserWindowController(Private)
19 
20 // Create the appropriate tab strip controller based on whether or not side
21 // tabs are enabled. Replaces the current controller.
22 - (void)createTabStripController;
23 
24 // Saves the window's position in the local state preferences.
25 - (void)saveWindowPositionIfNeeded;
26 
27 // Saves the window's position to the given pref service.
28 - (void)saveWindowPositionToPrefs:(PrefService*)prefs;
29 
30 // We need to adjust where sheets come out of the window, as by default they
31 // erupt from the omnibox, which is rather weird.
32 - (NSRect)window:(NSWindow*)window
33     willPositionSheet:(NSWindow*)sheet
34             usingRect:(NSRect)defaultSheetRect;
35 
36 // Repositions the window's subviews. From the top down: toolbar, normal
37 // bookmark bar (if shown), infobar, NTP detached bookmark bar (if shown),
38 // content area, download shelf (if any).
39 - (void)layoutSubviews;
40 
41 // Find the total height of the floating bar (in fullscreen mode). Safe to call
42 // even when not in fullscreen mode.
43 - (CGFloat)floatingBarHeight;
44 
45 // 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
47 // strip). This is safe to call even when there is no tab strip.
48 - (CGFloat)layoutTabStripAtMaxY:(CGFloat)maxY
49                           width:(CGFloat)width
50                      fullscreen:(BOOL)fullscreen;
51 
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
60 // otherwise.
61 - (BOOL)placeBookmarkBarBelowInfoBar;
62 
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 // fullscreen mode, with the given frame and fullscreen-mode-status. Should be
74 // called even when not in fullscreen mode to hide the backing view.
75 - (void)layoutFloatingBarBackingView:(NSRect)frame
76                           fullscreen:(BOOL)fullscreen;
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 
91 // Lays out the tab content area in the given frame. If the height changes,
92 // sends a message to the renderer to resize.
93 - (void)layoutTabContentArea:(NSRect)frame;
94 
95 // Should we show the normal bookmark bar?
96 - (BOOL)shouldShowBookmarkBar;
97 
98 // Is the current page one for which the bookmark should be shown detached *if*
99 // the normal bookmark bar is not shown?
100 - (BOOL)shouldShowDetachedBookmarkBar;
101 
102 // 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
104 // keep the total height of the two views constant.
105 - (void)adjustToolbarAndBookmarkBarForCompression:(CGFloat)compression;
106 
107 // Adjust the UI when entering or leaving fullscreen mode.
108 - (void)adjustUIForFullscreen:(BOOL)fullscreen;
109 
110 // Allows/prevents bar visibility locks and releases from updating the visual
111 // state. Enabling makes changes instantaneously; disabling cancels any
112 // timers/animation.
113 - (void)enableBarVisibilityUpdates;
114 - (void)disableBarVisibilityUpdates;
115 
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)
123 
124 
125 #endif  // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_PRIVATE_H_
126