| 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 2467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 const BookmarkNode* parent = node->parent(); |
| 2488 bookmarkModel_->Remove(parent, | 2488 bookmarkModel_->Remove(parent, node); |
| 2489 parent->GetIndexOf(node)); | |
| 2490 } | 2489 } |
| 2491 } | 2490 } |
| 2492 } | 2491 } |
| 2493 | 2492 |
| 2494 - (void)bookmarkDragDidEnd:(BookmarkButton*)button | 2493 - (void)bookmarkDragDidEnd:(BookmarkButton*)button |
| 2495 operation:(NSDragOperation)operation { | 2494 operation:(NSDragOperation)operation { |
| 2496 [button setHidden:NO]; | 2495 [button setHidden:NO]; |
| 2497 [self resetAllButtonPositionsWithAnimation:YES]; | 2496 [self resetAllButtonPositionsWithAnimation:YES]; |
| 2498 } | 2497 } |
| 2499 | 2498 |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2905 - (id<BookmarkButtonControllerProtocol>)controllerForNode: | 2904 - (id<BookmarkButtonControllerProtocol>)controllerForNode: |
| 2906 (const BookmarkNode*)node { | 2905 (const BookmarkNode*)node { |
| 2907 // See if it's in the bar, then if it is in the hierarchy of visible | 2906 // See if it's in the bar, then if it is in the hierarchy of visible |
| 2908 // folder menus. | 2907 // folder menus. |
| 2909 if (bookmarkModel_->bookmark_bar_node() == node) | 2908 if (bookmarkModel_->bookmark_bar_node() == node) |
| 2910 return self; | 2909 return self; |
| 2911 return [folderController_ controllerForNode:node]; | 2910 return [folderController_ controllerForNode:node]; |
| 2912 } | 2911 } |
| 2913 | 2912 |
| 2914 @end | 2913 @end |
| OLD | NEW |