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

Unified Diff: chrome/browser/themes/theme_service.cc

Issue 10388064: Add GetImageSkiaNamed to resource_bundle and theme_provider (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed nits Created 8 years, 7 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/themes/theme_service.cc
diff --git a/chrome/browser/themes/theme_service.cc b/chrome/browser/themes/theme_service.cc
index e5628e46e0a892655266c8c88b47e428f6ded32f..f9be8372dce9bf43da54262eb1336f4dbb2ca287 100644
--- a/chrome/browser/themes/theme_service.cc
+++ b/chrome/browser/themes/theme_service.cc
@@ -22,6 +22,7 @@
#include "grit/theme_resources_standard.h"
#include "grit/ui_resources.h"
#include "ui/base/resource/resource_bundle.h"
+#include "ui/gfx/image/image_skia.h"
#if defined(OS_WIN) && !defined(USE_AURA)
#include "ui/views/widget/native_widget_win.h"
@@ -244,17 +245,20 @@ const gfx::Image* ThemeService::GetImageNamed(int id) const {
}
SkBitmap* ThemeService::GetBitmapNamed(int id) const {
- DCHECK(CalledOnValidThread());
-
- SkBitmap* bitmap = NULL;
-
- if (theme_pack_.get())
- bitmap = theme_pack_->GetBitmapNamed(id);
+ const gfx::Image* image = GetImageNamed(id);
+ if (!image)
+ return NULL;
- if (!bitmap)
- bitmap = rb_.GetBitmapNamed(id);
+ return const_cast<SkBitmap*>(image->ToSkBitmap());
+}
- return bitmap;
+gfx::ImageSkia* ThemeService::GetImageSkiaNamed(int id) const {
+ const gfx::Image* image = GetImageNamed(id);
+ if (!image)
+ return NULL;
+ // TODO(pkotwicz): Remove this const cast. The gfx::Image interface returns
+ // its images const. GetImageSkiaNamed() also should but has many callsites.
+ return const_cast<gfx::ImageSkia*>(image->ToImageSkia());
}
SkColor ThemeService::GetColor(int id) const {
« no previous file with comments | « chrome/browser/themes/theme_service.h ('k') | chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698