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

Side by Side Diff: chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm

Issue 2893323002: [Mac] Force invalidate bookmark bar layout on node change (Closed)
Patch Set: Created 3 years, 7 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 unified diff | Download patch
OLDNEW
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 #import "base/mac/bundle_locations.h" 9 #import "base/mac/bundle_locations.h"
10 #import "base/mac/foundation_util.h" 10 #import "base/mac/foundation_util.h"
(...skipping 2116 matching lines...) Expand 10 before | Expand all | Expand 10 after
2127 // If a context menu is open, close it. 2127 // If a context menu is open, close it.
2128 [self cancelMenuTracking]; 2128 [self cancelMenuTracking];
2129 2129
2130 const BookmarkNode* newNode = newParent->GetChild(newIndex); 2130 const BookmarkNode* newNode = newParent->GetChild(newIndex);
2131 id<BookmarkButtonControllerProtocol> newController = 2131 id<BookmarkButtonControllerProtocol> newController =
2132 [self controllerForNode:newParent]; 2132 [self controllerForNode:newParent];
2133 [newController addButtonForNode:newNode atIndex:newIndex]; 2133 [newController addButtonForNode:newNode atIndex:newIndex];
2134 [self rebuildLayoutWithAnimated:NO]; 2134 [self rebuildLayoutWithAnimated:NO];
2135 } 2135 }
2136 2136
2137 // TODO(jrg): for now this is brute force.
2138 - (void)nodeChanged:(BookmarkModel*)model 2137 - (void)nodeChanged:(BookmarkModel*)model
2139 node:(const BookmarkNode*)node { 2138 node:(const BookmarkNode*)node {
2139 // Invalidate the layout if the changed node is visible. This ensures
2140 // the button is updated if the button offsets don't change but the
2141 // title does.
2142 if (nodeIdToButtonMap_.find(node->id()) != nodeIdToButtonMap_.end())
2143 layout_ = {};
2140 [self loaded:model]; 2144 [self loaded:model];
2141 } 2145 }
2142 2146
2143 - (void)nodeMoved:(BookmarkModel*)model 2147 - (void)nodeMoved:(BookmarkModel*)model
2144 oldParent:(const BookmarkNode*)oldParent oldIndex:(int)oldIndex 2148 oldParent:(const BookmarkNode*)oldParent oldIndex:(int)oldIndex
2145 newParent:(const BookmarkNode*)newParent newIndex:(int)newIndex { 2149 newParent:(const BookmarkNode*)newParent newIndex:(int)newIndex {
2146 const BookmarkNode* movedNode = newParent->GetChild(newIndex); 2150 const BookmarkNode* movedNode = newParent->GetChild(newIndex);
2147 id<BookmarkButtonControllerProtocol> oldController = 2151 id<BookmarkButtonControllerProtocol> oldController =
2148 [self controllerForNode:oldParent]; 2152 [self controllerForNode:oldParent];
2149 id<BookmarkButtonControllerProtocol> newController = 2153 id<BookmarkButtonControllerProtocol> newController =
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
2681 return self; 2685 return self;
2682 return [folderController_ controllerForNode:node]; 2686 return [folderController_ controllerForNode:node];
2683 } 2687 }
2684 2688
2685 // For testing. 2689 // For testing.
2686 - (const BookmarkBarLayout&)currentLayout { 2690 - (const BookmarkBarLayout&)currentLayout {
2687 return layout_; 2691 return layout_;
2688 } 2692 }
2689 2693
2690 @end 2694 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698