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

Side by Side Diff: ash/system/web_notification/web_notification_tray.cc

Issue 11028134: Re-factor Ash Message Center code part 2/4 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « ash/system/web_notification/web_notification_tray.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ash/system/web_notification/web_notification_tray.h" 5 #include "ash/system/web_notification/web_notification_tray.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/system/status_area_widget.h" 8 #include "ash/system/status_area_widget.h"
9 #include "ash/system/tray/tray_bubble_view.h" 9 #include "ash/system/tray/tray_bubble_view.h"
10 #include "ash/system/tray/tray_constants.h" 10 #include "ash/system/tray/tray_constants.h"
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 } 343 }
344 if (popup_bubble()) { 344 if (popup_bubble()) {
345 if (notification_list_->notifications().size() == 0) 345 if (notification_list_->notifications().size() == 0)
346 HidePopupBubble(); 346 HidePopupBubble();
347 else 347 else
348 popup_bubble()->ScheduleUpdate(); 348 popup_bubble()->ScheduleUpdate();
349 } 349 }
350 UpdateTray(); 350 UpdateTray();
351 } 351 }
352 352
353 void WebNotificationTray::HideBubble(WebNotificationBubble* bubble) { 353 void WebNotificationTray::HideBubbleWithView(
354 if (bubble == message_center_bubble()) { 354 const TrayBubbleView* bubble_view) {
355 if (message_center_bubble() &&
356 bubble_view == message_center_bubble()->bubble_view()) {
355 HideMessageCenterBubble(); 357 HideMessageCenterBubble();
356 } else if (bubble == popup_bubble()) { 358 } else if (popup_bubble() && bubble_view == popup_bubble()->bubble_view()) {
357 HidePopupBubble(); 359 HidePopupBubble();
358 } 360 }
359 } 361 }
360 362
363 bool WebNotificationTray::ClickedOutsideBubble() {
364 // Only hide the message center.
365 if (!message_center_bubble())
366 return false;
367 HideMessageCenterBubble();
368 return true;
369 }
370
361 // Methods for testing 371 // Methods for testing
362 372
363 size_t WebNotificationTray::GetNotificationCountForTest() const { 373 size_t WebNotificationTray::GetNotificationCountForTest() const {
364 return notification_list_->notifications().size(); 374 return notification_list_->notifications().size();
365 } 375 }
366 376
367 bool WebNotificationTray::HasNotificationForTest(const std::string& id) const { 377 bool WebNotificationTray::HasNotificationForTest(const std::string& id) const {
368 return notification_list_->HasNotification(id); 378 return notification_list_->HasNotification(id);
369 } 379 }
370 380
371 void WebNotificationTray::RemoveAllNotificationsForTest() { 381 void WebNotificationTray::RemoveAllNotificationsForTest() {
372 notification_list_->RemoveAllNotifications(); 382 notification_list_->RemoveAllNotifications();
373 } 383 }
374 384
375 size_t WebNotificationTray::GetMessageCenterNotificationCountForTest() const { 385 size_t WebNotificationTray::GetMessageCenterNotificationCountForTest() const {
376 if (!message_center_bubble()) 386 if (!message_center_bubble())
377 return 0; 387 return 0;
378 return message_center_bubble()->NumMessageViewsForTest(); 388 return message_center_bubble()->NumMessageViewsForTest();
379 } 389 }
380 390
381 size_t WebNotificationTray::GetPopupNotificationCountForTest() const { 391 size_t WebNotificationTray::GetPopupNotificationCountForTest() const {
382 if (!popup_bubble()) 392 if (!popup_bubble())
383 return 0; 393 return 0;
384 return popup_bubble()->NumMessageViewsForTest(); 394 return popup_bubble()->NumMessageViewsForTest();
385 } 395 }
386 396
387 } // namespace ash 397 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/web_notification/web_notification_tray.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698