| 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 "base/mac/bundle_locations.h" | 7 #include "base/mac/bundle_locations.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
| (...skipping 2465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2476 } | 2476 } |
| 2477 | 2477 |
| 2478 - (BOOL)canDragBookmarkButtonToTrash:(BookmarkButton*)button { | 2478 - (BOOL)canDragBookmarkButtonToTrash:(BookmarkButton*)button { |
| 2479 return [self canEditBookmarks] && | 2479 return [self canEditBookmarks] && |
| 2480 [self canEditBookmark:[button bookmarkNode]]; | 2480 [self canEditBookmark:[button bookmarkNode]]; |
| 2481 } | 2481 } |
| 2482 | 2482 |
| 2483 - (void)didDragBookmarkToTrash:(BookmarkButton*)button { | 2483 - (void)didDragBookmarkToTrash:(BookmarkButton*)button { |
| 2484 if ([self canDragBookmarkButtonToTrash:button]) { | 2484 if ([self canDragBookmarkButtonToTrash:button]) { |
| 2485 const BookmarkNode* node = [button bookmarkNode]; | 2485 const BookmarkNode* node = [button bookmarkNode]; |
| 2486 if (node) { | 2486 if (node) |
| 2487 const BookmarkNode* parent = node->parent(); | 2487 bookmarkModel_->Remove(node); |
| 2488 bookmarkModel_->Remove(parent, | |
| 2489 parent->GetIndexOf(node)); | |
| 2490 } | |
| 2491 } | 2488 } |
| 2492 } | 2489 } |
| 2493 | 2490 |
| 2494 - (void)bookmarkDragDidEnd:(BookmarkButton*)button | 2491 - (void)bookmarkDragDidEnd:(BookmarkButton*)button |
| 2495 operation:(NSDragOperation)operation { | 2492 operation:(NSDragOperation)operation { |
| 2496 [button setHidden:NO]; | 2493 [button setHidden:NO]; |
| 2497 [self resetAllButtonPositionsWithAnimation:YES]; | 2494 [self resetAllButtonPositionsWithAnimation:YES]; |
| 2498 } | 2495 } |
| 2499 | 2496 |
| 2500 | 2497 |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2905 - (id<BookmarkButtonControllerProtocol>)controllerForNode: | 2902 - (id<BookmarkButtonControllerProtocol>)controllerForNode: |
| 2906 (const BookmarkNode*)node { | 2903 (const BookmarkNode*)node { |
| 2907 // See if it's in the bar, then if it is in the hierarchy of visible | 2904 // See if it's in the bar, then if it is in the hierarchy of visible |
| 2908 // folder menus. | 2905 // folder menus. |
| 2909 if (bookmarkModel_->bookmark_bar_node() == node) | 2906 if (bookmarkModel_->bookmark_bar_node() == node) |
| 2910 return self; | 2907 return self; |
| 2911 return [folderController_ controllerForNode:node]; | 2908 return [folderController_ controllerForNode:node]; |
| 2912 } | 2909 } |
| 2913 | 2910 |
| 2914 @end | 2911 @end |
| OLD | NEW |