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

Unified Diff: chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.mm

Issue 485003002: Adding (empty) placeholder button to 'Other bookmarks' folder is unnecessary. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removing performSelector: Created 6 years, 4 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
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller_unittest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.mm
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.mm
index 5c8db4db9350042c08121840b5a94532b615ee50..6154cb8069d2e45dd2e819831930db031dd51ee2 100644
--- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.mm
+++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.mm
@@ -762,7 +762,7 @@ NSRect GetFirstButtonFrameForHeight(CGFloat height) {
- (void)adjustWindowForButtonCount:(NSUInteger)buttonCount {
NSRect folderFrame = [folderView_ frame];
CGFloat newMenuHeight =
- (CGFloat)[self menuHeightForButtonCount:[buttons_ count]];
+ (CGFloat)[self menuHeightForButtonCount:buttonCount];
CGFloat deltaMenuHeight = newMenuHeight - NSHeight(folderFrame);
// If the height has changed then also change the origin, and adjust the
// scroll (if scrolling).
@@ -1936,9 +1936,10 @@ static BOOL ValueInRangeInclusive(CGFloat low, CGFloat value, CGFloat high) {
[folderController_
offsetFolderMenuWindow:NSMakeSize(0.0, chrome::kBookmarkBarHeight)];
}
- } else {
+ } else if (parentButton_ != [barController_ otherBookmarksButton]) {
// If all nodes have been removed from this folder then add in the
- // 'empty' placeholder button.
+ // 'empty' placeholder button except for "Other bookmarks" folder
+ // as we are going to hide it.
NSRect buttonFrame =
GetFirstButtonFrameForHeight([self menuHeightForButtonCount:1]);
BookmarkButton* button = [self makeButtonForNode:nil
@@ -1948,7 +1949,12 @@ static BOOL ValueInRangeInclusive(CGFloat low, CGFloat value, CGFloat high) {
buttonCount = 1;
}
- [self adjustWindowForButtonCount:buttonCount];
+ // buttonCount will be 0 if "Other bookmarks" folder is empty, so close
+ // the folder before hiding it.
+ if (buttonCount == 0)
+ [barController_ closeBookmarkFolder:nil];
+ else if (buttonCount > 0)
+ [self adjustWindowForButtonCount:buttonCount];
if (animate && !ignoreAnimations_)
NSShowAnimationEffect(NSAnimationEffectDisappearingItemDefault, poofPoint,
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698