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

Unified Diff: chrome/browser/ui/cocoa/browser_window_controller.mm

Issue 11876036: Alternate NTP: Don't hide bookmark bar on instant (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: a Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/browser_window_controller.mm
diff --git a/chrome/browser/ui/cocoa/browser_window_controller.mm b/chrome/browser/ui/cocoa/browser_window_controller.mm
index 53f33199db2ddee6dd51bac39a37e6fb668005c5..2f37328efdc0bc79b106eb0ddce5b4e310e9cd69 100644
--- a/chrome/browser/ui/cocoa/browser_window_controller.mm
+++ b/chrome/browser/ui/cocoa/browser_window_controller.mm
@@ -63,6 +63,8 @@
#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"
@@ -328,7 +330,6 @@ 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(
@@ -337,21 +338,12 @@ 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
@@ -1455,13 +1447,7 @@ enum {
// Create a controller for the findbar.
findBarCocoaController_.reset([findBarCocoaController retain]);
- NSView* contentView = [[self window] contentView];
- NSView* relativeView =
- [self inPresentationMode] ? [toolbarController_ view] :
- [infoBarContainerController_ view];
- [contentView addSubview:[findBarCocoaController_ view]
- positioned:NSWindowAbove
- relativeTo:relativeView];
+ [self updateSubviewZOrder];
// 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
@@ -1469,7 +1455,7 @@ enum {
CGFloat maxY = [self placeBookmarkBarBelowInfoBar] ?
NSMinY([[toolbarController_ view] frame]) :
NSMinY([[bookmarkBarController_ view] frame]);
- CGFloat maxWidth = NSWidth([contentView frame]);
+ CGFloat maxWidth = NSWidth([[[self window] contentView] frame]);
[findBarCocoaController_ positionFindBarViewAtMaxY:maxY maxWidth:maxWidth];
// This allows the FindBarCocoaController to call |layoutSubviews| and get
@@ -1834,8 +1820,7 @@ enum {
- (void)bookmarkBar:(BookmarkBarController*)controller
didChangeFromState:(BookmarkBar::State)oldState
toState:(BookmarkBar::State)newState {
- [toolbarController_
- setDividerOpacity:[bookmarkBarController_ toolbarDividerOpacity]];
+ [toolbarController_ setDividerOpacity:[self toolbarDividerOpacity]];
[self adjustToolbarAndBookmarkBarForCompression:
[controller getDesiredToolbarHeightCompression]];
}
@@ -1844,8 +1829,7 @@ enum {
- (void)bookmarkBar:(BookmarkBarController*)controller
willAnimateFromState:(BookmarkBar::State)oldState
toState:(BookmarkBar::State)newState {
- [toolbarController_
- setDividerOpacity:[bookmarkBarController_ toolbarDividerOpacity]];
+ [toolbarController_ setDividerOpacity:[self toolbarDividerOpacity]];
[self adjustToolbarAndBookmarkBarForCompression:
[controller getDesiredToolbarHeightCompression]];
}
@@ -1921,6 +1905,12 @@ willAnimateFromState:(BookmarkBar::State)oldState
[sheet orderOut:self];
}
+- (void)updateBookmarkStateForInstantPreview {
dhollowa 2013/01/17 17:47:58 optional: updateBookmarkBarStateForInstantPreview
sail 2013/01/17 18:17:12 Done.
+ [toolbarController_ setDividerOpacity:[self toolbarDividerOpacity]];
+ [self updateContentOffsets];
+ [self updateSubviewZOrder];
+}
+
@end // @implementation BrowserWindowController

Powered by Google App Engine
This is Rietveld 408576698