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

Unified Diff: chrome/browser/ui/cocoa/location_bar/page_action_decoration.mm

Issue 10827191: Convert extension action icons code to use ImageSkia instead of SkBitmap (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nits 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/location_bar/page_action_decoration.mm
diff --git a/chrome/browser/ui/cocoa/location_bar/page_action_decoration.mm b/chrome/browser/ui/cocoa/location_bar/page_action_decoration.mm
index 9f4b2f4df97db48779b1fbb95a34d4b3ce317a94..2776b3a0158477de83282a6a162365c8f49e1809 100644
--- a/chrome/browser/ui/cocoa/location_bar/page_action_decoration.mm
+++ b/chrome/browser/ui/cocoa/location_bar/page_action_decoration.mm
@@ -26,6 +26,8 @@
#include "content/public/browser/notification_service.h"
#include "content/public/browser/web_contents.h"
#include "skia/ext/skia_utils_mac.h"
+#include "ui/gfx/image/image_skia.h"
+#include "ui/gfx/image/image_skia_util_mac.h"
using content::WebContents;
using extensions::Extension;
@@ -143,10 +145,13 @@ void PageActionDecoration::OnImageLoaded(const gfx::Image& image,
// Map the index of the loaded image back to its name. If we ever get an
// index greater than the number of icons, it must be the default icon.
- if (index < static_cast<int>(page_action_->icon_paths()->size()))
- page_action_->CacheIcon(page_action_->icon_paths()->at(index), image);
- else
- page_action_->CacheIcon(page_action_->default_icon_path(), image);
+ if (index < static_cast<int>(page_action_->icon_paths()->size())) {
+ page_action_->CacheIcon(page_action_->icon_paths()->at(index),
+ *image.ToImageSkia());
+ } else {
+ page_action_->CacheIcon(page_action_->default_icon_path(),
+ *image.ToImageSkia());
+ }
// If we have no owner, that means this class is still being constructed.
TabContents* tab_contents = owner_ ? owner_->GetTabContents() : NULL;
@@ -169,9 +174,9 @@ void PageActionDecoration::UpdateVisibility(WebContents* contents,
SetToolTip(page_action_->GetTitle(current_tab_id_));
// Set the image.
- gfx::Image icon = page_action_->GetIcon(current_tab_id_);
- if (!icon.IsEmpty()) {
- SetImage(icon.ToNSImage());
+ gfx::ImageSkia icon = page_action_->GetIcon(current_tab_id_);
+ if (!icon.empty()) {
+ SetImage(gfx::NSImageFromImageSkia(icon));
} else if (!GetImage()) {
const NSSize default_size = NSMakeSize(Extension::kPageActionIconMaxSize,
Extension::kPageActionIconMaxSize);

Powered by Google App Engine
This is Rietveld 408576698