Index: chrome/browser/ui/cocoa/browser_window_layout.h |
diff --git a/chrome/browser/ui/cocoa/browser_window_layout.h b/chrome/browser/ui/cocoa/browser_window_layout.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..3c8ac874242c1024bf045729a68fc1324decff0c |
--- /dev/null |
+++ b/chrome/browser/ui/cocoa/browser_window_layout.h |
@@ -0,0 +1,122 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_LAYOUT_H_ |
+#define CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_LAYOUT_H_ |
+ |
+#import <Cocoa/Cocoa.h> |
+ |
+#import "chrome/browser/ui/cocoa/presentation_mode_controller.h" |
+ |
+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
|
+ |
+// The height of the tab strip. |
+extern const CGFloat kTabStripHeight; |
+ |
+// The parameters used to calculate the layout of the views managed by the |
+// BrowserWindowController. |
+struct LayoutParameters { |
+ NSSize contentViewSize; |
Robert Sesek
2014/09/11 03:11:14
Document, and next line.
erikchen
2014/09/12 00:21:29
Done.
|
+ NSSize windowSize; |
+ |
+ // Whether the controller is in any fullscreen mode. This parameter should be |
+ // NO if the controller is in the process of entering fullscreen. |
+ BOOL inAnyFullscreen; |
+ fullscreen_mac::SlidingStyle slidingStyle; |
+ CGFloat menubarOffset; |
Robert Sesek
2014/09/11 03:11:14
Document, and next line.
erikchen
2014/09/12 00:21:29
Done.
|
+ CGFloat toolbarFraction; |
+ |
+ BOOL hasTabStrip; |
+ |
+ BOOL hasToolbar; |
+ CGFloat toolbarHeight; |
+ |
+ BOOL hasLocationBar; |
+ |
+ BOOL placeBookmarkBarBelowInfoBar; |
Robert Sesek
2014/09/11 03:11:13
Document.
erikchen
2014/09/12 00:21:29
Done.
|
+ BOOL bookmarkBarHidden; |
+ CGFloat bookmarkBarHeight; |
+ |
+ // The height of the info bar, not including the top arrow. |
+ CGFloat infoBarHeight; |
+ // The maximum allowed height of the top arrow. |
+ CGFloat infoBarMaxTopArrowHeight; |
+ |
+ BOOL hasDownloadShelf; |
+ CGFloat downloadShelfHeight; |
+}; |
+ |
+// The output frames of the views managed by the BrowserWindowController. |
+struct LayoutOutput { |
+ NSRect tabStripFrame; |
+ NSRect toolbarFrame; |
+ NSRect bookmarkFrame; |
+ NSRect fullscreenBackingBarFrame; |
+ CGFloat findBarMaxY; |
+ CGFloat fullscreenExitButtonMaxY; |
+ NSRect infoBarFrame; |
+ CGFloat infoBarMaxTopArrowHeight; |
+ NSRect downloadShelfFrame; |
+ NSRect contentAreaFrame; |
+}; |
+ |
+} // namespace mac_browser |
+ |
+// 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.
|
+@interface BrowserWindowLayout : NSObject { |
+ @private |
+ // Input parameters. |
Robert Sesek
2014/09/11 03:11:14
This needs a better comment.
erikchen
2014/09/12 00:21:29
Done.
|
+ mac_browser::LayoutParameters parameters_; |
+ |
+ // Output. |
Robert Sesek
2014/09/11 03:11:14
Same.
erikchen
2014/09/12 00:21:29
Done.
|
+ mac_browser::LayoutOutput output_; |
+ |
+ // The offset of the maxY of the tab strip during fullscreen mode. |
+ CGFloat fullscreenYOffset_; |
+ |
+ // The views are laid out from highest Y to lowest Y. This variable holds the |
+ // current highest Y that the next view is expected to be laid under. |
+ CGFloat maxY_; |
+} |
+ |
+// Returns the height of the info bar container. |
++ (CGFloat)infoBarContainerHeightFromInfoBarHeight:(CGFloat)infoBarHeight |
+ maxTopArrowHeight:(CGFloat)maxTopArrowHeight; |
+ |
+// ----------------Methods that configure input parameters---------------------- |
+- (void)setContentViewSize:(NSSize)size; |
+- (void)setWindowSize:(NSSize)size; |
+ |
+// Whether the controller is in any fullscreen mode. |inAnyFullscreen| should |
+// be NO if the controller is in the process of entering fullscreen. |
+- (void)setInAnyFullscreen:(BOOL)inAnyFullscreen; |
+- (void)setFullscreenSlidingStyle:(fullscreen_mac::SlidingStyle)slidingStyle; |
+- (void)setFullscreenMenubarOffset:(CGFloat)menubarOffset; |
+- (void)setFullscreenToolbarFraction:(CGFloat)toolbarFraction; |
+ |
+- (void)setHasTabStrip:(BOOL)hasTabStrip; |
+ |
+- (void)setHasToolbar:(BOOL)hasToolbar; |
+- (void)setHasLocationBar:(BOOL)hasLocationBar; |
+- (void)setToolbarHeight:(CGFloat)toolbarHeight; |
+ |
+- (void)setBookmarkBarHidden:(BOOL)bookmarkBarHidden; |
+- (void)setPlaceBookmarkBarBelowInfoBar:(BOOL)placeBookmarkBarBelowInfoBar; |
+- (void)setBookmarkBarHeight:(CGFloat)bookmarkBarHeight; |
+ |
+// The height of the info bar, not including the top arrow. |
+- (void)setInfoBarHeight:(CGFloat)infoBarHeight; |
+// The maximum allowed height of the top arrow. |
+- (void)setInfoBarMaxTopArrowHeight:(CGFloat)infoBarMaxTopArrowHeight; |
+ |
+- (void)setHasDownloadShelf:(BOOL)hasDownloadShelf; |
+- (void)setDownloadShelfHeight:(CGFloat)downloadShelfHeight; |
+ |
+// ----------------Methods that generate output--------------------------------- |
+// 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
|
+- (mac_browser::LayoutOutput)computeLayout; |
+ |
+@end |
+ |
+#endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_LAYOUT_H_ |