diff options
author | rsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-05 19:21:41 +0000 |
---|---|---|
committer | rsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-05 19:21:41 +0000 |
commit | f9cab10c8331d125c6bf31cc43b2a18c2fa2784c (patch) | |
tree | 1cf11ee77f4e8741767576171e5a6d6525a9ab09 /app | |
parent | aea5a7cf666f0c7077833fb33a255df21b9f9a00 (diff) | |
download | chromium_src-f9cab10c8331d125c6bf31cc43b2a18c2fa2784c.zip chromium_src-f9cab10c8331d125c6bf31cc43b2a18c2fa2784c.tar.gz chromium_src-f9cab10c8331d125c6bf31cc43b2a18c2fa2784c.tar.bz2 |
Define gfx::NativeImage and add ResourceBundle::GetNativeImageNamed().
BUG=none
TEST=compile
Review URL: http://codereview.chromium.org/3597008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61545 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app')
-rw-r--r-- | app/resource_bundle.cc | 11 | ||||
-rw-r--r-- | app/resource_bundle.h | 7 |
2 files changed, 18 insertions, 0 deletions
diff --git a/app/resource_bundle.cc b/app/resource_bundle.cc index ec28581..859f9a83 100644 --- a/app/resource_bundle.cc +++ b/app/resource_bundle.cc @@ -207,6 +207,17 @@ const gfx::Font& ResourceBundle::GetFont(FontStyle style) { } } +gfx::NativeImage ResourceBundle::GetNativeImageNamed(int resource_id) { + ResourceBundle& rb = ResourceBundle::GetSharedInstance(); +#if defined(OS_MACOSX) + return rb.GetNSImageNamed(resource_id); +#elif defined(USE_X11) && !defined(TOOLKIT_VIEWS) + return rb.GetPixbufNamed(resource_id); +#else + return rb.GetBitmapNamed(resource_id); +#endif +} + // LoadedDataPack implementation ResourceBundle::LoadedDataPack::LoadedDataPack(const FilePath& path) : path_(path) { diff --git a/app/resource_bundle.h b/app/resource_bundle.h index 44237e2..8fc6447 100644 --- a/app/resource_bundle.h +++ b/app/resource_bundle.h @@ -21,6 +21,7 @@ #include "base/ref_counted_memory.h" #include "base/scoped_ptr.h" #include "base/string16.h" +#include "gfx/native_widget_types.h" namespace base { class DataPack; @@ -115,6 +116,12 @@ class ResourceBundle { // Returns the font for the specified style. const gfx::Font& GetFont(FontStyle style); + // Returns the gfx::NativeImage, the native platform type, named resource. + // Internally, this makes use of GetNSImageNamed(), GetPixbufNamed(), or + // GetBitmapNamed() depending on the platform (see gfx/native_widget_types.h). + // NOTE: On Mac the returned resource is autoreleased. + gfx::NativeImage GetNativeImageNamed(int resource_id); + #if defined(OS_WIN) // Loads and returns an icon from the app module. HICON LoadThemeIcon(int icon_id); |