| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/l10n_util_mac.h" | 7 #include "app/l10n_util_mac.h" |
| 8 #include "app/mac/nsimage_cache.h" |
| 8 #include "base/logging.h" | 9 #include "base/logging.h" |
| 9 #include "base/nsimage_cache_mac.h" | |
| 10 #include "base/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
| 11 #import "chrome/browser/bookmarks/bookmark_model.h" | 11 #import "chrome/browser/bookmarks/bookmark_model.h" |
| 12 #include "chrome/browser/metrics/user_metrics.h" | 12 #include "chrome/browser/metrics/user_metrics.h" |
| 13 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_menu.h" | 13 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_menu.h" |
| 14 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button.h" | 14 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button.h" |
| 15 #import "chrome/browser/ui/cocoa/image_utils.h" | 15 #import "chrome/browser/ui/cocoa/image_utils.h" |
| 16 #include "grit/generated_resources.h" | 16 #include "grit/generated_resources.h" |
| 17 | 17 |
| 18 | 18 |
| 19 @interface BookmarkButtonCell(Private) | 19 @interface BookmarkButtonCell(Private) |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 | 196 |
| 197 // See comment above mouseEntered:, above. | 197 // See comment above mouseEntered:, above. |
| 198 - (void)mouseExited:(NSEvent*)event { | 198 - (void)mouseExited:(NSEvent*)event { |
| 199 [[self controlView] mouseExited:event]; | 199 [[self controlView] mouseExited:event]; |
| 200 [super mouseExited:event]; | 200 [super mouseExited:event]; |
| 201 } | 201 } |
| 202 | 202 |
| 203 - (void)setDrawFolderArrow:(BOOL)draw { | 203 - (void)setDrawFolderArrow:(BOOL)draw { |
| 204 drawFolderArrow_ = draw; | 204 drawFolderArrow_ = draw; |
| 205 if (draw && !arrowImage_) { | 205 if (draw && !arrowImage_) { |
| 206 arrowImage_.reset([nsimage_cache::ImageNamed(@"menu_hierarchy_arrow.pdf") | 206 arrowImage_.reset( |
| 207 retain]); | 207 [app::mac::GetCachedImageWithName(@"menu_hierarchy_arrow.pdf") retain]); |
| 208 } | 208 } |
| 209 } | 209 } |
| 210 | 210 |
| 211 // Add extra size for the arrow so it doesn't overlap the text. | 211 // Add extra size for the arrow so it doesn't overlap the text. |
| 212 // Does not sanity check to be sure this is actually a folder node. | 212 // Does not sanity check to be sure this is actually a folder node. |
| 213 - (NSSize)cellSize { | 213 - (NSSize)cellSize { |
| 214 NSSize cellSize = [super cellSize]; | 214 NSSize cellSize = [super cellSize]; |
| 215 if (drawFolderArrow_) { | 215 if (drawFolderArrow_) { |
| 216 cellSize.width += [arrowImage_ size].width; // plus margin? | 216 cellSize.width += [arrowImage_ size].width; // plus margin? |
| 217 } | 217 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 237 (NSHeight(imageRect) / 2.0)); | 237 (NSHeight(imageRect) / 2.0)); |
| 238 [arrowImage_ drawInRect:drawRect | 238 [arrowImage_ drawInRect:drawRect |
| 239 fromRect:imageRect | 239 fromRect:imageRect |
| 240 operation:NSCompositeSourceOver | 240 operation:NSCompositeSourceOver |
| 241 fraction:[self isEnabled] ? 1.0 : 0.5 | 241 fraction:[self isEnabled] ? 1.0 : 0.5 |
| 242 neverFlipped:YES]; | 242 neverFlipped:YES]; |
| 243 } | 243 } |
| 244 } | 244 } |
| 245 | 245 |
| 246 @end | 246 @end |
| OLD | NEW |