OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "ui/message_center/views/message_center_view.h" | 5 #include "ui/message_center/views/message_center_view.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "grit/ui_strings.h" | 9 #include "grit/ui_strings.h" |
10 #include "ui/base/l10n/l10n_util.h" | 10 #include "ui/base/l10n/l10n_util.h" |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 | 385 |
386 MessageCenterView::~MessageCenterView() { | 386 MessageCenterView::~MessageCenterView() { |
387 } | 387 } |
388 | 388 |
389 void MessageCenterView::SetNotifications( | 389 void MessageCenterView::SetNotifications( |
390 const NotificationList::Notifications& notifications) { | 390 const NotificationList::Notifications& notifications) { |
391 RemoveAllNotifications(); | 391 RemoveAllNotifications(); |
392 for (NotificationList::Notifications::const_iterator iter = | 392 for (NotificationList::Notifications::const_iterator iter = |
393 notifications.begin(); iter != notifications.end(); ++iter) { | 393 notifications.begin(); iter != notifications.end(); ++iter) { |
394 AddNotification(*(*iter)); | 394 AddNotification(*(*iter)); |
395 if (message_views_.size() >= | 395 if (message_views_.size() >= kMaxVisibleMessageCenterNotifications) |
396 NotificationList::kMaxVisibleMessageCenterNotifications) { | |
397 break; | 396 break; |
398 } | |
399 } | 397 } |
400 if (message_views_.empty()) { | 398 if (message_views_.empty()) { |
401 views::Label* label = new views::Label(l10n_util::GetStringUTF16( | 399 views::Label* label = new views::Label(l10n_util::GetStringUTF16( |
402 IDS_MESSAGE_CENTER_NO_MESSAGES)); | 400 IDS_MESSAGE_CENTER_NO_MESSAGES)); |
403 label->SetFont(label->font().DeriveFont(1)); | 401 label->SetFont(label->font().DeriveFont(1)); |
404 label->SetEnabledColor(SK_ColorGRAY); | 402 label->SetEnabledColor(SK_ColorGRAY); |
405 // Set transparent background to ensure that subpixel rendering | 403 // Set transparent background to ensure that subpixel rendering |
406 // is disabled. See crbug.com/169056 | 404 // is disabled. See crbug.com/169056 |
407 label->SetBackgroundColor(kTransparentColor); | 405 label->SetBackgroundColor(kTransparentColor); |
408 message_list_view_->AddChildView(label); | 406 message_list_view_->AddChildView(label); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 // NotificationViews are expanded by default here until | 445 // NotificationViews are expanded by default here until |
448 // http://crbug.com/217902 is fixed. TODO(dharcourt): Fix. | 446 // http://crbug.com/217902 is fixed. TODO(dharcourt): Fix. |
449 MessageView* view = NotificationView::Create( | 447 MessageView* view = NotificationView::Create( |
450 notification, message_center_, true); | 448 notification, message_center_, true); |
451 view->set_scroller(scroller_); | 449 view->set_scroller(scroller_); |
452 message_views_[notification.id()] = view; | 450 message_views_[notification.id()] = view; |
453 message_list_view_->AddChildView(view); | 451 message_list_view_->AddChildView(view); |
454 } | 452 } |
455 | 453 |
456 } // namespace message_center | 454 } // namespace message_center |
OLD | NEW |