summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/toolbar_controller.mm
diff options
context:
space:
mode:
authoravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-21 14:19:55 +0000
committeravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-21 14:19:55 +0000
commit6044cdfe614c15dce3064ef81d65b8a40f7d1437 (patch)
tree21c427a75d8a820ef0ca4eb614d84d24b97a86f0 /chrome/browser/cocoa/toolbar_controller.mm
parent9d89101b3ee934e3a9d5e8823c734f60a4740294 (diff)
downloadchromium_src-6044cdfe614c15dce3064ef81d65b8a40f7d1437.zip
chromium_src-6044cdfe614c15dce3064ef81d65b8a40f7d1437.tar.gz
chromium_src-6044cdfe614c15dce3064ef81d65b8a40f7d1437.tar.bz2
Unblackify the upgrade ball.
BUG=http://crbug.com/49370 TEST=as in bug Review URL: http://codereview.chromium.org/3047005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53181 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/toolbar_controller.mm')
-rw-r--r--chrome/browser/cocoa/toolbar_controller.mm36
1 files changed, 22 insertions, 14 deletions
diff --git a/chrome/browser/cocoa/toolbar_controller.mm b/chrome/browser/cocoa/toolbar_controller.mm
index a8447821..a2abf32 100644
--- a/chrome/browser/cocoa/toolbar_controller.mm
+++ b/chrome/browser/cocoa/toolbar_controller.mm
@@ -259,13 +259,10 @@ class NotificationBridge : public NotificationObserver {
[reloadButton_
setImage:nsimage_cache::ImageNamed(kReloadButtonReloadImageName)];
[homeButton_ setImage:nsimage_cache::ImageNamed(kHomeButtonImageName)];
+ [wrenchButton_ setImage:nsimage_cache::ImageNamed(kWrenchButtonImageName)];
- if (Singleton<UpgradeDetector>::get()->notify_upgrade()) {
+ if (Singleton<UpgradeDetector>::get()->notify_upgrade())
[self badgeWrenchMenu];
- } else {
- NSImage* wrenchImage = nsimage_cache::ImageNamed(kWrenchButtonImageName);
- [wrenchButton_ setImage:wrenchImage];
- }
[backButton_ setShowsBorderOnlyWhileMouseInside:YES];
[forwardButton_ setShowsBorderOnlyWhileMouseInside:YES];
@@ -565,20 +562,31 @@ class NotificationBridge : public NotificationObserver {
}
- (void)badgeWrenchMenu {
- // The wrench menu gets an upgrade dot. Currently, it's ugly.
- // http://crbug.com/49370
- NSImage* wrenchImage = nsimage_cache::ImageNamed(kWrenchButtonImageName);
+ // The wrench menu gets an upgrade dot. This gets ugly because we only have a
+ // PNG so we need to position it. TODO(avi): Get a PDF version, one ready for
+ // overlaying. http://crbug.com/49668
+ //
+ // In the Windows version, the ball doesn't actually pulsate, and is always
+ // drawn with the inactive image. Why? (We follow suit, though not on the
+ // weird positioning they do that overlaps the button border.)
ThemeProvider* theme_provider = profile_->GetThemeProvider();
- NSImage* badge = theme_provider->GetNSImageNamed(IDR_UPGRADE_DOT_ACTIVE,
+ NSImage* badge = theme_provider->GetNSImageNamed(IDR_UPGRADE_DOT_INACTIVE,
true);
- [wrenchImage lockFocus];
- [badge drawAtPoint:NSMakePoint(1, 1)
+
+ NSImage* wrenchImage = nsimage_cache::ImageNamed(kWrenchButtonImageName);
+ NSSize wrenchImageSize = [wrenchImage size];
+
+ scoped_nsobject<NSImage> overlayImage(
+ [[NSImage alloc] initWithSize:wrenchImageSize]);
+
+ [overlayImage lockFocus];
+ [badge drawAtPoint:NSZeroPoint
fromRect:NSZeroRect
operation:NSCompositeSourceOver
fraction:1.0];
- [wrenchImage unlockFocus];
- [wrenchButton_ setImage:wrenchImage];
- [wrenchButton_ setNeedsDisplay:YES];
+ [overlayImage unlockFocus];
+
+ [[wrenchButton_ cell] setOverlayImage:overlayImage];
}
- (void)prefChanged:(std::wstring*)prefName {