| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/message_center_bubble.h" | 5 #include "ui/message_center/message_center_bubble.h" |
| 6 | 6 |
| 7 #include "grit/ui_strings.h" | 7 #include "grit/ui_strings.h" |
| 8 #include "third_party/skia/include/core/SkPaint.h" | 8 #include "third_party/skia/include/core/SkPaint.h" |
| 9 #include "ui/base/l10n/l10n_util.h" | 9 #include "ui/base/l10n/l10n_util.h" |
| 10 #include "ui/base/resource/resource_bundle.h" | 10 #include "ui/base/resource/resource_bundle.h" |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 scroller_->RequestFocus(); | 401 scroller_->RequestFocus(); |
| 402 } | 402 } |
| 403 | 403 |
| 404 void Update(const NotificationList::Notifications& notifications) { | 404 void Update(const NotificationList::Notifications& notifications) { |
| 405 scroll_content_->RemoveAllChildViews(true); | 405 scroll_content_->RemoveAllChildViews(true); |
| 406 scroll_content_->set_preferred_size(gfx::Size()); | 406 scroll_content_->set_preferred_size(gfx::Size()); |
| 407 size_t num_children = 0; | 407 size_t num_children = 0; |
| 408 for (NotificationList::Notifications::const_iterator iter = | 408 for (NotificationList::Notifications::const_iterator iter = |
| 409 notifications.begin(); iter != notifications.end(); ++iter) { | 409 notifications.begin(); iter != notifications.end(); ++iter) { |
| 410 MessageView* view = | 410 MessageView* view = |
| 411 NotificationView::ViewForNotification(*iter, list_delegate_); | 411 NotificationView::ViewForNotification(*(*iter), list_delegate_); |
| 412 view->set_scroller(scroller_); | 412 view->set_scroller(scroller_); |
| 413 view->SetUpView(); | |
| 414 if (IsRichNotificationEnabled()) | 413 if (IsRichNotificationEnabled()) |
| 415 view->set_border(new MessageViewShadowBorder()); | 414 view->set_border(new MessageViewShadowBorder()); |
| 416 scroll_content_->AddChildView(view); | 415 scroll_content_->AddChildView(view); |
| 417 if (++num_children >= | 416 if (++num_children >= |
| 418 NotificationList::kMaxVisibleMessageCenterNotifications) { | 417 NotificationList::kMaxVisibleMessageCenterNotifications) { |
| 419 break; | 418 break; |
| 420 } | 419 } |
| 421 } | 420 } |
| 422 if (num_children == 0) { | 421 if (num_children == 0) { |
| 423 views::Label* label = new views::Label(l10n_util::GetStringUTF16( | 422 views::Label* label = new views::Label(l10n_util::GetStringUTF16( |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 contents_view_->FocusContents(); | 500 contents_view_->FocusContents(); |
| 502 } | 501 } |
| 503 | 502 |
| 504 void MessageCenterBubble::OnBubbleViewDestroyed() { | 503 void MessageCenterBubble::OnBubbleViewDestroyed() { |
| 505 contents_view_ = NULL; | 504 contents_view_ = NULL; |
| 506 } | 505 } |
| 507 | 506 |
| 508 void MessageCenterBubble::UpdateBubbleView() { | 507 void MessageCenterBubble::UpdateBubbleView() { |
| 509 if (!bubble_view()) | 508 if (!bubble_view()) |
| 510 return; // Could get called after view is closed | 509 return; // Could get called after view is closed |
| 511 NotificationList::Notifications notifications; | 510 const NotificationList::Notifications& notifications = |
| 512 list_delegate()->GetNotificationList()->GetNotifications(¬ifications); | 511 list_delegate()->GetNotificationList()->GetNotifications(); |
| 513 contents_view_->Update(notifications); | 512 contents_view_->Update(notifications); |
| 514 bubble_view()->Show(); | 513 bubble_view()->Show(); |
| 515 bubble_view()->UpdateBubble(); | 514 bubble_view()->UpdateBubble(); |
| 516 } | 515 } |
| 517 | 516 |
| 518 void MessageCenterBubble::OnMouseEnteredView() { | 517 void MessageCenterBubble::OnMouseEnteredView() { |
| 519 } | 518 } |
| 520 | 519 |
| 521 void MessageCenterBubble::OnMouseExitedView() { | 520 void MessageCenterBubble::OnMouseExitedView() { |
| 522 } | 521 } |
| 523 | 522 |
| 524 size_t MessageCenterBubble::NumMessageViewsForTest() const { | 523 size_t MessageCenterBubble::NumMessageViewsForTest() const { |
| 525 return contents_view_->NumMessageViews(); | 524 return contents_view_->NumMessageViews(); |
| 526 } | 525 } |
| 527 | 526 |
| 528 } // namespace message_center | 527 } // namespace message_center |
| OLD | NEW |