| 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 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 | 354 |
| 355 Profile* profile = Profile::FromBrowserContext(browser_context); | 355 Profile* profile = Profile::FromBrowserContext(browser_context); |
| 356 DCHECK(profile); | 356 DCHECK(profile); |
| 357 | 357 |
| 358 closed_notifications_.insert(notification_id); | 358 closed_notifications_.insert(notification_id); |
| 359 | 359 |
| 360 GetNotificationDisplayService(profile)->Close(NotificationCommon::PERSISTENT, | 360 GetNotificationDisplayService(profile)->Close(NotificationCommon::PERSISTENT, |
| 361 notification_id); | 361 notification_id); |
| 362 } | 362 } |
| 363 | 363 |
| 364 bool PlatformNotificationServiceImpl::GetDisplayedPersistentNotifications( | 364 bool PlatformNotificationServiceImpl::GetDisplayedNotifications( |
| 365 BrowserContext* browser_context, | 365 BrowserContext* browser_context, |
| 366 std::set<std::string>* displayed_notifications) { | 366 std::set<std::string>* displayed_notifications) { |
| 367 DCHECK(displayed_notifications); | 367 DCHECK(displayed_notifications); |
| 368 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 368 | 369 |
| 369 Profile* profile = Profile::FromBrowserContext(browser_context); | 370 Profile* profile = Profile::FromBrowserContext(browser_context); |
| 370 if (!profile || profile->AsTestingProfile()) | 371 if (!profile || profile->AsTestingProfile()) |
| 371 return false; // Tests will not have a message center. | 372 return false; // Tests will not have a message center. |
| 372 | 373 |
| 373 // TODO(peter): Filter for persistent notifications only. | |
| 374 return GetNotificationDisplayService(profile)->GetDisplayed( | 374 return GetNotificationDisplayService(profile)->GetDisplayed( |
| 375 displayed_notifications); | 375 displayed_notifications); |
| 376 } | 376 } |
| 377 | 377 |
| 378 void PlatformNotificationServiceImpl::OnClickEventDispatchComplete( | 378 void PlatformNotificationServiceImpl::OnClickEventDispatchComplete( |
| 379 content::PersistentNotificationStatus status) { | 379 content::PersistentNotificationStatus status) { |
| 380 UMA_HISTOGRAM_ENUMERATION( | 380 UMA_HISTOGRAM_ENUMERATION( |
| 381 "Notifications.PersistentWebNotificationClickResult", status, | 381 "Notifications.PersistentWebNotificationClickResult", status, |
| 382 content::PersistentNotificationStatus:: | 382 content::PersistentNotificationStatus:: |
| 383 PERSISTENT_NOTIFICATION_STATUS_MAX); | 383 PERSISTENT_NOTIFICATION_STATUS_MAX); |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 } | 497 } |
| 498 #endif | 498 #endif |
| 499 | 499 |
| 500 return base::string16(); | 500 return base::string16(); |
| 501 } | 501 } |
| 502 | 502 |
| 503 void PlatformNotificationServiceImpl::SetNotificationDisplayServiceForTesting( | 503 void PlatformNotificationServiceImpl::SetNotificationDisplayServiceForTesting( |
| 504 NotificationDisplayService* display_service) { | 504 NotificationDisplayService* display_service) { |
| 505 test_display_service_ = display_service; | 505 test_display_service_ = display_service; |
| 506 } | 506 } |
| OLD | NEW |