Index: chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm |
diff --git a/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm b/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm |
index 09d2511535f0e7e5279b193d0e9204f7ce07c5ee..88a8e04ce85d7601b94002bed18dcd2c061ace70 100644 |
--- a/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm |
+++ b/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm |
@@ -41,6 +41,9 @@ |
#import "chrome/browser/ui/cocoa/toolbar/toolbar_view.h" |
#import "chrome/browser/ui/cocoa/view_id_util.h" |
#import "chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller.h" |
+#include "chrome/browser/ui/global_error_delegate.h" |
+#include "chrome/browser/ui/global_error_service.h" |
+#include "chrome/browser/ui/global_error_service_factory.h" |
#include "chrome/browser/ui/omnibox/omnibox_view.h" |
#include "chrome/browser/ui/toolbar/toolbar_model.h" |
#include "chrome/browser/ui/toolbar/wrench_menu_model.h" |
@@ -77,6 +80,9 @@ const CGFloat kAnimationDuration = 0.2; |
// The amount of left padding that the wrench menu should have. |
const CGFloat kWrenchMenuLeftPadding = 3.0; |
+// The vertical offset of the wrench bubble from the wrench menu button. |
+const CGFloat kWrenchBubblePointOffsetY = 6.0; |
+ |
} // namespace |
@interface ToolbarController(Private) |
@@ -564,9 +570,23 @@ class NotificationBridge : public NotificationObserver { |
[[wrenchButton_ cell] |
setOverlayImageID:UpgradeDetector::GetInstance()->GetIconResourceID( |
UpgradeDetector::UPGRADE_ICON_TYPE_BADGE)]; |
- } else { |
- [[wrenchButton_ cell] setOverlayImageID:0]; |
+ return; |
} |
+ |
+ const std::vector<GlobalErrorDelegate*>& errors = |
+ GlobalErrorServiceFactory::GetForProfile( |
+ browser_->profile())->GetErrorDelegates(); |
+ for (std::vector<GlobalErrorDelegate*>::const_iterator |
+ it = errors.begin(); it != errors.end(); ++it) { |
+ GlobalErrorDelegate* error = *it; |
+ if (error->HasBadge()) { |
+ [[wrenchButton_ cell] |
+ setOverlayImageID:error->GetBadgeResourceID()]; |
+ return; |
+ } |
+ } |
+ |
+ [[wrenchButton_ cell] setOverlayImageID:0]; |
} |
- (void)prefChanged:(std::string*)prefName { |
@@ -722,6 +742,13 @@ class NotificationBridge : public NotificationObserver { |
return locationBarView_->GetBookmarkBubblePoint(); |
} |
+- (NSPoint)wrenchButtonBubblePoint { |
+ NSRect bounds = [wrenchButton_ bounds]; |
+ NSPoint point = |
+ NSMakePoint(NSMidX(bounds), NSMaxY(bounds) - kWrenchBubblePointOffsetY); |
+ return [wrenchButton_ convertPoint:point toView:nil]; |
+} |
+ |
- (CGFloat)desiredHeightForCompression:(CGFloat)compressByHeight { |
// With no toolbar, just ignore the compression. |
return hasToolbar_ ? kBaseToolbarHeight - compressByHeight : |