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

Unified Diff: chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm

Issue 7857014: patch for global error bubbles (view/gtk) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 3 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/ui/cocoa/toolbar/toolbar_controller.h ('k') | chrome/browser/ui/global_error_bubble_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 :
« no previous file with comments | « chrome/browser/ui/cocoa/toolbar/toolbar_controller.h ('k') | chrome/browser/ui/global_error_bubble_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698