Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Side by Side Diff: chrome/browser/ui/cocoa/browser_window_layout.h

Issue 555243002: mac: Refactor browser_window_controller layout logic. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fullscreen_layout
Patch Set: Comments from andresantoso. Renames, header file changes, no functional changes. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 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_LAYOUT_H_
6 #define CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_LAYOUT_H_
7
8 #import <Cocoa/Cocoa.h>
9
10 #import "chrome/browser/ui/cocoa/presentation_mode_controller.h"
11
12 namespace mac_browser {
13
14 // The height of the tab strip.
15 extern const CGFloat kTabStripHeight;
16
17 // The parameters used to calculate the layout of the views managed by the
18 // BrowserWindowController.
19 struct LayoutParameters {
20 NSSize contentViewSize;
21 NSSize windowSize;
22
23 // Whether the controller is in any fullscreen mode. This parameter should be
24 // NO if the controller is in the process of entering fullscreen.
25 BOOL inAnyFullscreen;
26 fullscreen_mac::SlidingStyle slidingStyle;
27 CGFloat menubarOffset;
28 CGFloat toolbarFraction;
29
30 BOOL hasTabStrip;
31
32 BOOL hasToolbar;
33 CGFloat toolbarHeight;
34
35 BOOL hasLocationBar;
36
37 BOOL placeBookmarkBarBelowInfoBar;
38 BOOL bookmarkBarHidden;
39 CGFloat bookmarkBarHeight;
40
41 // The height of the info bar, not including the top arrow.
42 CGFloat infoBarHeight;
43 // The maximum allowed height of the top arrow.
44 CGFloat infoBarMaxTopArrowHeight;
45
46 BOOL hasDownloadShelf;
47 CGFloat downloadShelfHeight;
48 };
49
50 // The output frames of the views managed by the BrowserWindowController.
51 struct LayoutOutput {
52 NSRect tabStripFrame;
53 NSRect toolbarFrame;
54 NSRect bookmarkFrame;
55 NSRect fullscreenBackingBarFrame;
56 CGFloat findBarMaxY;
57 CGFloat fullscreenExitButtonMaxY;
58 NSRect infoBarFrame;
59 CGFloat infoBarMaxTopArrowHeight;
60 NSRect downloadShelfFrame;
61 NSRect contentAreaFrame;
62 };
63
64 } // namespace mac_browser
65
66 // Calculates the layout of the views managed by the BrowserWindowController.
67 @interface BrowserWindowLayout : NSObject {
68 @private
69 // Input parameters.
70 mac_browser::LayoutParameters parameters_;
71
72 // Output.
73 mac_browser::LayoutOutput output_;
74
75 // The offset of the maxY of the tab strip during fullscreen mode.
76 CGFloat fullscreenYOffset_;
77
78 // The views are laid out from highest Y to lowest Y. This variable holds the
79 // current highest Y that the next view is expected to be laid under.
80 CGFloat maxY_;
81 }
82
83 // Returns the height of the info bar container.
84 + (CGFloat)infoBarContainerHeightFromInfoBarHeight:(CGFloat)infoBarHeight
85 maxTopArrowHeight:(CGFloat)maxTopArrowHeight;
86
87 // Designated initializer.
88 - (instancetype)init;
89
90 // ----------------Methods that configure input parameters----------------------
91 - (void)setContentViewSize:(NSSize)size;
92 - (void)setWindowSize:(NSSize)size;
93
94 // Whether the controller is in any fullscreen mode. |inAnyFullscreen| should
95 // be NO if the controller is in the process of entering fullscreen.
96 - (void)setInAnyFullscreen:(BOOL)inAnyFullscreen;
97 - (void)setFullscreenSlidingStyle:(fullscreen_mac::SlidingStyle)slidingStyle;
98 - (void)setFullscreenMenubarOffset:(CGFloat)menubarOffset;
99 - (void)setFullscreenToolbarFraction:(CGFloat)toolbarFraction;
100
101 - (void)setHasTabStrip:(BOOL)hasTabStrip;
102
103 - (void)setHasToolbar:(BOOL)hasToolbar;
104 - (void)setHasLocationBar:(BOOL)hasLocationBar;
105 - (void)setToolbarHeight:(CGFloat)toolbarHeight;
106
107 - (void)setBookmarkBarHidden:(BOOL)bookmarkBarHidden;
108 - (void)setPlaceBookmarkBarBelowInfoBar:(BOOL)placeBookmarkBarBelowInfoBar;
109 - (void)setBookmarkBarHeight:(CGFloat)bookmarkBarHeight;
110
111 // The height of the info bar, not including the top arrow.
112 - (void)setInfoBarHeight:(CGFloat)infoBarHeight;
113 // The maximum allowed height of the top arrow.
114 - (void)setInfoBarMaxTopArrowHeight:(CGFloat)infoBarMaxTopArrowHeight;
115
116 - (void)setHasDownloadShelf:(BOOL)hasDownloadShelf;
117 - (void)setDownloadShelfHeight:(CGFloat)downloadShelfHeight;
118
119 // ----------------Methods that generate output---------------------------------
120 // Performs the layout computation and returns the results.
121 - (mac_browser::LayoutOutput)computeLayout;
122
123 @end
124
125 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_LAYOUT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698