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

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 rsesek. 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 // The size of the content view of the window.
21 NSSize contentViewSize;
22 // The size of the window.
23 NSSize windowSize;
24
25 // Whether the controller is in any fullscreen mode. This parameter should be
26 // NO if the controller is in the process of entering fullscreen.
27 BOOL inAnyFullscreen;
28 // The fullscreen sliding style. See presentation_mode_controller.h for more
29 // details.
30 fullscreen_mac::SlidingStyle slidingStyle;
31 // The minY of the AppKit Menu Bar, relative to the top of the screen. Ranges
32 // from 0 to -22. Only relevant in fullscreen mode.
33 CGFloat menubarOffset;
34 // The fraction of the sliding toolbar that is visible in fullscreenm mode.
35 // Ranges from 0 to 1. Only relevant in fullscreen mode.
36 CGFloat toolbarFraction;
37
38 BOOL hasTabStrip;
39
40 BOOL hasToolbar;
41 BOOL hasLocationBar;
42 CGFloat toolbarHeight;
43
44 BOOL bookmarkBarHidden;
45 // If the bookmark bar is not hidden, then the bookmark bar should either be
46 // directly below the omnibox, or directly below the info bar. This parameter
47 // selects between those 2 cases.
48 BOOL placeBookmarkBarBelowInfoBar;
49 CGFloat bookmarkBarHeight;
50
51 // The height of the info bar, not including the top arrow.
52 CGFloat infoBarHeight;
53 // The distance from the bottom of the location icon to the bottom of the
54 // toolbar.
55 CGFloat pageInfoBubblePointY;
56
57 BOOL hasDownloadShelf;
58 CGFloat downloadShelfHeight;
59 };
60
61 // The output frames of the views managed by the BrowserWindowController.
62 struct LayoutOutput {
63 NSRect tabStripFrame;
64 NSRect toolbarFrame;
65 NSRect bookmarkFrame;
66 NSRect fullscreenBackingBarFrame;
67 CGFloat findBarMaxY;
68 CGFloat fullscreenExitButtonMaxY;
69 NSRect infoBarFrame;
70 CGFloat infoBarMaxTopArrowHeight;
71 NSRect downloadShelfFrame;
72 NSRect contentAreaFrame;
73 };
74
75 } // namespace mac_browser
76
77 // This class is the sole entity responsible for calculating the layout of the
78 // views managed by the BrowserWindowController. The parameters used to
79 // calculate the layout are the fields of |parameters_|. These fields should be
80 // filled by calling the appropriate setters on this class. Once the parameters
81 // have been set, calling -computeLayout will return a LayoutOutput that
82 // includes sufficient information to lay out all views managed by
83 // BrowserWindowController.
84 //
85 // This is a lightweight class. It should be created on demand.
86 @interface BrowserWindowLayout : NSObject {
87 @private
88 // Stores the parameters used to compute layout.
89 mac_browser::LayoutParameters parameters_;
90
91 // Stores the layout output as it's being computed.
92 mac_browser::LayoutOutput output_;
93
94 // The offset of the maxY of the tab strip during fullscreen mode.
95 CGFloat fullscreenYOffset_;
96
97 // The views are laid out from highest Y to lowest Y. This variable holds the
98 // current highest Y that the next view is expected to be laid under.
99 CGFloat maxY_;
100 }
101
102 // ----------------Methods that configure input parameters----------------------
103 - (void)setContentViewSize:(NSSize)size;
104 - (void)setWindowSize:(NSSize)size;
105
106 // Whether the controller is in any fullscreen mode. |inAnyFullscreen| should
107 // be NO if the controller is in the process of entering fullscreen.
108 - (void)setInAnyFullscreen:(BOOL)inAnyFullscreen;
109 - (void)setFullscreenSlidingStyle:(fullscreen_mac::SlidingStyle)slidingStyle;
110 - (void)setFullscreenMenubarOffset:(CGFloat)menubarOffset;
111 - (void)setFullscreenToolbarFraction:(CGFloat)toolbarFraction;
112
113 - (void)setHasTabStrip:(BOOL)hasTabStrip;
114
115 - (void)setHasToolbar:(BOOL)hasToolbar;
116 - (void)setHasLocationBar:(BOOL)hasLocationBar;
117 - (void)setToolbarHeight:(CGFloat)toolbarHeight;
118
119 - (void)setBookmarkBarHidden:(BOOL)bookmarkBarHidden;
120 - (void)setPlaceBookmarkBarBelowInfoBar:(BOOL)placeBookmarkBarBelowInfoBar;
121 - (void)setBookmarkBarHeight:(CGFloat)bookmarkBarHeight;
122
123 // The height of the info bar, not including the top arrow.
124 - (void)setInfoBarHeight:(CGFloat)infoBarHeight;
125 // The min Y of the bubble point, relative to the toolbar.
126 - (void)setPageInfoBubblePointY:(CGFloat)pageInfoBubblePointY;
127
128 - (void)setHasDownloadShelf:(BOOL)hasDownloadShelf;
129 - (void)setDownloadShelfHeight:(CGFloat)downloadShelfHeight;
130
131 // ----------------Methods that generate output---------------------------------
132 // Performs the layout computation and returns the results. This method is fast
133 // and does not perform any caching.
134 - (mac_browser::LayoutOutput)computeLayout;
Robert Sesek 2014/09/12 15:40:00 I'd move this to be the first method, and then rem
erikchen 2014/09/12 17:26:14 Done.
135
136 @end
137
138 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_LAYOUT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698