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

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

Issue 10824402: Convert ui::MenuModel to use gfx::Image instead of ImageSkia. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Another day, another rebase Created 8 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/menu_controller.mm
diff --git a/chrome/browser/ui/cocoa/menu_controller.mm b/chrome/browser/ui/cocoa/menu_controller.mm
index c66d38eb54fb079a3a6e881a7e77352e6a58c487..aae1dcb321fb91373d9d97aa23becf8ce828c221 100644
--- a/chrome/browser/ui/cocoa/menu_controller.mm
+++ b/chrome/browser/ui/cocoa/menu_controller.mm
@@ -10,8 +10,7 @@
#include "ui/base/accelerators/accelerator_cocoa.h"
#include "ui/base/l10n/l10n_util_mac.h"
#include "ui/base/models/simple_menu_model.h"
-#include "ui/gfx/image/image_skia.h"
-#include "ui/gfx/image/image_skia_util_mac.h"
+#include "ui/gfx/image/image.h"
@interface MenuController (Private)
- (void)addSeparatorToMenu:(NSMenu*)menu
@@ -106,13 +105,9 @@
keyEquivalent:@""]);
// If the menu item has an icon, set it.
- gfx::ImageSkia skiaIcon;
- if (model->GetIconAt(modelIndex, &skiaIcon) && !skiaIcon.isNull()) {
- NSImage* icon = gfx::NSImageFromImageSkia(skiaIcon);
- if (icon) {
- [item setImage:icon];
- }
- }
+ gfx::Image icon;
+ if (model->GetIconAt(modelIndex, &icon) && !icon.IsEmpty())
+ [item setImage:icon.ToNSImage()];
ui::MenuModel::ItemType type = model->GetTypeAt(modelIndex);
if (type == ui::MenuModel::TYPE_SUBMENU) {
@@ -165,11 +160,10 @@
NSString* label =
l10n_util::FixUpWindowsStyleLabel(model->GetLabelAt(modelIndex));
[(id)item setTitle:label];
- gfx::ImageSkia skiaIcon;
- NSImage* icon = nil;
- if (model->GetIconAt(modelIndex, &skiaIcon) && !skiaIcon.isNull())
- icon = gfx::NSImageFromImageSkia(skiaIcon);
- [(id)item setImage:icon];
+
+ gfx::Image icon;
+ model->GetIconAt(modelIndex, &icon);
+ [(id)item setImage:icon.IsEmpty() ? nil : icon.ToNSImage()];
}
return model->IsEnabledAt(modelIndex);
}
« no previous file with comments | « chrome/browser/tab_contents/render_view_context_menu.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