OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" | 5 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/mac/bundle_locations.h" | 9 #include "base/mac/bundle_locations.h" |
10 #include "base/mac/sdk_forward_declarations.h" | 10 #include "base/mac/sdk_forward_declarations.h" |
(...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
858 | 858 |
859 // Configure the off-the-side button (e.g. specify the node range, | 859 // Configure the off-the-side button (e.g. specify the node range, |
860 // check if we should enable or disable it, etc). | 860 // check if we should enable or disable it, etc). |
861 - (void)configureOffTheSideButtonContentsAndVisibility { | 861 - (void)configureOffTheSideButtonContentsAndVisibility { |
862 [[offTheSideButton_ cell] setStartingChildIndex:displayedButtonCount_]; | 862 [[offTheSideButton_ cell] setStartingChildIndex:displayedButtonCount_]; |
863 [[offTheSideButton_ cell] | 863 [[offTheSideButton_ cell] |
864 setBookmarkNode:bookmarkModel_->bookmark_bar_node()]; | 864 setBookmarkNode:bookmarkModel_->bookmark_bar_node()]; |
865 int bookmarkChildren = bookmarkModel_->bookmark_bar_node()->child_count(); | 865 int bookmarkChildren = bookmarkModel_->bookmark_bar_node()->child_count(); |
866 if (bookmarkChildren > displayedButtonCount_) { | 866 if (bookmarkChildren > displayedButtonCount_) { |
867 [offTheSideButton_ setHidden:NO]; | 867 [offTheSideButton_ setHidden:NO]; |
| 868 // Set the off the side button as needing re-display. This is needed to |
| 869 // avoid the button being shown with a black background the first time |
| 870 // it's displayed. See https://codereview.chromium.org/1630453002/ for |
| 871 // more context. |
| 872 [offTheSideButton_ setNeedsDisplay:YES]; |
868 } else { | 873 } else { |
869 // If we just deleted the last item in an off-the-side menu so the | 874 // If we just deleted the last item in an off-the-side menu so the |
870 // button will be going away, make sure the menu goes away. | 875 // button will be going away, make sure the menu goes away. |
871 if (folderController_ && | 876 if (folderController_ && |
872 ([folderController_ parentButton] == offTheSideButton_)) | 877 ([folderController_ parentButton] == offTheSideButton_)) |
873 [self closeAllBookmarkFolders]; | 878 [self closeAllBookmarkFolders]; |
874 // (And hide the button, too.) | 879 // (And hide the button, too.) |
875 [offTheSideButton_ setHidden:YES]; | 880 [offTheSideButton_ setHidden:YES]; |
876 } | 881 } |
877 } | 882 } |
(...skipping 2062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2940 - (id<BookmarkButtonControllerProtocol>)controllerForNode: | 2945 - (id<BookmarkButtonControllerProtocol>)controllerForNode: |
2941 (const BookmarkNode*)node { | 2946 (const BookmarkNode*)node { |
2942 // See if it's in the bar, then if it is in the hierarchy of visible | 2947 // See if it's in the bar, then if it is in the hierarchy of visible |
2943 // folder menus. | 2948 // folder menus. |
2944 if (bookmarkModel_->bookmark_bar_node() == node) | 2949 if (bookmarkModel_->bookmark_bar_node() == node) |
2945 return self; | 2950 return self; |
2946 return [folderController_ controllerForNode:node]; | 2951 return [folderController_ controllerForNode:node]; |
2947 } | 2952 } |
2948 | 2953 |
2949 @end | 2954 @end |
OLD | NEW |