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 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1066 } | 1066 } |
1067 [buttons_ addObject:button]; | 1067 [buttons_ addObject:button]; |
1068 } | 1068 } |
1069 } | 1069 } |
1070 | 1070 |
1071 - (BookmarkButton*)buttonForNode:(const BookmarkNode*)node | 1071 - (BookmarkButton*)buttonForNode:(const BookmarkNode*)node |
1072 xOffset:(int*)xOffset { | 1072 xOffset:(int*)xOffset { |
1073 BookmarkButtonCell* cell = [self cellForBookmarkNode:node]; | 1073 BookmarkButtonCell* cell = [self cellForBookmarkNode:node]; |
1074 NSRect frame = [self frameForBookmarkButtonFromCell:cell xOffset:xOffset]; | 1074 NSRect frame = [self frameForBookmarkButtonFromCell:cell xOffset:xOffset]; |
1075 | 1075 |
1076 scoped_nsobject<BookmarkButton> | 1076 base::scoped_nsobject<BookmarkButton> button( |
1077 button([[BookmarkButton alloc] initWithFrame:frame]); | 1077 [[BookmarkButton alloc] initWithFrame:frame]); |
1078 DCHECK(button.get()); | 1078 DCHECK(button.get()); |
1079 | 1079 |
1080 // [NSButton setCell:] warns to NOT use setCell: other than in the | 1080 // [NSButton setCell:] warns to NOT use setCell: other than in the |
1081 // initializer of a control. However, we are using a basic | 1081 // initializer of a control. However, we are using a basic |
1082 // NSButton whose initializer does not take an NSCell as an | 1082 // NSButton whose initializer does not take an NSCell as an |
1083 // object. To honor the assumed semantics, we do nothing with | 1083 // object. To honor the assumed semantics, we do nothing with |
1084 // NSButton between alloc/init and setCell:. | 1084 // NSButton between alloc/init and setCell:. |
1085 [button setCell:cell]; | 1085 [button setCell:cell]; |
1086 [button setDelegate:self]; | 1086 [button setDelegate:self]; |
1087 | 1087 |
(...skipping 1589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2677 - (id<BookmarkButtonControllerProtocol>)controllerForNode: | 2677 - (id<BookmarkButtonControllerProtocol>)controllerForNode: |
2678 (const BookmarkNode*)node { | 2678 (const BookmarkNode*)node { |
2679 // See if it's in the bar, then if it is in the hierarchy of visible | 2679 // See if it's in the bar, then if it is in the hierarchy of visible |
2680 // folder menus. | 2680 // folder menus. |
2681 if (bookmarkModel_->bookmark_bar_node() == node) | 2681 if (bookmarkModel_->bookmark_bar_node() == node) |
2682 return self; | 2682 return self; |
2683 return [folderController_ controllerForNode:node]; | 2683 return [folderController_ controllerForNode:node]; |
2684 } | 2684 } |
2685 | 2685 |
2686 @end | 2686 @end |
OLD | NEW |