| 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/mac/mac_util.h" | 8 #include "base/mac/mac_util.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| (...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 599 return defaultImage_; | 599 return defaultImage_; |
| 600 } | 600 } |
| 601 | 601 |
| 602 - (void)closeFolderAndStopTrackingMenus { | 602 - (void)closeFolderAndStopTrackingMenus { |
| 603 showFolderMenus_ = NO; | 603 showFolderMenus_ = NO; |
| 604 [self closeAllBookmarkFolders]; | 604 [self closeAllBookmarkFolders]; |
| 605 } | 605 } |
| 606 | 606 |
| 607 - (BOOL)canEditBookmarks { | 607 - (BOOL)canEditBookmarks { |
| 608 PrefService* prefs = browser_->profile()->GetPrefs(); | 608 PrefService* prefs = browser_->profile()->GetPrefs(); |
| 609 return prefs->GetBoolean(prefs::kEditBookmarksEnabled); | 609 return prefs->GetBoolean(bookmarks::prefs::kEditBookmarksEnabled); |
| 610 } | 610 } |
| 611 | 611 |
| 612 - (BOOL)canEditBookmark:(const BookmarkNode*)node { | 612 - (BOOL)canEditBookmark:(const BookmarkNode*)node { |
| 613 // Don't allow edit/delete of the permanent nodes. | 613 // Don't allow edit/delete of the permanent nodes. |
| 614 if (node == nil || bookmarkModel_->is_permanent_node(node) || | 614 if (node == nil || bookmarkModel_->is_permanent_node(node) || |
| 615 !bookmarkClient_->CanBeEditedByUser(node)) { | 615 !bookmarkClient_->CanBeEditedByUser(node)) { |
| 616 return NO; | 616 return NO; |
| 617 } | 617 } |
| 618 return YES; | 618 return YES; |
| 619 } | 619 } |
| (...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1171 } | 1171 } |
| 1172 } | 1172 } |
| 1173 | 1173 |
| 1174 // Shows or hides the Other Bookmarks button as appropriate, and returns | 1174 // Shows or hides the Other Bookmarks button as appropriate, and returns |
| 1175 // whether it ended up visible. | 1175 // whether it ended up visible. |
| 1176 - (BOOL)setManagedBookmarksButtonVisibility { | 1176 - (BOOL)setManagedBookmarksButtonVisibility { |
| 1177 if (!managedBookmarksButton_.get()) | 1177 if (!managedBookmarksButton_.get()) |
| 1178 return NO; | 1178 return NO; |
| 1179 | 1179 |
| 1180 PrefService* prefs = browser_->profile()->GetPrefs(); | 1180 PrefService* prefs = browser_->profile()->GetPrefs(); |
| 1181 BOOL visible = ![managedBookmarksButton_ bookmarkNode]->empty() && | 1181 BOOL visible = |
| 1182 prefs->GetBoolean(prefs::kShowManagedBookmarksInBookmarkBar); | 1182 ![managedBookmarksButton_ bookmarkNode]->empty() && |
| 1183 prefs->GetBoolean(bookmarks::prefs::kShowManagedBookmarksInBookmarkBar); |
| 1183 BOOL currentVisibility = ![managedBookmarksButton_ isHidden]; | 1184 BOOL currentVisibility = ![managedBookmarksButton_ isHidden]; |
| 1184 if (currentVisibility != visible) { | 1185 if (currentVisibility != visible) { |
| 1185 [managedBookmarksButton_ setHidden:!visible]; | 1186 [managedBookmarksButton_ setHidden:!visible]; |
| 1186 [self resetAllButtonPositionsWithAnimation:NO]; | 1187 [self resetAllButtonPositionsWithAnimation:NO]; |
| 1187 } | 1188 } |
| 1188 return visible; | 1189 return visible; |
| 1189 } | 1190 } |
| 1190 | 1191 |
| 1191 // Shows or hides the Other Bookmarks button as appropriate, and returns | 1192 // Shows or hides the Other Bookmarks button as appropriate, and returns |
| 1192 // whether it ended up visible. | 1193 // whether it ended up visible. |
| (...skipping 1604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2797 - (id<BookmarkButtonControllerProtocol>)controllerForNode: | 2798 - (id<BookmarkButtonControllerProtocol>)controllerForNode: |
| 2798 (const BookmarkNode*)node { | 2799 (const BookmarkNode*)node { |
| 2799 // See if it's in the bar, then if it is in the hierarchy of visible | 2800 // See if it's in the bar, then if it is in the hierarchy of visible |
| 2800 // folder menus. | 2801 // folder menus. |
| 2801 if (bookmarkModel_->bookmark_bar_node() == node) | 2802 if (bookmarkModel_->bookmark_bar_node() == node) |
| 2802 return self; | 2803 return self; |
| 2803 return [folderController_ controllerForNode:node]; | 2804 return [folderController_ controllerForNode:node]; |
| 2804 } | 2805 } |
| 2805 | 2806 |
| 2806 @end | 2807 @end |
| OLD | NEW |