| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/cocoa/bookmark_bar_folder_controller.h" | 5 #import "chrome/browser/cocoa/bookmark_bar_folder_controller.h" |
| 6 #include "base/mac_util.h" | 6 #include "base/mac_util.h" |
| 7 #include "base/nsimage_cache_mac.h" | 7 #include "base/nsimage_cache_mac.h" |
| 8 #include "base/sys_string_conversions.h" | 8 #include "base/sys_string_conversions.h" |
| 9 #include "chrome/browser/bookmarks/bookmark_model.h" | 9 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 10 #include "chrome/browser/bookmarks/bookmark_utils.h" | 10 #include "chrome/browser/bookmarks/bookmark_utils.h" |
| (...skipping 1249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1260 } | 1260 } |
| 1261 | 1261 |
| 1262 // TODO(jrg): Refactor BookmarkBarFolder common code. http://crbug.com/35966 | 1262 // TODO(jrg): Refactor BookmarkBarFolder common code. http://crbug.com/35966 |
| 1263 - (void)removeButton:(NSInteger)buttonIndex animate:(BOOL)animate { | 1263 - (void)removeButton:(NSInteger)buttonIndex animate:(BOOL)animate { |
| 1264 // TODO(mrossetti): Get disappearing animation to work. http://crbug.com/42360 | 1264 // TODO(mrossetti): Get disappearing animation to work. http://crbug.com/42360 |
| 1265 BookmarkButton* oldButton = [buttons_ objectAtIndex:buttonIndex]; | 1265 BookmarkButton* oldButton = [buttons_ objectAtIndex:buttonIndex]; |
| 1266 NSRect poofFrame = [oldButton bounds]; | 1266 NSRect poofFrame = [oldButton bounds]; |
| 1267 NSPoint poofPoint = NSMakePoint(NSMidX(poofFrame), NSMidY(poofFrame)); | 1267 NSPoint poofPoint = NSMakePoint(NSMidX(poofFrame), NSMidY(poofFrame)); |
| 1268 poofPoint = [oldButton convertPoint:poofPoint toView:nil]; | 1268 poofPoint = [oldButton convertPoint:poofPoint toView:nil]; |
| 1269 poofPoint = [[oldButton window] convertBaseToScreen:poofPoint]; | 1269 poofPoint = [[oldButton window] convertBaseToScreen:poofPoint]; |
| 1270 |
| 1271 // If a hover-open is pending, cancel it. |
| 1272 if (oldButton == buttonThatMouseIsIn_) |
| 1273 [NSObject cancelPreviousPerformRequestsWithTarget:self]; |
| 1274 |
| 1270 [oldButton removeFromSuperview]; | 1275 [oldButton removeFromSuperview]; |
| 1271 if (animate && !ignoreAnimations_) | 1276 if (animate && !ignoreAnimations_) |
| 1272 NSShowAnimationEffect(NSAnimationEffectDisappearingItemDefault, poofPoint, | 1277 NSShowAnimationEffect(NSAnimationEffectDisappearingItemDefault, poofPoint, |
| 1273 NSZeroSize, nil, nil, nil); | 1278 NSZeroSize, nil, nil, nil); |
| 1274 [buttons_ removeObjectAtIndex:buttonIndex]; | 1279 [buttons_ removeObjectAtIndex:buttonIndex]; |
| 1275 for (NSInteger i = 0; i < buttonIndex; ++i) { | 1280 for (NSInteger i = 0; i < buttonIndex; ++i) { |
| 1276 BookmarkButton* button = [buttons_ objectAtIndex:i]; | 1281 BookmarkButton* button = [buttons_ objectAtIndex:i]; |
| 1277 NSRect buttonFrame = [button frame]; | 1282 NSRect buttonFrame = [button frame]; |
| 1278 buttonFrame.origin.y -= bookmarks::kBookmarkBarHeight; | 1283 buttonFrame.origin.y -= bookmarks::kBookmarkBarHeight; |
| 1279 [button setFrame:buttonFrame]; | 1284 [button setFrame:buttonFrame]; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1320 return [folderController_ controllerForNode:node]; | 1325 return [folderController_ controllerForNode:node]; |
| 1321 } | 1326 } |
| 1322 | 1327 |
| 1323 #pragma mark TestingAPI Only | 1328 #pragma mark TestingAPI Only |
| 1324 | 1329 |
| 1325 - (void)setIgnoreAnimations:(BOOL)ignore { | 1330 - (void)setIgnoreAnimations:(BOOL)ignore { |
| 1326 ignoreAnimations_ = ignore; | 1331 ignoreAnimations_ = ignore; |
| 1327 } | 1332 } |
| 1328 | 1333 |
| 1329 @end // BookmarkBarFolderController | 1334 @end // BookmarkBarFolderController |
| OLD | NEW |