diff options
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/cocoa/bookmark_bar_controller.h | 2 | ||||
-rw-r--r-- | chrome/browser/cocoa/bookmark_bar_controller.mm | 19 | ||||
-rw-r--r-- | chrome/browser/cocoa/bookmark_bar_controller_unittest.mm | 8 |
3 files changed, 12 insertions, 17 deletions
diff --git a/chrome/browser/cocoa/bookmark_bar_controller.h b/chrome/browser/cocoa/bookmark_bar_controller.h index 8948510..a2ae151 100644 --- a/chrome/browser/cocoa/bookmark_bar_controller.h +++ b/chrome/browser/cocoa/bookmark_bar_controller.h @@ -144,7 +144,7 @@ class PrefService; - (NSRect)frameForBookmarkButtonFromCell:(NSCell*)cell xOffset:(int*)xOffset; - (void)checkForBookmarkButtonGrowth:(NSButton*)button; - (void)frameDidChange; -- (BOOL)offTheSideButtonIsEnabled; +- (BOOL)offTheSideButtonIsHidden; - (NSMenu *)menuForFolderNode:(const BookmarkNode*)node; - (int64)nodeIdFromMenuTag:(int32)tag; - (int32)menuTagFromNodeId:(int64)menuid; diff --git a/chrome/browser/cocoa/bookmark_bar_controller.mm b/chrome/browser/cocoa/bookmark_bar_controller.mm index ed45bcc..e8e5daf 100644 --- a/chrome/browser/cocoa/bookmark_bar_controller.mm +++ b/chrome/browser/cocoa/bookmark_bar_controller.mm @@ -112,25 +112,25 @@ const CGFloat kBookmarkHorizontalPadding = 1.0; // TODO(jrg): when we are smarter about creating buttons (e.g. don't // bother creating buttons which aren't visible), we'll have to be // smarter here too. -- (void)checkEnableOffTheSideButton { +- (void)checkHideOffTheSideButton { NSButton* button = [buttons_ lastObject]; if ((!button) || (NSMaxX([button frame]) <= NSMaxX([[button superview] frame]))) { - [offTheSideButton_ setEnabled:NO]; + [offTheSideButton_ setHidden:YES]; } else { - [offTheSideButton_ setEnabled:YES]; + [offTheSideButton_ setHidden:NO]; } } -- (BOOL)offTheSideButtonIsEnabled { - return [offTheSideButton_ isEnabled]; +- (BOOL)offTheSideButtonIsHidden { + return [offTheSideButton_ isHidden]; } // Called when our controlled frame has changed size. // TODO(jrg): be smarter (e.g. add/remove buttons as appropriate). - (void)frameDidChange { - [self checkEnableOffTheSideButton]; + [self checkHideOffTheSideButton]; } // Show or hide the bar based on the value of |show|. Handles @@ -520,11 +520,6 @@ const CGFloat kBookmarkHorizontalPadding = 1.0; } // Add all items from the given model to our bookmark bar. -// TODO(jrg): lots of things! -// - bookmark folders (e.g. menu from the button) -// - button and menu on the right for when bookmarks don't all fit on the -// screen -// - ... // // TODO(jrg): write a "build bar" so there is a nice spot for things // like the contextual menu which is invoked when not over a @@ -577,7 +572,7 @@ const CGFloat kBookmarkHorizontalPadding = 1.0; const BookmarkNode* node = model->GetBookmarkBarNode(); [self clearBookmarkBar]; [self addNodesToBar:node]; - [self checkEnableOffTheSideButton]; + [self checkHideOffTheSideButton]; } - (void)beingDeleted:(BookmarkModel*)model { diff --git a/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm b/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm index 66a87bc..55c4c18 100644 --- a/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm +++ b/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm @@ -188,15 +188,15 @@ TEST_F(BookmarkBarControllerTest, FrameChangeNotification) { } // Confirm off the side button only enabled when reasonable. -TEST_F(BookmarkBarControllerTest, OffTheSideButtonEnable) { +TEST_F(BookmarkBarControllerTest, OffTheSideButtonHidden) { BookmarkModel* model = helper_.profile()->GetBookmarkModel(); [bar_ loaded:model]; - EXPECT_FALSE([bar_ offTheSideButtonIsEnabled]); + EXPECT_TRUE([bar_ offTheSideButtonIsHidden]); for (int i = 0; i < 2; i++) { model->SetURLStarred(GURL("http://www.foo.com"), L"small", true); - EXPECT_FALSE([bar_ offTheSideButtonIsEnabled]); + EXPECT_TRUE([bar_ offTheSideButtonIsHidden]); } for (int i = 0; i < 20; i++) { @@ -205,7 +205,7 @@ TEST_F(BookmarkBarControllerTest, OffTheSideButtonEnable) { L"super duper wide title", GURL("http://superfriends.hall-of-justice.edu")); } - EXPECT_TRUE([bar_ offTheSideButtonIsEnabled]); + EXPECT_FALSE([bar_ offTheSideButtonIsHidden]); } TEST_F(BookmarkBarControllerTest, TagMap) { |