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

Side by Side Diff: chrome/browser/ui/views/message_center/web_notification_tray.cc

Issue 459123002: Remove status icon if there are no more notifications. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 int visible_notifications =
280 message_center()->GetVisibleNotifications().size();
281 if (visible_notifications == 0) {
Jun Mukai 2014/08/11 19:13:40 Why not simply if (message_center()->GetVisibleNot
dewittj 2014/08/11 19:51:24 Done.
282 DestroyStatusIcon();
283 return;
284 }
285
279 gfx::ImageSkia* icon_image = GetIcon( 286 gfx::ImageSkia* icon_image = GetIcon(
280 unread_notifications, 287 unread_notifications,
281 message_center()->IsQuietMode()); 288 message_center()->IsQuietMode());
282 289
283 if (status_icon_) { 290 if (status_icon_) {
284 status_icon_->SetImage(*icon_image); 291 status_icon_->SetImage(*icon_image);
285 status_icon_->SetToolTip(tool_tip); 292 status_icon_->SetToolTip(tool_tip);
286 return; 293 return;
287 } 294 }
288 295
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 status_icon_menu_ = menu.get(); 401 status_icon_menu_ = menu.get();
395 status_icon->SetContextMenu(menu.Pass()); 402 status_icon->SetContextMenu(menu.Pass());
396 } 403 }
397 404
398 MessageCenterWidgetDelegate* 405 MessageCenterWidgetDelegate*
399 WebNotificationTray::GetMessageCenterWidgetDelegateForTest() { 406 WebNotificationTray::GetMessageCenterWidgetDelegateForTest() {
400 return message_center_delegate_; 407 return message_center_delegate_;
401 } 408 }
402 409
403 } // namespace message_center 410 } // namespace message_center
OLDNEW
« 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