Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6811)

Unified Diff: chrome/browser/ui/cocoa/bookmarks/bookmark_button_cell.mm

Issue 7465090: [Mac] Replace the custom bookmark menus with native NSMenus. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Typo Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/bookmarks/bookmark_button_cell.mm
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_button_cell.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_button_cell.mm
index 392c7ca623d000ad1e3d3cd9f8c08cbf94c51ff2..3de541556e8e6777d7ce5d9d9d493493da5954c6 100644
--- a/chrome/browser/ui/cocoa/bookmarks/bookmark_button_cell.mm
+++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_button_cell.mm
@@ -13,7 +13,6 @@
#include "content/browser/user_metrics.h"
#include "grit/generated_resources.h"
#include "ui/base/l10n/l10n_util_mac.h"
-#include "ui/gfx/mac/nsimage_cache.h"
@interface BookmarkButtonCell(Private)
@@ -25,7 +24,6 @@
@implementation BookmarkButtonCell
@synthesize startingChildIndex = startingChildIndex_;
-@synthesize drawFolderArrow = drawFolderArrow_;
+ (id)buttonCellForNode:(const BookmarkNode*)node
contextMenu:(NSMenu*)contextMenu
@@ -208,48 +206,4 @@
[super mouseExited:event];
}
-- (void)setDrawFolderArrow:(BOOL)draw {
- drawFolderArrow_ = draw;
- if (draw && !arrowImage_) {
- arrowImage_.reset(
- [gfx::GetCachedImageWithName(@"menu_hierarchy_arrow.pdf") retain]);
- }
-}
-
-// Add extra size for the arrow so it doesn't overlap the text.
-// Does not sanity check to be sure this is actually a folder node.
-- (NSSize)cellSize {
- NSSize cellSize = [super cellSize];
- if (drawFolderArrow_) {
- cellSize.width += [arrowImage_ size].width; // plus margin?
- }
- return cellSize;
-}
-
-// Override cell drawing to add a submenu arrow like a real menu.
-- (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView*)controlView {
- // First draw "everything else".
- [super drawInteriorWithFrame:cellFrame inView:controlView];
-
- // If asked to do so, and if a folder, draw the arrow.
- if (!drawFolderArrow_)
- return;
- BookmarkButton* button = static_cast<BookmarkButton*>([self controlView]);
- DCHECK([button respondsToSelector:@selector(isFolder)]);
- if ([button isFolder]) {
- NSRect imageRect = NSZeroRect;
- imageRect.size = [arrowImage_ size];
- const CGFloat kArrowOffset = 1.0; // Required for proper centering.
- CGFloat dX = NSWidth(cellFrame) - NSWidth(imageRect);
- CGFloat dY = (NSHeight(cellFrame) / 2.0) - (NSHeight(imageRect) / 2.0) +
- kArrowOffset;
- NSRect drawRect = NSOffsetRect(imageRect, dX, dY);
- [arrowImage_ drawInRect:drawRect
- fromRect:imageRect
- operation:NSCompositeSourceOver
- fraction:[self isEnabled] ? 1.0 : 0.5
- neverFlipped:YES];
- }
-}
-
@end

Powered by Google App Engine
This is Rietveld 408576698