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

Unified Diff: chrome/browser/ui/cocoa/notifications/message_center_tray_bridge.mm

Issue 15917008: [Mac][MC] Add a tooltip for the status item. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/notifications/message_center_tray_bridge.mm
diff --git a/chrome/browser/ui/cocoa/notifications/message_center_tray_bridge.mm b/chrome/browser/ui/cocoa/notifications/message_center_tray_bridge.mm
index d9b82f9a0a723df33978e2a17a0d79dda3652d81..f50a0b50526f9413289061964f34718e1728cf9d 100644
--- a/chrome/browser/ui/cocoa/notifications/message_center_tray_bridge.mm
+++ b/chrome/browser/ui/cocoa/notifications/message_center_tray_bridge.mm
@@ -4,7 +4,12 @@
#include "chrome/browser/ui/cocoa/notifications/message_center_tray_bridge.h"
+#include "base/i18n/number_formatting.h"
#include "chrome/browser/browser_process.h"
+#include "grit/chromium_strings.h"
+#include "grit/ui_strings.h"
+#include "ui/base/l10n/l10n_util.h"
+#import "ui/base/l10n/l10n_util_mac.h"
#import "ui/message_center/cocoa/popup_collection.h"
#import "ui/message_center/cocoa/status_item_view.h"
#import "ui/message_center/cocoa/tray_controller.h"
@@ -42,8 +47,20 @@ MessageCenterTrayBridge::~MessageCenterTrayBridge() {
}
void MessageCenterTrayBridge::OnMessageCenterTrayChanged() {
- [status_item_view_ setUnreadCount:
- message_center_->UnreadNotificationCount()];
+ size_t unread_count = message_center_->UnreadNotificationCount();
+ [status_item_view_ setUnreadCount:unread_count];
+
+ string16 product_name = l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME);
+ if (unread_count > 0) {
+ string16 unread_count_string = base::FormatNumber(unread_count);
+ [status_item_view_ setToolTip:
+ l10n_util::GetNSStringF(IDS_MESSAGE_CENTER_TOOLTIP_UNREAD,
+ product_name, unread_count_string)];
+ } else {
+ [status_item_view_ setToolTip:
+ l10n_util::GetNSStringF(IDS_MESSAGE_CENTER_TOOLTIP, product_name)];
+ }
+
[tray_controller_ onMessageCenterTrayChanged];
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698