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_button_cell.h" | 5 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button_cell.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/strings/sys_string_conversions.h" | 8 #include "base/strings/sys_string_conversions.h" |
9 #import "chrome/browser/bookmarks/bookmark_model.h" | 9 #import "chrome/browser/bookmarks/bookmark_model.h" |
10 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button.h" | 10 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button.h" |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 - (void)setBookmarkNode:(const BookmarkNode*)node { | 176 - (void)setBookmarkNode:(const BookmarkNode*)node { |
177 [self setRepresentedObject:[NSValue valueWithPointer:node]]; | 177 [self setRepresentedObject:[NSValue valueWithPointer:node]]; |
178 } | 178 } |
179 | 179 |
180 - (const BookmarkNode*)bookmarkNode { | 180 - (const BookmarkNode*)bookmarkNode { |
181 return static_cast<const BookmarkNode*>([[self representedObject] | 181 return static_cast<const BookmarkNode*>([[self representedObject] |
182 pointerValue]); | 182 pointerValue]); |
183 } | 183 } |
184 | 184 |
185 - (NSMenu*)menu { | 185 - (NSMenu*)menu { |
186 if (empty_) | |
187 return nil; | |
188 | |
189 // If node is NULL, this is a custom button, the menu does not represent | 186 // If node is NULL, this is a custom button, the menu does not represent |
190 // anything. | 187 // anything. |
191 const BookmarkNode* node = [self bookmarkNode]; | 188 const BookmarkNode* node = [self bookmarkNode]; |
192 | 189 |
193 if (node && node->parent() && | 190 if (node && node->parent() && |
194 node->parent()->type() == BookmarkNode::FOLDER) { | 191 node->parent()->type() == BookmarkNode::FOLDER) { |
195 content::RecordAction(UserMetricsAction("BookmarkBarFolder_CtxMenu")); | 192 content::RecordAction(UserMetricsAction("BookmarkBarFolder_CtxMenu")); |
196 } else { | 193 } else { |
197 content::RecordAction(UserMetricsAction("BookmarkBar_CtxMenu")); | 194 content::RecordAction(UserMetricsAction("BookmarkBar_CtxMenu")); |
198 } | 195 } |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 respectFlipped:YES | 288 respectFlipped:YES |
292 hints:nil]; | 289 hints:nil]; |
293 } | 290 } |
294 } | 291 } |
295 | 292 |
296 - (int)verticalTextOffset { | 293 - (int)verticalTextOffset { |
297 return 0; | 294 return 0; |
298 } | 295 } |
299 | 296 |
300 @end | 297 @end |
OLD | NEW |