diff options
author | erg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-09 18:01:08 +0000 |
---|---|---|
committer | erg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-09 18:01:08 +0000 |
commit | 3302102a21dcdae93f17f2db57ba32ba0e8dd1da (patch) | |
tree | e8f3b5e53324e77a3dc6502a0d555e93a25261b2 /chrome/browser/cocoa/bookmark_bar_controller.mm | |
parent | 9398185452c106c0f464747fd76d70f3d212143a (diff) | |
download | chromium_src-3302102a21dcdae93f17f2db57ba32ba0e8dd1da.zip chromium_src-3302102a21dcdae93f17f2db57ba32ba0e8dd1da.tar.gz chromium_src-3302102a21dcdae93f17f2db57ba32ba0e8dd1da.tar.bz2 |
Mac: Theme the bookmark bar on the new tab page.
- XIB change: The controller has a connection to buttonView_.
- BrowserThemeProviderMac: Fix a bug where we weren't returning
default colors; we returned nil instead.
- The majority of the implementation is actually the cross platform
NtpBackgroundUtil::PaintBackgroundDetachedMode. We do platform
specific drawing on top of the background, though.
TEST=BookmarkBarToolbarViewTest.DisplayAsFloatingBarWithNoImage
TEST=BookmarkBarToolbarViewTest.DisplayAsFloatingBarWithBgImage
BUG=http://crbug.com/17625
Review URL: http://codereview.chromium.org/266027
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28560 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/bookmark_bar_controller.mm')
-rw-r--r-- | chrome/browser/cocoa/bookmark_bar_controller.mm | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/chrome/browser/cocoa/bookmark_bar_controller.mm b/chrome/browser/cocoa/bookmark_bar_controller.mm index f150334..0872b3a 100644 --- a/chrome/browser/cocoa/bookmark_bar_controller.mm +++ b/chrome/browser/cocoa/bookmark_bar_controller.mm @@ -12,7 +12,9 @@ #include "chrome/browser/browser.h" #include "chrome/browser/browser_list.h" #import "chrome/browser/cocoa/bookmark_bar_bridge.h" +#import "chrome/browser/cocoa/bookmark_bar_constants.h" #import "chrome/browser/cocoa/bookmark_bar_controller.h" +#import "chrome/browser/cocoa/bookmark_bar_toolbar_view.h" #import "chrome/browser/cocoa/bookmark_bar_view.h" #import "chrome/browser/cocoa/bookmark_button_cell.h" #import "chrome/browser/cocoa/bookmark_editor_controller.h" @@ -24,6 +26,7 @@ #import "chrome/browser/cocoa/view_resizer.h" #include "chrome/browser/profile.h" #include "chrome/browser/tab_contents/tab_contents.h" +#include "chrome/browser/tab_contents/tab_contents_view.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" #include "grit/generated_resources.h" @@ -53,12 +56,6 @@ namespace { -// Our height, when opened in "always visible" mode. -const int kBookmarkBarHeight = 28; - -// Our height, when visible in "new tab page" mode. -const int kNTPBookmarkBarHeight = 40; - // Magic numbers from Cole const CGFloat kDefaultBookmarkWidth = 150.0; const CGFloat kBookmarkVerticalPadding = 2.0; @@ -171,6 +168,9 @@ const CGFloat kBookmarkHorizontalPadding = 1.0; CGFloat height = show ? [self preferredHeight] : 0; [resizeDelegate_ resizeView:[self view] newHeight:height]; [[self view] setHidden:show ? NO : YES]; + + DCHECK([[self view] isKindOfClass:[BookmarkBarToolbarView class]]); + [(BookmarkBarToolbarView*)[self view] layoutViews]; } // We don't change a preference; we only change visibility. @@ -196,7 +196,17 @@ const CGFloat kBookmarkHorizontalPadding = 1.0; } - (BOOL)isAlwaysVisible { - return browser_ && browser_->profile()->GetPrefs()->GetBoolean(prefs::kShowBookmarkBar); + return browser_ && + browser_->profile()->GetPrefs()->GetBoolean(prefs::kShowBookmarkBar); +} + +- (int)currentTabContentsHeight { + return browser_->GetSelectedTabContents()->view()->GetContainerSize(). + height(); +} + +- (ThemeProvider*)themeProvider { + return browser_->profile()->GetThemeProvider(); } - (BOOL)drawAsFloatingBar { @@ -246,7 +256,8 @@ const CGFloat kBookmarkHorizontalPadding = 1.0; } - (int)preferredHeight { - return [self isAlwaysVisible] ? kBookmarkBarHeight : kNTPBookmarkBarHeight; + return [self isAlwaysVisible] ? bookmarks::kBookmarkBarHeight : + bookmarks::kNTPBookmarkBarHeight; } - (void)selectTabWithContents:(TabContents*)newContents @@ -552,7 +563,7 @@ const CGFloat kBookmarkHorizontalPadding = 1.0; NSRect bounds = [[self view] bounds]; // TODO: be smarter about this; the animator delays the right height if (bounds.size.height == 0) - bounds.size.height = kBookmarkBarHeight; + bounds.size.height = bookmarks::kBookmarkBarHeight; NSRect frame = NSInsetRect(bounds, kBookmarkHorizontalPadding, kBookmarkVerticalPadding); |