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

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

Issue 12667018: Switch Windows to use the MessagePopupCollection (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Better comments. Created 7 years, 9 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/timer.h" 10 #include "base/timer.h"
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 139
140 void MessagePopupCollection::UpdatePopups() { 140 void MessagePopupCollection::UpdatePopups() {
141 NotificationList::PopupNotifications popups = 141 NotificationList::PopupNotifications popups =
142 message_center_->notification_list()->GetPopupNotifications(); 142 message_center_->notification_list()->GetPopupNotifications();
143 143
144 if (popups.empty()) { 144 if (popups.empty()) {
145 CloseAllWidgets(); 145 CloseAllWidgets();
146 return; 146 return;
147 } 147 }
148 148
149 gfx::Rect work_area;
150 #if defined(OS_WIN) && defined(USE_AURA)
151 // On Win+Aura, we don't have a context since the popups currently show up on
152 // the Windows desktop, not in the Aura/Ash desktop. This code will display
153 // the popups on the primary display.
154 gfx::Screen* screen = gfx::Screen::GetNativeScreen();
155 work_area = screen->GetPrimaryDisplay().work_area();
156 #else
149 gfx::Screen* screen = gfx::Screen::GetScreenFor(context_); 157 gfx::Screen* screen = gfx::Screen::GetScreenFor(context_);
150 gfx::Rect work_area = screen->GetDisplayNearestWindow(context_).work_area(); 158 work_area = screen->GetDisplayNearestWindow(context_).work_area();
159 #endif
151 160
152 std::set<std::string> old_toast_ids; 161 std::set<std::string> old_toast_ids;
153 for (ToastContainer::iterator iter = toasts_.begin(); iter != toasts_.end(); 162 for (ToastContainer::iterator iter = toasts_.begin(); iter != toasts_.end();
154 ++iter) { 163 ++iter) {
155 old_toast_ids.insert(iter->first); 164 old_toast_ids.insert(iter->first);
156 } 165 }
157 166
158 int bottom = work_area.bottom() - kMarginBetweenItems; 167 int bottom = work_area.bottom() - kMarginBetweenItems;
159 int left = work_area.right() - kWebNotificationWidth - kMarginBetweenItems; 168 int left = work_area.right() - kWebNotificationWidth - kMarginBetweenItems;
160 // Iterate in the reverse order to keep the oldest toasts on screen. Newer 169 // Iterate in the reverse order to keep the oldest toasts on screen. Newer
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 message_center_->notification_list()->MarkSinglePopupAsShown( 255 message_center_->notification_list()->MarkSinglePopupAsShown(
247 iter->first, false); 256 iter->first, false);
248 toasts_.erase(iter); 257 toasts_.erase(iter);
249 break; 258 break;
250 } 259 }
251 } 260 }
252 UpdatePopups(); 261 UpdatePopups();
253 } 262 }
254 263
255 } // namespace message_center 264 } // namespace message_center
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698