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