OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/notifications/platform_notification_service_impl.h" | 5 #include "chrome/browser/notifications/platform_notification_service_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 382 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
383 | 383 |
384 Profile* profile = Profile::FromBrowserContext(browser_context); | 384 Profile* profile = Profile::FromBrowserContext(browser_context); |
385 if (!profile || profile->AsTestingProfile()) | 385 if (!profile || profile->AsTestingProfile()) |
386 return false; // Tests will not have a message center. | 386 return false; // Tests will not have a message center. |
387 | 387 |
388 return GetNotificationDisplayService(profile)->GetDisplayed( | 388 return GetNotificationDisplayService(profile)->GetDisplayed( |
389 displayed_notifications); | 389 displayed_notifications); |
390 } | 390 } |
391 | 391 |
| 392 void PlatformNotificationServiceImpl::GetDisplayedNotificationsAsync( |
| 393 BrowserContext* browser_context, |
| 394 const NotificationCommon::NotificationResultCallback& callback) { |
| 395 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 396 |
| 397 Profile* profile = Profile::FromBrowserContext(browser_context); |
| 398 if (!profile || profile->AsTestingProfile()) |
| 399 return; // Tests will not have a message center. |
| 400 |
| 401 GetNotificationDisplayService(profile)->GetDisplayedAsync(callback); |
| 402 } |
| 403 |
392 void PlatformNotificationServiceImpl::OnClickEventDispatchComplete( | 404 void PlatformNotificationServiceImpl::OnClickEventDispatchComplete( |
393 content::PersistentNotificationStatus status) { | 405 content::PersistentNotificationStatus status) { |
394 UMA_HISTOGRAM_ENUMERATION( | 406 UMA_HISTOGRAM_ENUMERATION( |
395 "Notifications.PersistentWebNotificationClickResult", status, | 407 "Notifications.PersistentWebNotificationClickResult", status, |
396 content::PersistentNotificationStatus:: | 408 content::PersistentNotificationStatus:: |
397 PERSISTENT_NOTIFICATION_STATUS_MAX); | 409 PERSISTENT_NOTIFICATION_STATUS_MAX); |
398 #if BUILDFLAG(ENABLE_BACKGROUND) | 410 #if BUILDFLAG(ENABLE_BACKGROUND) |
399 DCHECK_GT(pending_click_dispatch_events_, 0); | 411 DCHECK_GT(pending_click_dispatch_events_, 0); |
400 if (--pending_click_dispatch_events_ == 0) { | 412 if (--pending_click_dispatch_events_ == 0) { |
401 click_dispatch_keep_alive_.reset(); | 413 click_dispatch_keep_alive_.reset(); |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 } | 530 } |
519 #endif | 531 #endif |
520 | 532 |
521 return base::string16(); | 533 return base::string16(); |
522 } | 534 } |
523 | 535 |
524 void PlatformNotificationServiceImpl::SetNotificationDisplayServiceForTesting( | 536 void PlatformNotificationServiceImpl::SetNotificationDisplayServiceForTesting( |
525 NotificationDisplayService* display_service) { | 537 NotificationDisplayService* display_service) { |
526 test_display_service_ = display_service; | 538 test_display_service_ = display_service; |
527 } | 539 } |
OLD | NEW |