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

Unified Diff: chrome/browser/ui/cocoa/menu_controller.mm

Issue 5697005: Change SimpleMenuModel on OSX to support dynamic icons (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update after merge Created 10 years 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/menu_controller.mm
diff --git a/chrome/browser/ui/cocoa/menu_controller.mm b/chrome/browser/ui/cocoa/menu_controller.mm
index 47f0c348081994998f065d8afea639f58f71f040..a6d314d80ab5b6ed8b0f5e0de3c1101615de0738 100644
--- a/chrome/browser/ui/cocoa/menu_controller.mm
+++ b/chrome/browser/ui/cocoa/menu_controller.mm
@@ -144,10 +144,16 @@
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;
+ NSImage* icon = nil;
+ if (model->GetIconAt(modelIndex, &skiaIcon) && !skiaIcon.isNull())
+ icon = gfx::SkBitmapToNSImage(skiaIcon);
+ [(id)item setImage:icon];
}
return model->IsEnabledAt(modelIndex);
}
« no previous file with comments | « chrome/browser/notifications/notification_options_menu_model.cc ('k') | chrome/browser/ui/cocoa/menu_controller_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698