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

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, round 2. 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 {
Robert Sesek 2014/09/11 03:11:13 namespace chrome
erikchen 2014/09/12 00:21:29 thestig claims that 'namespace chrome' isn't used
Robert Sesek 2014/09/12 15:40:00 For C++ classes in //chrome/ I definitely agree an
erikchen 2014/09/12 17:26:14 Still need a namespace, since there's an extern'ed
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;
Robert Sesek 2014/09/11 03:11:14 Document, and next line.
erikchen 2014/09/12 00:21:29 Done.
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;
Robert Sesek 2014/09/11 03:11:14 Document, and next line.
erikchen 2014/09/12 00:21:29 Done.
28 CGFloat toolbarFraction;
29
30 BOOL hasTabStrip;
31
32 BOOL hasToolbar;
33 CGFloat toolbarHeight;
34
35 BOOL hasLocationBar;
36
37 BOOL placeBookmarkBarBelowInfoBar;
Robert Sesek 2014/09/11 03:11:13 Document.
erikchen 2014/09/12 00:21:29 Done.
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.
Robert Sesek 2014/09/11 03:11:14 This isn't a complete sentence. Describe how this
erikchen 2014/09/12 00:21:29 I expanded the description of this class.
67 @interface BrowserWindowLayout : NSObject {
68 @private
69 // Input parameters.
Robert Sesek 2014/09/11 03:11:14 This needs a better comment.
erikchen 2014/09/12 00:21:29 Done.
70 mac_browser::LayoutParameters parameters_;
71
72 // Output.
Robert Sesek 2014/09/11 03:11:14 Same.
erikchen 2014/09/12 00:21:29 Done.
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 // ----------------Methods that configure input parameters----------------------
88 - (void)setContentViewSize:(NSSize)size;
89 - (void)setWindowSize:(NSSize)size;
90
91 // Whether the controller is in any fullscreen mode. |inAnyFullscreen| should
92 // be NO if the controller is in the process of entering fullscreen.
93 - (void)setInAnyFullscreen:(BOOL)inAnyFullscreen;
94 - (void)setFullscreenSlidingStyle:(fullscreen_mac::SlidingStyle)slidingStyle;
95 - (void)setFullscreenMenubarOffset:(CGFloat)menubarOffset;
96 - (void)setFullscreenToolbarFraction:(CGFloat)toolbarFraction;
97
98 - (void)setHasTabStrip:(BOOL)hasTabStrip;
99
100 - (void)setHasToolbar:(BOOL)hasToolbar;
101 - (void)setHasLocationBar:(BOOL)hasLocationBar;
102 - (void)setToolbarHeight:(CGFloat)toolbarHeight;
103
104 - (void)setBookmarkBarHidden:(BOOL)bookmarkBarHidden;
105 - (void)setPlaceBookmarkBarBelowInfoBar:(BOOL)placeBookmarkBarBelowInfoBar;
106 - (void)setBookmarkBarHeight:(CGFloat)bookmarkBarHeight;
107
108 // The height of the info bar, not including the top arrow.
109 - (void)setInfoBarHeight:(CGFloat)infoBarHeight;
110 // The maximum allowed height of the top arrow.
111 - (void)setInfoBarMaxTopArrowHeight:(CGFloat)infoBarMaxTopArrowHeight;
112
113 - (void)setHasDownloadShelf:(BOOL)hasDownloadShelf;
114 - (void)setDownloadShelfHeight:(CGFloat)downloadShelfHeight;
115
116 // ----------------Methods that generate output---------------------------------
117 // Performs the layout computation and returns the results.
Robert Sesek 2014/09/11 03:11:14 Is this called frequently? Is it cached?
erikchen 2014/09/12 00:21:30 It gets called once per layout cycle. It is not ca
118 - (mac_browser::LayoutOutput)computeLayout;
119
120 @end
121
122 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_LAYOUT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698