diff options
author | thomasvl@chromium.org <thomasvl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-09 20:59:32 +0000 |
---|---|---|
committer | thomasvl@chromium.org <thomasvl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-09 20:59:32 +0000 |
commit | 655345e0991a974109e0f2656f6e00afbe8d9e59 (patch) | |
tree | 7fcca7714b4957f9efed3496e863c4f15b48941a /chrome/browser/cocoa/toolbar_controller.mm | |
parent | 5ce8cbcbf65f801bc7f52cc035027d0eb907add5 (diff) | |
download | chromium_src-655345e0991a974109e0f2656f6e00afbe8d9e59.zip chromium_src-655345e0991a974109e0f2656f6e00afbe8d9e59.tar.gz chromium_src-655345e0991a974109e0f2656f6e00afbe8d9e59.tar.bz2 |
Added an helper namespace that provides fetches images from the app bundle and caches them, line NSImage imageNamed: but lets us control the bundle that's checked.
Unittest for the helper.
Updated the current places that use +[NSImage imageNamed:] to use our cache helper.
BUG=none
TEST=All the ui images still load.
Review URL: http://codereview.chromium.org/149393
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20309 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/toolbar_controller.mm')
-rw-r--r-- | chrome/browser/cocoa/toolbar_controller.mm | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/chrome/browser/cocoa/toolbar_controller.mm b/chrome/browser/cocoa/toolbar_controller.mm index eba4d89..d7cd131 100644 --- a/chrome/browser/cocoa/toolbar_controller.mm +++ b/chrome/browser/cocoa/toolbar_controller.mm @@ -8,6 +8,7 @@ #include "base/sys_string_conversions.h" #include "chrome/app/chrome_dll_resource.h" #import "chrome/browser/cocoa/location_bar_view_mac.h" +#include "chrome/browser/cocoa/nsimage_cache.h" #include "chrome/browser/profile.h" #include "chrome/browser/toolbar_model.h" #include "chrome/common/notification_details.h" @@ -17,8 +18,8 @@ #include "chrome/common/pref_service.h" // Names of images in the bundle for the star icon (normal and 'starred'). -static NSString* const kStarImageName = @"star"; -static NSString* const kStarredImageName = @"starred"; +static NSString* const kStarImageName = @"star.pdf"; +static NSString* const kStarredImageName = @"starred.pdf"; @implementation LocationBarFieldEditor - (void)copy:(id)sender { @@ -175,17 +176,17 @@ class PrefObserverBridge : public NotificationObserver { NSString* starImageName = kStarImageName; if (isStarred) starImageName = kStarredImageName; - [starButton_ setImage:[NSImage imageNamed:starImageName]]; + [starButton_ setImage:nsimage_cache::ImageNamed(starImageName)]; } - (void)setIsLoading:(BOOL)isLoading { - NSString* imageName = @"go"; + NSString* imageName = @"go.pdf"; NSInteger tag = IDC_GO; if (isLoading) { - imageName = @"stop"; + imageName = @"stop.pdf"; tag = IDC_STOP; } - [goButton_ setImage:[NSImage imageNamed:imageName]]; + [goButton_ setImage:nsimage_cache::ImageNamed(imageName)]; [goButton_ setTag:tag]; } |