| 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 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1038 // Example: for a bookmark named "Moma" or "SFGate", it is one pixel | 1038 // Example: for a bookmark named "Moma" or "SFGate", it is one pixel |
| 1039 // too small. For "FBL" it is 2 pixels too small. | 1039 // too small. For "FBL" it is 2 pixels too small. |
| 1040 // For a bookmark named "SFGateFooWoo", it is just fine. | 1040 // For a bookmark named "SFGateFooWoo", it is just fine. |
| 1041 - (CGFloat)widthForBookmarkButtonCell:(NSCell*)cell { | 1041 - (CGFloat)widthForBookmarkButtonCell:(NSCell*)cell { |
| 1042 CGFloat desired = [cell cellSize].width + 2; | 1042 CGFloat desired = [cell cellSize].width + 2; |
| 1043 return std::min(desired, bookmarks::kDefaultBookmarkWidth); | 1043 return std::min(desired, bookmarks::kDefaultBookmarkWidth); |
| 1044 } | 1044 } |
| 1045 | 1045 |
| 1046 - (IBAction)openBookmarkMenuItem:(id)sender { | 1046 - (IBAction)openBookmarkMenuItem:(id)sender { |
| 1047 int64 tag = [self nodeIdFromMenuTag:[sender tag]]; | 1047 int64 tag = [self nodeIdFromMenuTag:[sender tag]]; |
| 1048 const BookmarkNode* node = GetBookmarkNodeByID(bookmarkModel_, tag); | 1048 const BookmarkNode* node = |
| 1049 bookmarks::GetBookmarkNodeByID(bookmarkModel_, tag); |
| 1049 WindowOpenDisposition disposition = | 1050 WindowOpenDisposition disposition = |
| 1050 ui::WindowOpenDispositionFromNSEvent([NSApp currentEvent]); | 1051 ui::WindowOpenDispositionFromNSEvent([NSApp currentEvent]); |
| 1051 [self openURL:node->url() disposition:disposition]; | 1052 [self openURL:node->url() disposition:disposition]; |
| 1052 } | 1053 } |
| 1053 | 1054 |
| 1054 // For the given root node of the bookmark bar, show or hide (as | 1055 // For the given root node of the bookmark bar, show or hide (as |
| 1055 // appropriate) the "no items" container (text which says "bookmarks | 1056 // appropriate) the "no items" container (text which says "bookmarks |
| 1056 // go here"). | 1057 // go here"). |
| 1057 - (void)showOrHideNoItemContainerForNode:(const BookmarkNode*)node { | 1058 - (void)showOrHideNoItemContainerForNode:(const BookmarkNode*)node { |
| 1058 BOOL hideNoItemWarning = !node->empty(); | 1059 BOOL hideNoItemWarning = !node->empty(); |
| (...skipping 1736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2795 - (id<BookmarkButtonControllerProtocol>)controllerForNode: | 2796 - (id<BookmarkButtonControllerProtocol>)controllerForNode: |
| 2796 (const BookmarkNode*)node { | 2797 (const BookmarkNode*)node { |
| 2797 // See if it's in the bar, then if it is in the hierarchy of visible | 2798 // See if it's in the bar, then if it is in the hierarchy of visible |
| 2798 // folder menus. | 2799 // folder menus. |
| 2799 if (bookmarkModel_->bookmark_bar_node() == node) | 2800 if (bookmarkModel_->bookmark_bar_node() == node) |
| 2800 return self; | 2801 return self; |
| 2801 return [folderController_ controllerForNode:node]; | 2802 return [folderController_ controllerForNode:node]; |
| 2802 } | 2803 } |
| 2803 | 2804 |
| 2804 @end | 2805 @end |
| OLD | NEW |