diff options
author | rsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-22 17:59:47 +0000 |
---|---|---|
committer | rsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-22 17:59:47 +0000 |
commit | 6f01e95e2c326c01f573968b136781e87e62067a (patch) | |
tree | 4991623f5221c97147992f60a10b2147d230aebc /chrome/browser/page_info_model.cc | |
parent | e4359be2f8068dce74234add3fb5268bbc90670f (diff) | |
download | chromium_src-6f01e95e2c326c01f573968b136781e87e62067a.zip chromium_src-6f01e95e2c326c01f573968b136781e87e62067a.tar.gz chromium_src-6f01e95e2c326c01f573968b136781e87e62067a.tar.bz2 |
Integrate gfx::Image into the ResourceBundle.
This changes the definition of GetNativeImageNamed to return a gfx::Image and
adds GetImageNamed in addition. GetBitmapNamed now goes through that method. On
Linux, GetNativeImageNamed will load directly into a GdkPixbuf-backed Image. Mac
will still first load through Skia (a future CL will load directly into an
NSImage). All other platforms use Skia natively, so GetNativeImageNamed is the
same as GetImageNamed.
Mac was the only platform that used the old GetNativeImageNamed, so this also
transitions a bunch of Mac files by including ui/gfx/image.h.
This also obviates the need for platform-specific image caches in the
ResourceBundle, so there's some additional cleanup around that.
BUG=carnitas
TEST=All UI images in Chromium show up as before.
Review URL: http://codereview.chromium.org/6541031
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@75605 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/page_info_model.cc')
-rw-r--r-- | chrome/browser/page_info_model.cc | 36 |
1 files changed, 6 insertions, 30 deletions
diff --git a/chrome/browser/page_info_model.cc b/chrome/browser/page_info_model.cc index c8d327d..b8ce79a 100644 --- a/chrome/browser/page_info_model.cc +++ b/chrome/browser/page_info_model.cc @@ -23,10 +23,6 @@ #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" -#if defined(OS_MACOSX) -#include "base/mac/mac_util.h" -#endif - PageInfoModel::PageInfoModel(Profile* profile, const GURL& url, const NavigationEntry::SSLStatus& ssl, @@ -280,16 +276,6 @@ PageInfoModel::PageInfoModel(Profile* profile, } } -PageInfoModel::~PageInfoModel() { -#if defined(OS_MACOSX) - // Release the NSImages. - for (std::vector<gfx::NativeImage>::iterator it = icons_.begin(); - it != icons_.end(); ++it) { - base::mac::NSObjectRelease(*it); - } -#endif -} - int PageInfoModel::GetSectionCount() { return sections_.size(); } @@ -299,7 +285,7 @@ PageInfoModel::SectionInfo PageInfoModel::GetSectionInfo(int index) { return sections_[index]; } -gfx::NativeImage PageInfoModel::GetIconImage(SectionStateIcon icon_id) { +gfx::Image* PageInfoModel::GetIconImage(SectionStateIcon icon_id) { if (icon_id == ICON_NONE) return NULL; // The bubble uses new, various icons. @@ -350,20 +336,10 @@ PageInfoModel::PageInfoModel() : observer_(NULL) { void PageInfoModel::Init() { // Loads the icons into the vector. The order must match the SectionStateIcon // enum. - icons_.push_back(GetBitmapNamed(IDR_PAGEINFO_GOOD)); - icons_.push_back(GetBitmapNamed(IDR_PAGEINFO_WARNING_MINOR)); - icons_.push_back(GetBitmapNamed(IDR_PAGEINFO_WARNING_MAJOR)); - icons_.push_back(GetBitmapNamed(IDR_PAGEINFO_BAD)); - icons_.push_back(GetBitmapNamed(IDR_PAGEINFO_INFO)); -} - -gfx::NativeImage PageInfoModel::GetBitmapNamed(int resource_id) { ResourceBundle& rb = ResourceBundle::GetSharedInstance(); - gfx::NativeImage image = rb.GetNativeImageNamed(resource_id); -#if defined(OS_MACOSX) - // Unlike other platforms, the Mac ResourceBundle does not keep a shared image - // cache. These are released in the dtor. - base::mac::NSObjectRetain(image); -#endif - return image; + icons_.push_back(&rb.GetNativeImageNamed(IDR_PAGEINFO_GOOD)); + icons_.push_back(&rb.GetNativeImageNamed(IDR_PAGEINFO_WARNING_MINOR)); + icons_.push_back(&rb.GetNativeImageNamed(IDR_PAGEINFO_WARNING_MAJOR)); + icons_.push_back(&rb.GetNativeImageNamed(IDR_PAGEINFO_BAD)); + icons_.push_back(&rb.GetNativeImageNamed(IDR_PAGEINFO_INFO)); } |