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

Unified Diff: chrome/browser/page_info_model.cc

Issue 6541031: Integrate gfx::Image into the ResourceBundle. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add some comments Created 9 years, 10 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
« no previous file with comments | « chrome/browser/page_info_model.h ('k') | chrome/browser/ui/cocoa/about_window_controller.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/page_info_model.cc
diff --git a/chrome/browser/page_info_model.cc b/chrome/browser/page_info_model.cc
index c8d327d29c4df898f2e6b0c04c77bd0bea1ddd9f..b8ce79a378b34c83521c0f3f5f48dd25c597e22a 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));
}
« no previous file with comments | « chrome/browser/page_info_model.h ('k') | chrome/browser/ui/cocoa/about_window_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698