summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/cocoa/browser_window_controller.mm
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/ui/cocoa/browser_window_controller.mm')
-rw-r--r--chrome/browser/ui/cocoa/browser_window_controller.mm46
1 files changed, 22 insertions, 24 deletions
diff --git a/chrome/browser/ui/cocoa/browser_window_controller.mm b/chrome/browser/ui/cocoa/browser_window_controller.mm
index 54dd72c..02f4220 100644
--- a/chrome/browser/ui/cocoa/browser_window_controller.mm
+++ b/chrome/browser/ui/cocoa/browser_window_controller.mm
@@ -67,8 +67,6 @@
#import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h"
#include "chrome/browser/ui/fullscreen/fullscreen_controller.h"
#include "chrome/browser/ui/omnibox/location_bar.h"
-#include "chrome/browser/ui/search/search.h"
-#include "chrome/browser/ui/search/search_model.h"
#include "chrome/browser/ui/tabs/dock_info.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/tabs/tab_strip_model_delegate.h"
@@ -394,6 +392,7 @@ enum {
resizeDelegate:self]);
[toolbarController_ setHasToolbar:[self hasToolbar]
hasLocationBar:[self hasLocationBar]];
+ [[[self window] contentView] addSubview:[toolbarController_ view]];
// Create a sub-controller for the bookmark bar.
bookmarkBarController_.reset(
@@ -402,12 +401,21 @@ enum {
initialWidth:NSWidth([[[self window] contentView] frame])
delegate:self
resizeDelegate:self]);
+
+ // Add bookmark bar to the view hierarchy, which also triggers the nib load.
+ // The bookmark bar is defined (in the nib) to be bottom-aligned to its
+ // parent view (among other things), so position and resize properties don't
+ // need to be set.
+ [[[self window] contentView] addSubview:[bookmarkBarController_ view]
+ positioned:NSWindowBelow
+ relativeTo:[toolbarController_ view]];
[bookmarkBarController_ setBookmarkBarEnabled:[self supportsBookmarkBar]];
// Create the infobar container view, so we can pass it to the
// ToolbarController.
infoBarContainerController_.reset(
[[InfoBarContainerController alloc] initWithResizeDelegate:self]);
+ [[[self window] contentView] addSubview:[infoBarContainerController_ view]];
// We don't want to try and show the bar before it gets placed in its parent
// view, so this step shoudn't be inside the bookmark bar controller's
@@ -530,10 +538,6 @@ enum {
return tabStripController_.get();
}
-- (FindBarCocoaController*)findBarCocoaController {
- return findBarCocoaController_.get();
-}
-
- (InfoBarContainerController*)infoBarContainerController {
return infoBarContainerController_.get();
}
@@ -546,14 +550,6 @@ enum {
return [toolbarController_ locationBarBridge];
}
-- (NSView*)floatingBarBackingView {
- return floatingBarBackingView_;
-}
-
-- (PreviewableContentsController*)previewableContentsController {
- return previewableContentsController_;
-}
-
- (Profile*)profile {
return browser_->profile();
}
@@ -1532,7 +1528,13 @@ enum {
// Create a controller for the findbar.
findBarCocoaController_.reset([findBarCocoaController retain]);
- [self updateSubviewZOrder];
+ NSView* contentView = [[self window] contentView];
+ NSView* relativeView =
+ [self inPresentationMode] ? [toolbarController_ view] :
+ [infoBarContainerController_ view];
+ [contentView addSubview:[findBarCocoaController_ view]
+ positioned:NSWindowAbove
+ relativeTo:relativeView];
// Place the find bar immediately below the toolbar/attached bookmark bar. In
// presentation mode, it hangs off the top of the screen when the bar is
@@ -1540,7 +1542,7 @@ enum {
CGFloat maxY = [self placeBookmarkBarBelowInfoBar] ?
NSMinY([[toolbarController_ view] frame]) :
NSMinY([[bookmarkBarController_ view] frame]);
- CGFloat maxWidth = NSWidth([[[self window] contentView] frame]);
+ CGFloat maxWidth = NSWidth([contentView frame]);
[findBarCocoaController_ positionFindBarViewAtMaxY:maxY maxWidth:maxWidth];
// This allows the FindBarCocoaController to call |layoutSubviews| and get
@@ -1907,7 +1909,8 @@ enum {
- (void)bookmarkBar:(BookmarkBarController*)controller
didChangeFromState:(BookmarkBar::State)oldState
toState:(BookmarkBar::State)newState {
- [toolbarController_ setDividerOpacity:[self toolbarDividerOpacity]];
+ [toolbarController_
+ setDividerOpacity:[bookmarkBarController_ toolbarDividerOpacity]];
[self adjustToolbarAndBookmarkBarForCompression:
[controller getDesiredToolbarHeightCompression]];
}
@@ -1916,7 +1919,8 @@ enum {
- (void)bookmarkBar:(BookmarkBarController*)controller
willAnimateFromState:(BookmarkBar::State)oldState
toState:(BookmarkBar::State)newState {
- [toolbarController_ setDividerOpacity:[self toolbarDividerOpacity]];
+ [toolbarController_
+ setDividerOpacity:[bookmarkBarController_ toolbarDividerOpacity]];
[self adjustToolbarAndBookmarkBarForCompression:
[controller getDesiredToolbarHeightCompression]];
}
@@ -1987,12 +1991,6 @@ willAnimateFromState:(BookmarkBar::State)oldState
[sheet orderOut:self];
}
-- (void)updateBookmarkBarStateForInstantPreview {
- [toolbarController_ setDividerOpacity:[self toolbarDividerOpacity]];
- [self updateContentOffsets];
- [self updateSubviewZOrder];
-}
-
@end // @implementation BrowserWindowController