| 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_popup_collection.h" | 5 #include "ui/message_center/views/message_popup_collection.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 } | 443 } |
| 444 if (toast_iter == toasts_.end()) | 444 if (toast_iter == toasts_.end()) |
| 445 return; | 445 return; |
| 446 | 446 |
| 447 NotificationList::PopupNotifications notifications = | 447 NotificationList::PopupNotifications notifications = |
| 448 message_center_->GetPopupNotifications(); | 448 message_center_->GetPopupNotifications(); |
| 449 bool updated = false; | 449 bool updated = false; |
| 450 | 450 |
| 451 for (NotificationList::PopupNotifications::iterator iter = | 451 for (NotificationList::PopupNotifications::iterator iter = |
| 452 notifications.begin(); iter != notifications.end(); ++iter) { | 452 notifications.begin(); iter != notifications.end(); ++iter) { |
| 453 if ((*iter)->id() != notification_id) | 453 Notification* notification = *iter; |
| 454 DCHECK(notification); |
| 455 ToastContentsView* toast_contents_view = *toast_iter; |
| 456 DCHECK(toast_contents_view); |
| 457 |
| 458 if (notification->id() != notification_id) |
| 454 continue; | 459 continue; |
| 455 | 460 |
| 456 const RichNotificationData& optional_fields = | 461 const RichNotificationData& optional_fields = |
| 457 (*iter)->rich_notification_data(); | 462 notification->rich_notification_data(); |
| 458 bool a11y_feedback_for_updates = | 463 bool a11y_feedback_for_updates = |
| 459 optional_fields.should_make_spoken_feedback_for_popup_updates; | 464 optional_fields.should_make_spoken_feedback_for_popup_updates; |
| 460 | 465 |
| 461 NotificationView* view = | 466 toast_contents_view->UpdateContents(*notification, |
| 462 NotificationView::Create(*toast_iter, | 467 a11y_feedback_for_updates); |
| 463 *(*iter), | 468 |
| 464 true); // Create top-level notification. | |
| 465 view->set_context_menu_controller(context_menu_controller_.get()); | |
| 466 (*toast_iter)->SetContents(view, a11y_feedback_for_updates); | |
| 467 updated = true; | 469 updated = true; |
| 468 } | 470 } |
| 469 | 471 |
| 470 // OnNotificationUpdated() can be called when a notification is excluded from | 472 // OnNotificationUpdated() can be called when a notification is excluded from |
| 471 // the popup notification list but still remains in the full notification | 473 // the popup notification list but still remains in the full notification |
| 472 // list. In that case the widget for the notification has to be closed here. | 474 // list. In that case the widget for the notification has to be closed here. |
| 473 if (!updated) | 475 if (!updated) |
| 474 RemoveToast(*toast_iter, /*mark_as_shown=*/true); | 476 RemoveToast(*toast_iter, /*mark_as_shown=*/true); |
| 475 | 477 |
| 476 if (user_is_closing_toasts_by_clicking_) | 478 if (user_is_closing_toasts_by_clicking_) |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 606 views::Widget* widget = (*iter)->GetWidget(); | 608 views::Widget* widget = (*iter)->GetWidget(); |
| 607 if (widget) | 609 if (widget) |
| 608 return widget->GetWindowBoundsInScreen(); | 610 return widget->GetWindowBoundsInScreen(); |
| 609 break; | 611 break; |
| 610 } | 612 } |
| 611 } | 613 } |
| 612 return gfx::Rect(); | 614 return gfx::Rect(); |
| 613 } | 615 } |
| 614 | 616 |
| 615 } // namespace message_center | 617 } // namespace message_center |
| OLD | NEW |