diff options
author | thomasvl@chromium.org <thomasvl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-06 15:08:17 +0000 |
---|---|---|
committer | thomasvl@chromium.org <thomasvl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-06 15:08:17 +0000 |
commit | 87ae07b73aa50124639388a145d7733c68f094cb (patch) | |
tree | bb6de38a8a86cf03a87a8c94a64e547f291d5c4a /chrome/browser/autocomplete | |
parent | 240f892ba41dcf28c976c22bb0a41eb5f7f699d7 (diff) | |
download | chromium_src-87ae07b73aa50124639388a145d7733c68f094cb.zip chromium_src-87ae07b73aa50124639388a145d7733c68f094cb.tar.gz chromium_src-87ae07b73aa50124639388a145d7733c68f094cb.tar.bz2 |
Removed omnibox images from the bundle.
Update the code to pull the omnibox images from the pak files instead.
TEST=Omnibox still has all the right images next to the things it lists
BUG=20230
Review URL: http://codereview.chromium.org/246101
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28104 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autocomplete')
-rw-r--r-- | chrome/browser/autocomplete/autocomplete_popup_view_mac.mm | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm b/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm index 79c0b33..d476e830 100644 --- a/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm +++ b/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm @@ -5,6 +5,7 @@ #include "chrome/browser/autocomplete/autocomplete_popup_view_mac.h" #include "app/gfx/text_elider.h" +#include "app/resource_bundle.h" #include "base/nsimage_cache_mac.h" #include "base/sys_string_conversions.h" #include "base/gfx/rect.h" @@ -13,6 +14,7 @@ #include "chrome/browser/autocomplete/autocomplete_popup_model.h" #include "chrome/browser/bubble_positioner.h" #include "chrome/browser/cocoa/event_utils.h" +#include "grit/theme_resources.h" namespace { @@ -76,32 +78,45 @@ static const NSColor* DescriptionTextColor() { return [NSColor darkGrayColor]; } +// Helper to fetch and retain an image from the resource bundle. +NSImage* RetainedResourceImage(int resource_id) { + ResourceBundle& rb = ResourceBundle::GetSharedInstance(); + NSImage* image = rb.GetNSImageNamed(resource_id); + DCHECK(image); + return [image retain]; +} + // Return the appropriate icon for the given match. Derived from the // gtk code. NSImage* MatchIcon(const AutocompleteMatch& match) { if (match.starred) { - return nsimage_cache::ImageNamed(@"o2_star.png"); + static NSImage* starImage = RetainedResourceImage(IDR_O2_STAR); + return starImage; } switch (match.type) { case AutocompleteMatch::URL_WHAT_YOU_TYPED: case AutocompleteMatch::NAVSUGGEST: { - return nsimage_cache::ImageNamed(@"o2_globe.png"); + static NSImage* globeImage = RetainedResourceImage(IDR_O2_GLOBE); + return globeImage; } case AutocompleteMatch::HISTORY_URL: case AutocompleteMatch::HISTORY_TITLE: case AutocompleteMatch::HISTORY_BODY: case AutocompleteMatch::HISTORY_KEYWORD: { - return nsimage_cache::ImageNamed(@"o2_history.png"); + static NSImage* historyImage = RetainedResourceImage(IDR_O2_HISTORY); + return historyImage; } case AutocompleteMatch::SEARCH_WHAT_YOU_TYPED: case AutocompleteMatch::SEARCH_HISTORY: case AutocompleteMatch::SEARCH_SUGGEST: case AutocompleteMatch::SEARCH_OTHER_ENGINE: { - return nsimage_cache::ImageNamed(@"o2_search.png"); + static NSImage* searchImage = RetainedResourceImage(IDR_O2_SEARCH); + return searchImage; } case AutocompleteMatch::OPEN_HISTORY_PAGE: { - return nsimage_cache::ImageNamed(@"o2_more.png"); + static NSImage* moreImage = RetainedResourceImage(IDR_O2_MORE); + return moreImage; } default: NOTREACHED(); |