Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(323)

Side by Side Diff: ui/message_center/views/message_popup_collection.cc

Issue 2834773002: Hide popup custom notifications on non-primary displays (Closed)
Patch Set: Remove debug output Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 isPrimaryDisplay =
stevenjb 2017/04/24 20:40:02 is_primary_display
yoshiki 2017/04/26 01:29:29 Done.
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.
190 // Chrome OS shows popups on all displays but custom notification can be
191 // visible only on one display at the same time.
192 if (!isPrimaryDisplay && (*iter)->type() == NOTIFICATION_TYPE_CUSTOM)
193 continue;
194 #endif
195
184 MessageView* view; 196 MessageView* view;
185 // Create top-level notification. 197 // Create top-level notification.
186 #if defined(OS_CHROMEOS) 198 #if defined(OS_CHROMEOS)
187 if ((*iter)->pinned()) { 199 if ((*iter)->pinned()) {
188 Notification notification = *(*iter); 200 Notification notification = *(*iter);
189 // Override pinned status, since toasts should be closable even when it's 201 // Override pinned status, since toasts should be closable even when it's
190 // pinned. 202 // pinned.
191 notification.set_pinned(false); 203 notification.set_pinned(false);
192 view = MessageViewFactory::Create(NULL, notification, true); 204 view = MessageViewFactory::Create(NULL, notification, true);
193 } else 205 } else
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 views::Widget* widget = (*iter)->GetWidget(); 576 views::Widget* widget = (*iter)->GetWidget();
565 if (widget) 577 if (widget)
566 return widget->GetWindowBoundsInScreen(); 578 return widget->GetWindowBoundsInScreen();
567 break; 579 break;
568 } 580 }
569 } 581 }
570 return gfx::Rect(); 582 return gfx::Rect();
571 } 583 }
572 584
573 } // namespace message_center 585 } // namespace message_center
OLDNEW
« no previous file with comments | « ui/message_center/views/desktop_popup_alignment_delegate.cc ('k') | ui/message_center/views/popup_alignment_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698