OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/views/message_center/web_notification_tray.h" | 5 #include "chrome/browser/ui/views/message_center/web_notification_tray.h" |
6 | 6 |
7 #include "base/i18n/number_formatting.h" | 7 #include "base/i18n/number_formatting.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 | 269 |
270 base::string16 tool_tip; | 270 base::string16 tool_tip; |
271 if (unread_notifications > 0) { | 271 if (unread_notifications > 0) { |
272 base::string16 str_unread_count = base::FormatNumber(unread_notifications); | 272 base::string16 str_unread_count = base::FormatNumber(unread_notifications); |
273 tool_tip = l10n_util::GetStringFUTF16(IDS_MESSAGE_CENTER_TOOLTIP_UNREAD, | 273 tool_tip = l10n_util::GetStringFUTF16(IDS_MESSAGE_CENTER_TOOLTIP_UNREAD, |
274 str_unread_count); | 274 str_unread_count); |
275 } else { | 275 } else { |
276 tool_tip = l10n_util::GetStringUTF16(IDS_MESSAGE_CENTER_TOOLTIP); | 276 tool_tip = l10n_util::GetStringUTF16(IDS_MESSAGE_CENTER_TOOLTIP); |
277 } | 277 } |
278 | 278 |
| 279 if (message_center()->GetVisibleNotifications().empty()) { |
| 280 DestroyStatusIcon(); |
| 281 return; |
| 282 } |
| 283 |
279 gfx::ImageSkia* icon_image = GetIcon( | 284 gfx::ImageSkia* icon_image = GetIcon( |
280 unread_notifications, | 285 unread_notifications, |
281 message_center()->IsQuietMode()); | 286 message_center()->IsQuietMode()); |
282 | 287 |
283 if (status_icon_) { | 288 if (status_icon_) { |
284 status_icon_->SetImage(*icon_image); | 289 status_icon_->SetImage(*icon_image); |
285 status_icon_->SetToolTip(tool_tip); | 290 status_icon_->SetToolTip(tool_tip); |
286 return; | 291 return; |
287 } | 292 } |
288 | 293 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 status_icon_menu_ = menu.get(); | 399 status_icon_menu_ = menu.get(); |
395 status_icon->SetContextMenu(menu.Pass()); | 400 status_icon->SetContextMenu(menu.Pass()); |
396 } | 401 } |
397 | 402 |
398 MessageCenterWidgetDelegate* | 403 MessageCenterWidgetDelegate* |
399 WebNotificationTray::GetMessageCenterWidgetDelegateForTest() { | 404 WebNotificationTray::GetMessageCenterWidgetDelegateForTest() { |
400 return message_center_delegate_; | 405 return message_center_delegate_; |
401 } | 406 } |
402 | 407 |
403 } // namespace message_center | 408 } // namespace message_center |
OLD | NEW |