Index: chrome/browser/ui/cocoa/menu_controller.mm |
diff --git a/chrome/browser/ui/cocoa/menu_controller.mm b/chrome/browser/ui/cocoa/menu_controller.mm |
index 47f0c348081994998f065d8afea639f58f71f040..3b0a3adb988028d3eacdbbddcbb4358a6a1e4dae 100644 |
--- a/chrome/browser/ui/cocoa/menu_controller.mm |
+++ b/chrome/browser/ui/cocoa/menu_controller.mm |
@@ -144,10 +144,22 @@ |
DCHECK([(id)item isKindOfClass:[NSMenuItem class]]); |
[(id)item setState:(checked ? NSOnState : NSOffState)]; |
[(id)item setHidden:(!model->IsVisibleAt(modelIndex))]; |
- if (model->IsLabelDynamicAt(modelIndex)) { |
+ if (model->IsItemDynamicAt(modelIndex)) { |
+ // Update the label and the icon. |
NSString* label = |
l10n_util::FixUpWindowsStyleLabel(model->GetLabelAt(modelIndex)); |
[(id)item setTitle:label]; |
+ SkBitmap skiaIcon; |
+ if (model->GetIconAt(modelIndex, &skiaIcon) && !skiaIcon.isNull()) { |
+ // We have an icon. |
+ NSImage* icon = gfx::SkBitmapToNSImage(skiaIcon); |
+ if (icon) { |
Evan Stade
2010/12/14 01:20:13
no {}
Andrew T Wilson (Slow)
2010/12/14 18:23:27
Done.
|
+ [(id)item setImage:icon]; |
Evan Stade
2010/12/14 01:20:13
it strikes me that you'll either want to setImage
Andrew T Wilson (Slow)
2010/12/14 18:23:27
Good point - my previous code was just leaving the
|
+ } |
+ } else { |
+ // No icon. |
+ [(id)item setImage:nil]; |
+ } |
} |
return model->IsEnabledAt(modelIndex); |
} |