| 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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 | 166 |
| 167 NotificationList::PopupNotifications popups = | 167 NotificationList::PopupNotifications popups = |
| 168 message_center_->GetPopupNotifications(); | 168 message_center_->GetPopupNotifications(); |
| 169 if (popups.empty()) { | 169 if (popups.empty()) { |
| 170 CloseAllWidgets(); | 170 CloseAllWidgets(); |
| 171 return; | 171 return; |
| 172 } | 172 } |
| 173 | 173 |
| 174 bool top_down = alignment_delegate_->IsTopDown(); | 174 bool top_down = alignment_delegate_->IsTopDown(); |
| 175 int base = GetBaseLine(toasts_.empty() ? NULL : toasts_.back()); | 175 int base = GetBaseLine(toasts_.empty() ? NULL : toasts_.back()); |
| 176 #if defined(OS_CHROMEOS) |
| 177 bool is_primary_display = |
| 178 alignment_delegate_->IsPrimaryDisplayForNotification(); |
| 179 #endif |
| 176 | 180 |
| 177 // Iterate in the reverse order to keep the oldest toasts on screen. Newer | 181 // Iterate in the reverse order to keep the oldest toasts on screen. Newer |
| 178 // items may be ignored if there are no room to place them. | 182 // items may be ignored if there are no room to place them. |
| 179 for (NotificationList::PopupNotifications::const_reverse_iterator iter = | 183 for (NotificationList::PopupNotifications::const_reverse_iterator iter = |
| 180 popups.rbegin(); iter != popups.rend(); ++iter) { | 184 popups.rbegin(); iter != popups.rend(); ++iter) { |
| 181 if (FindToast((*iter)->id())) | 185 if (FindToast((*iter)->id())) |
| 182 continue; | 186 continue; |
| 183 | 187 |
| 188 #if defined(OS_CHROMEOS) |
| 189 // Disables popup of custom notification on non-primary displays, since |
| 190 // currently custom notification supports only on one display at the same |
| 191 // time. |
| 192 // TODO(yoshiki): Support custom popup notification on multiple display |
| 193 // (crbug.com/715370). |
| 194 if (!is_primary_display && (*iter)->type() == NOTIFICATION_TYPE_CUSTOM) |
| 195 continue; |
| 196 #endif |
| 197 |
| 184 MessageView* view; | 198 MessageView* view; |
| 185 // Create top-level notification. | 199 // Create top-level notification. |
| 186 #if defined(OS_CHROMEOS) | 200 #if defined(OS_CHROMEOS) |
| 187 if ((*iter)->pinned()) { | 201 if ((*iter)->pinned()) { |
| 188 Notification notification = *(*iter); | 202 Notification notification = *(*iter); |
| 189 // Override pinned status, since toasts should be closable even when it's | 203 // Override pinned status, since toasts should be closable even when it's |
| 190 // pinned. | 204 // pinned. |
| 191 notification.set_pinned(false); | 205 notification.set_pinned(false); |
| 192 view = MessageViewFactory::Create(NULL, notification, true); | 206 view = MessageViewFactory::Create(NULL, notification, true); |
| 193 } else | 207 } else |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 564 views::Widget* widget = (*iter)->GetWidget(); | 578 views::Widget* widget = (*iter)->GetWidget(); |
| 565 if (widget) | 579 if (widget) |
| 566 return widget->GetWindowBoundsInScreen(); | 580 return widget->GetWindowBoundsInScreen(); |
| 567 break; | 581 break; |
| 568 } | 582 } |
| 569 } | 583 } |
| 570 return gfx::Rect(); | 584 return gfx::Rect(); |
| 571 } | 585 } |
| 572 | 586 |
| 573 } // namespace message_center | 587 } // namespace message_center |
| OLD | NEW |