OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "app/mac/nsimage_cache.h" | 7 #include "app/mac/nsimage_cache.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/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
(...skipping 1190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1201 const BookmarkNode* node = bookmarkModel_->GetNodeByID(tag); | 1201 const BookmarkNode* node = bookmarkModel_->GetNodeByID(tag); |
1202 WindowOpenDisposition disposition = | 1202 WindowOpenDisposition disposition = |
1203 event_utils::WindowOpenDispositionFromNSEvent([NSApp currentEvent]); | 1203 event_utils::WindowOpenDispositionFromNSEvent([NSApp currentEvent]); |
1204 [self openURL:node->GetURL() disposition:disposition]; | 1204 [self openURL:node->GetURL() disposition:disposition]; |
1205 } | 1205 } |
1206 | 1206 |
1207 // For the given root node of the bookmark bar, show or hide (as | 1207 // For the given root node of the bookmark bar, show or hide (as |
1208 // appropriate) the "no items" container (text which says "bookmarks | 1208 // appropriate) the "no items" container (text which says "bookmarks |
1209 // go here"). | 1209 // go here"). |
1210 - (void)showOrHideNoItemContainerForNode:(const BookmarkNode*)node { | 1210 - (void)showOrHideNoItemContainerForNode:(const BookmarkNode*)node { |
1211 BOOL hideNoItemWarning = node->child_count() > 0; | 1211 BOOL hideNoItemWarning = !node->empty(); |
1212 [[buttonView_ noItemContainer] setHidden:hideNoItemWarning]; | 1212 [[buttonView_ noItemContainer] setHidden:hideNoItemWarning]; |
1213 } | 1213 } |
1214 | 1214 |
1215 // TODO(jrg): write a "build bar" so there is a nice spot for things | 1215 // TODO(jrg): write a "build bar" so there is a nice spot for things |
1216 // like the contextual menu which is invoked when not over a | 1216 // like the contextual menu which is invoked when not over a |
1217 // bookmark. On Safari that menu has a "new folder" option. | 1217 // bookmark. On Safari that menu has a "new folder" option. |
1218 - (void)addNodesToButtonList:(const BookmarkNode*)node { | 1218 - (void)addNodesToButtonList:(const BookmarkNode*)node { |
1219 [self showOrHideNoItemContainerForNode:node]; | 1219 [self showOrHideNoItemContainerForNode:node]; |
1220 | 1220 |
1221 CGFloat maxViewX = NSMaxX([[self view] bounds]); | 1221 CGFloat maxViewX = NSMaxX([[self view] bounds]); |
(...skipping 1500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2722 // to minimize touching the object passed in (likely a mock). | 2722 // to minimize touching the object passed in (likely a mock). |
2723 - (void)setButtonContextMenu:(id)menu { | 2723 - (void)setButtonContextMenu:(id)menu { |
2724 buttonContextMenu_ = menu; | 2724 buttonContextMenu_ = menu; |
2725 } | 2725 } |
2726 | 2726 |
2727 - (void)setIgnoreAnimations:(BOOL)ignore { | 2727 - (void)setIgnoreAnimations:(BOOL)ignore { |
2728 ignoreAnimations_ = ignore; | 2728 ignoreAnimations_ = ignore; |
2729 } | 2729 } |
2730 | 2730 |
2731 @end | 2731 @end |
OLD | NEW |